nir/lcssa: consider loops with no back-edge invariant
Polaris: Totals from 6233 (4.52% of 138014) affected shaders: SpillSGPRs: 47860 -> 48976 (+2.33%) CodeSize: 69764704 -> 69120700 (-0.92%); split: -0.97%, +0.04% Instrs: 13801184 -> 13594107 (-1.50%) Cycles: 1628800928 -> 1516137888 (-6.92%) VMEM: 910459 -> 910208 (-0.03%); split: +0.00%, -0.03% SMEM: 436625 -> 435194 (-0.33%); split: +0.06%, -0.38% SClause: 534750 -> 534620 (-0.02%); split: -0.03%, +0.00% Copies: 1587121 -> 1542867 (-2.79%); split: -2.81%, +0.03% Branches: 545016 -> 509354 (-6.54%) PreSGPRs: 618545 -> 619354 (+0.13%); split: -0.09%, +0.22% Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5924>
This commit is contained in:

committed by
Marge Bot

parent
feb9462bb1
commit
f0a88dbefa
@@ -313,8 +313,18 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
|
||||
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
||||
convert_to_lcssa(nested_node, state);
|
||||
|
||||
state->loop = loop;
|
||||
|
||||
/* mark loop-invariant instructions */
|
||||
if (state->skip_invariants) {
|
||||
/* Without a loop all instructions are invariant.
|
||||
* For outer loops, multiple breaks can still create phis.
|
||||
* The variance then depends on all (nested) break conditions.
|
||||
* We don't consider this, but assume all not_invariant.
|
||||
*/
|
||||
if (nir_loop_first_block(loop)->predecessors->entries == 1)
|
||||
goto end;
|
||||
|
||||
nir_foreach_block_in_cf_node(block, cf_node) {
|
||||
nir_foreach_instr(instr, block) {
|
||||
if (instr->pass_flags == undefined)
|
||||
@@ -323,7 +333,6 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
|
||||
}
|
||||
}
|
||||
|
||||
state->loop = loop;
|
||||
nir_foreach_block_in_cf_node(block, cf_node) {
|
||||
nir_foreach_instr(instr, block) {
|
||||
nir_foreach_ssa_def(instr, convert_loop_exit_for_ssa, state);
|
||||
@@ -334,6 +343,7 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
/* For outer loops, the LCSSA-phi should be considered not invariant */
|
||||
if (state->skip_invariants) {
|
||||
nir_block *block_after_loop =
|
||||
|
Reference in New Issue
Block a user