From 830ea320594c2ad7be69a3bb930077c3ccf35c60 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 20 Jul 2023 09:22:50 -0500 Subject: [PATCH] nir/trivialize: Maintain divergence information Because this pass is intended to be run after out-of-SSA and directly before injesting the NIR into the back-end, it may come after divergence analysis and needs to preserve the divergence information. Fortunately, since all we ever do is insert nir_op_mov, this is easy. Fixes: d313eba94ef0 ("nir: Add pass for trivializing register access") Part-of: (cherry picked from commit f1f05cc7cf4cbce0be189e268902d01dd22de9af) --- .pick_status.json | 2 +- src/compiler/nir/nir_trivialize_registers.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 63119a4f9ec..0b627b82b1d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -24054,7 +24054,7 @@ "description": "nir/trivialize: Maintain divergence information", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d313eba94ef0aebf6ee5217fc128f359e0ce1265", "notes": null diff --git a/src/compiler/nir/nir_trivialize_registers.c b/src/compiler/nir/nir_trivialize_registers.c index a517630d3a9..ff23a20e084 100644 --- a/src/compiler/nir/nir_trivialize_registers.c +++ b/src/compiler/nir/nir_trivialize_registers.c @@ -70,6 +70,7 @@ trivialize_load(nir_intrinsic_instr *load) nir_builder b = nir_builder_at(nir_after_instr(&load->instr)); nir_ssa_def *copy = nir_mov(&b, &load->dest.ssa); + copy->divergent = load->dest.ssa.divergent; nir_ssa_def_rewrite_uses_after(&load->dest.ssa, copy, copy->parent_instr); assert(list_is_singular(&load->dest.ssa.uses)); @@ -152,6 +153,7 @@ isolate_store(nir_intrinsic_instr *store) nir_builder b = nir_builder_at(nir_before_instr(&store->instr)); nir_ssa_def *copy = nir_mov(&b, store->src[0].ssa); + copy->divergent = store->src[0].ssa->divergent; nir_instr_rewrite_src_ssa(&store->instr, &store->src[0], copy); }