mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-13 14:10:17 +01:00
nir/opt_loop: rematerialize header block derefs in their use blocks
Otherwise, we could end up with phis of derefs. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Fixes:6b4b044739("nir/opt_loop: add loop peeling optimization") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31324> (cherry picked from commit0484044b1a)
This commit is contained in:
parent
f62fb5a08d
commit
35f27de9da
2 changed files with 7 additions and 1 deletions
|
|
@ -704,7 +704,7 @@
|
|||
"description": "nir/opt_loop: rematerialize header block derefs in their use blocks",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "6b4b04473986c9b0e77c925a116be39f6ff3982f",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -410,6 +410,12 @@ opt_loop_peel_initial_break(nir_loop *loop)
|
|||
/* We need LCSSA because we are going to wrap the loop into an IF. */
|
||||
nir_convert_loop_to_lcssa(loop);
|
||||
|
||||
/* We can't lower some derefs to regs or create phis using them, so rematerialize them instead. */
|
||||
nir_foreach_instr_safe(instr, header_block) {
|
||||
if (instr->type == nir_instr_type_deref)
|
||||
nir_rematerialize_deref_in_use_blocks(nir_instr_as_deref(instr));
|
||||
}
|
||||
|
||||
/* Lower loop header and LCSSA-phis to regs. */
|
||||
nir_lower_phis_to_regs_block(header_block);
|
||||
nir_lower_ssa_defs_to_regs_block(header_block);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue