diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index fa7ebaa51af..4a98bd7dca6 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -494,15 +494,24 @@ construct_value(nir_builder *build, state, instr); } - nir_builder_instr_insert(build, &alu->instr); - - assert(alu->def.index == + /* Immediately try to constant-fold the expression, in order to allow + * for more expressions to be matched within a single pass. + */ + nir_def *def = &alu->def; + nir_def *const_expr = nir_try_constant_fold_alu(build, alu); + if (const_expr) { + nir_instr_free(&alu->instr); + def = const_expr; + } else { + nir_builder_instr_insert(build, &alu->instr); + } + assert(def->index == util_dynarray_num_elements(state->states, uint16_t)); util_dynarray_append_typed(state->states, uint16_t, 0); - nir_algebraic_automaton(&alu->instr, state->states, state->pass_op_table); + nir_algebraic_automaton(def->parent_instr, state->states, state->pass_op_table); nir_alu_src val; - val.src = nir_src_for_ssa(&alu->def); + val.src = nir_src_for_ssa(def); if (expr->swizzle < 0) memcpy(val.swizzle, identity_swizzle, sizeof(val.swizzle)); else diff --git a/src/intel/ci/traces-iris.yml b/src/intel/ci/traces-iris.yml index 3f74f37b77b..1a13c248d6c 100644 --- a/src/intel/ci/traces-iris.yml +++ b/src/intel/ci/traces-iris.yml @@ -36,20 +36,20 @@ traces: checksum: f53ac20e17da91c0359c31f2fa3f401e 0ad/0ad-v2.trace: gl-intel-apl: - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 gl-intel-glk: - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 gl-intel-amly: - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 gl-intel-kbl: - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 gl-intel-whl: checksum: e67b7a93bac02e41de0326419ee17a3e gl-intel-cml: - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 gl-intel-adl: label: [no-perf] - checksum: b25b9dfce05def046f6277d05b3cba98 + checksum: 6c9f66db38f03847574c543de48fa203 pathfinder/demo-v2.trace: gl-intel-apl: checksum: d9b33f0a2efe17c21b7933242afd9ec7