Skip to content
  • Connor Abbott's avatar
    ir3/spill: Fix simplify_phi_nodes with multiple loop nesting · 4e8d1559
    Connor Abbott authored
    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.
    4e8d1559