[llvm] [InstSimplify] Simplify nonzero comparisons involving X urem Y via X u>= Y (PR #216072)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 22 10:59:11 PDT 2026
nikic wrote:
isImpliedByDomCondition() is kind of fake support, because it only supports the immediately dominating condition from the predecessor. IMHO we should not use this function unless it's actually practically useful in the narrow pattern it supports -- otherwise we're just deluding ourselves into thinking the optimization is supported while it actually isn't. If I understand correctly, the isImpliedByDomCondition() use has no hits on llvm-opt-benchmark? If so, we should drop it.
It we really want to support dominating conditions for this fold, we probably need to integrate it in ConstraintElim instead. (I guess we could have a stronger variant of https://github.com/llvm/llvm-project/blob/05819ff1dbeb4133a9df43b8c6715da9c23fdcc3/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp#L2255-L2256 with ult in the case where we have a x >= n precond.)
https://github.com/llvm/llvm-project/pull/216072
More information about the llvm-commits
mailing list