[llvm] [StructurizeCFG] Fix incorrect zero-cost hoisting in nested control flow (PR #183792)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 07:47:17 PDT 2026


yxsamliu wrote:

> > > Seems that the output of the new test is the same with/without the code change?
> > 
> > 
> > Did you use tot of main branch for testing? The hoisting feature (hoistZeroCostElseBlockPhiValues) was added relatively recently and without it both versions produce identical output.
> > On current trunk, the test does show a difference: https://godbolt.org/z/oY7jPqGx4 . in the output panel, you can see %swapped1 = shufflevector at line 18 inside iter1.cmp_x and %swapped2 = shufflevector at line 73 inside iter2.cmp_x. With the fix, both shufflevectors stay in their respective do_swap blocks and don't appear in the cmp_x blocks.
> 
> I realized you forgot to set triple correctly in the lit test after simple debugging (but you did in the https://godbolt.org/z/oY7jPqGx4). Without proper TTI, the hoisting does not happen. Please fix it.

sorry I missed that. fixed

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


More information about the llvm-commits mailing list