Commit 1a453045 authored by Timothy Arceri's avatar Timothy Arceri

nir: evaluate loop terminator ior use

Here we replace one side of the ior with NIR_TRUE if the src is a
loop terminators condition that we know can only be true.

No shader-db change.
parent e7f2c8c9
......@@ -524,9 +524,31 @@ opt_if_evaluate_condition_use_loop_terminator(nir_if *nif, nir_loop *loop,
/* Evaluate any uses of the loop terminator condition */
assert(nif->condition.is_ssa);
nir_foreach_use_safe(use_src, nif->condition.ssa) {
progress =
evaluate_term_condition_use(prev_block->index, after_loop->index,
nir_boolean, use_src, mem_ctx, false);
nir_instr *parent_instr = use_src->parent_instr;
if (nir_boolean == NIR_TRUE &&
parent_instr->type == nir_instr_type_alu &&
nir_instr_as_alu(parent_instr)->op == nir_op_ior) {
nir_alu_instr *alu = nir_instr_as_alu(parent_instr);
nir_foreach_use_safe(or_use, &alu->dest.dest.ssa) {
progress =
evaluate_term_condition_use(prev_block->index,
after_loop->index, NIR_TRUE,
or_use, mem_ctx, false);
}
nir_foreach_if_use_safe(or_use, &alu->dest.dest.ssa) {
progress =
evaluate_term_condition_use(prev_block->index,
after_loop->index, NIR_TRUE,
or_use, mem_ctx, true);
}
} else {
progress =
evaluate_term_condition_use(prev_block->index, after_loop->index,
nir_boolean, use_src, mem_ctx, false);
}
}
nir_foreach_if_use_safe(use_src, nif->condition.ssa) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment