[llvm] [LICM][MustExec] Make must-exec logic for IV condition commutative (PR #93150)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Sat May 25 10:54:08 PDT 2024
efriedma-quic wrote:
Suppose a loop exits via a given exit, and that loop exit is guarded by a comparison of a loop-invariant value against an affine AddRec, and the comparison has bitwidth iN. Since the AddRec has width iN, it can take on at most 2^N possible values. Under these conditions, the AddRec can't repeat values, and there must be at least one value of the AddRec that causes the loop to exit. Therefore, there are at most 2^N-1 values which don't cause the loop to exit. So the exit-not-taken count is at most 2^N-1, which fits into an iN.
Arguably not worth implementing, though.
https://github.com/llvm/llvm-project/pull/93150
More information about the llvm-commits
mailing list