[llvm] [SimplifyCFG] Hoist out implied conditions from successor (PR #158773)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 08:19:23 PDT 2025


nikic wrote:

> > The problem is not with the icmps, it's with the control flow. Note that in the test case from #155986 the icmp in the inner block controls a branch, and note that the "else" labels for both branches go to the same block. You need this kind of control flow for the transform to be correct.
> 
> It should work on CFGs like this you mean?
> 
> ```
> A-> B, C
> B -> D, C
> ```

Yes, that looks right.

(Having this order of successors is not required -- there are variants of this transform that would also work with other orders. But maybe for the sake of simplicity we can start by handling only this case.)

https://github.com/llvm/llvm-project/pull/158773


More information about the llvm-commits mailing list