llvm-project
3f2d8eb2 - [FixIrreducible][UnifyLoopExits] Fix callbr multiedge splitting (#207598)

Commit
35 days ago
[FixIrreducible][UnifyLoopExits] Fix callbr multiedge splitting (#207598) This fixes a bug where splitting `callbr` multiedges corrupts the successor's PHI nodes. Originally, the first split edge would replace all incoming edges from the `callbr` block with the newly introduced target block by using `replacePhiUsesWith`. Later edges would create new target blocks and would try to update their edge's PHI as well, but would not find it, leading to a corrupted PHI node. To fix this, it is theoretically only necessary to ensure that exactly one PHI argument is replaced per split edge. However, as all the PHI nodes must have the same argument for every edge from one predecessor, a single target block suffices, through which all traffic can be routed, which will be especially useful for switches, where multiedges are common. [Trunk crashing](https://godbolt.org/z/4MM5eMrW5) Found while working on PR #206567, cc @ro-i.
Author
Parents
Loading