aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-10-31 13:16:28 +1100
committerTimothy Arceri <[email protected]>2018-11-01 09:22:55 +1100
commit5b757b4097f3e1ceec29db04436970c510092126 (patch)
treefb6ccbf6bdb89d069c2cb62b4e31a7eaa9729a21 /src
parent802ae533ab3487f324a701364b06ad82e6601c69 (diff)
nir: fix if condition propagation for alu use
We need to update the cursor before we check if the alu use is dominated by the if condition. Previously we were checking if the current location of the alu instruction was dominated by the if condition which would miss some optimisation opportunities. Fixes: a3b4cb34589e ("nir/opt_if: Rework condition propagation") Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_if.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index 1f2e1f21130..1fe95e53766 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -444,11 +444,10 @@ propagate_condition_eval(nir_builder *b, nir_if *nif, nir_src *use_src,
bool is_if_condition)
{
bool bool_value;
+ b->cursor = nir_before_src(alu_use, is_if_condition);
if (!evaluate_if_condition(nif, b->cursor, &bool_value))
return false;
- b->cursor = nir_before_src(alu_use, is_if_condition);
-
nir_ssa_def *def[2] = {0};
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
if (alu->src[i].src.ssa == use_src->ssa) {