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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 07:55:45 PDT 2024


nikic wrote:

> Oh, I see what you mean: the overall backedge-taken count fits into an iN, but the backedge-taken count for the specific edge doesn't fit. That's unfortunate; I can't think of any way to solve it.

Yes, exactly!

> I suspect it's still slightly profitable to try to truncate the overall backedge-taken count to iN, but maybe not by as much as I was thinking.

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.

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


More information about the llvm-commits mailing list