[llvm] [Passes] Run SimpleLoopUnswitch after introducing invariant branches. (PR #81271)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 11:44:55 PDT 2024


alinas wrote:

One way to approach conditional running of passes is by factoring out key transforms into static method, akin to utils. This is possible for the other patch with IndVars (#81275), and it could work with some refactoring of SLU too, i.e. making the exiting functions available. I'm not sure if that's better :-).

Adding to LPM2 as in the current commit should work fine (SLU doesn't really need MSSA; it can use it for a quick exit, it will update it if available but it's not necessary; and LPM2 doesn't have it available). The only caveat is spreading the pattern of going through a fake analysis to signal that a pass should be run conditionally. 
Note also that adding SLU to LPM2 doesn't give you BFI either, which is available in LPM1.
So, is it an option to add IndVarSimplify to LPM1? (I don't think it makes any changes that would invalidate MSSA, so that should be fairly straightforward to add) Does it address the use case you are looking at? And following up with the same question as for the current approach: what's the compile time vs execution time impact then? i.e. is it worth adding it?

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


More information about the llvm-commits mailing list