Skip to content

ir3/spill: Fix simplify_phi_nodes with multiple loop nesting

Connor Abbott requested to merge cwabbott0/mesa:review/ir3-spill-fix into main

Once we simplified a phi node, we never updated the definition it points to, which meant that it could become out of date if that definition were also simplified, and we didn't check that when rewriting sources. That could happen when there are multiple nested loops with phi nodes at the header.

Fix it by updating the phi's pointer. Since we always update sources after visiting the definition it points to, when we go to rewrite a source, if that source points to a simplified phi, the phi's pointer can't be pointing to a simplified phi because we already visited the phi earlier in the pass and updated it, or else it's been simplified in the meantime and this isn't the last pass. This way we don't need to keep recursing when rewriting sources.

Fixes: 613eaac7 ("ir3: Initial support for spilling non-shared registers")

Merge request reports

Loading