Files
metal2vulkan/src
Anees Iqbal a8f6803ea5 Promote a demoted phi at the block where its edges meet
The promotion pass wrote the phi back into the block that loads the slot.
Nesting usually puts that block one unconditional hop below the join: a loop's
original header becomes the body of a synthesized header, and it is the
synthesized header that owns the back edge and so the meeting of the two
values. With two predecessors one step up and one step here, the slot did not
promote and stayed a function-scope variable -- exactly the loop-carried values
whose live ranges span the most blocks.

Walk up through single-predecessor blocks that do not write the slot before
choosing the phi's block. Every block stepped over is dominated by the one
before it, so the phi stays in scope wherever the load was.

On the bugs/fragment-code-size-explosion shader this takes function-scope
variables from 489 to 33 (3516 before the nesting structurizer) and the module
from 196,052 to 192,860 words, with the same 168 loops and 608 dispatch cases.
spirv-val vulkan1.2 passes.
2026-08-31 12:12:15 +03:00
..
2026-08-20 04:11:23 +03:00
2026-07-22 13:15:24 +03:00
2026-07-22 13:15:24 +03:00