[llvm] [LICM][MustExec] Make must-exec logic for IV condition commutative (PR #93150)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 09:34:25 PDT 2024


nikic wrote:

> I just realized that the specific IR in the test case is being introduced by the "exit predication" transform in IndVars, which currently doesn't have a high cost expansion guard. I think if that is added, then we avoid that transform and get something more similar to the previous IR in LoopVectorize, where we only have to expand the BECount, not also the exit counts. And at that point having a narrower BECount would probably become worthwhile.

Hm, this is trickier than I thought because I do think we want to allow some high cost expansions for that transform -- as it can enable branches to be unswitched out of the loop, doing it can make sense even if trip counts are somewhat expensive. Even in the case here, it may have been a profitable transform if LoopVectorize didn't have to the option of picking an even better alternative.

I'm not sure I really want to follow this rabbit hole all the way to the end. @fhahn As you added the test, are you fine with this landing as-is?

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


More information about the llvm-commits mailing list