[llvm] [CorrelatedValuePropagation] Run CVP before first SimplifyCFG (PR #141125)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 00:53:48 PDT 2025


nikic wrote:

Usually, it's IPSCCP's responsibility to do early range based optimizations before branches get folded to selects. It's part of why it runs so early.

Normally, the peculiar SimplifyCFG followed by SROA pass ordering in EarlyFPM avoids most of the problematic branch to select conversions. It doesn't help in your case where things are already mem2reg'd.

Ideally we'd disable speculation in the first SimplifyCFG run entirely (this is also desirable for other reasons, in particular because it runs prior to profile loading, which means speculation of cold code paths is not prevented).

I think I tried to do this at some point but ran into some regressions that I didn't want to track down at the time. But that direction may be another way to fix this issue.

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


More information about the llvm-commits mailing list