[llvm] [SCEV] Improve applyLoopGuards to support Mul (PR #83428)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 12:00:13 PST 2024
================
@@ -15208,11 +15212,8 @@ const SCEV *ScalarEvolution::applyLoopGuards(const SCEV *Expr, const Loop *L) {
auto *MulRHS = Mul->getOperand(1);
if (isa<SCEVConstant>(MulLHS))
std::swap(MulLHS, MulRHS);
- if (auto *Div = dyn_cast<SCEVUDivExpr>(MulLHS))
- if (Div->getOperand(1) == MulRHS) {
- DividesBy = MulRHS;
- return true;
- }
----------------
nikic wrote:
Right. I'm arguing that this is not correct. `X * constant` is not necessarily divisible by constant. This is only true if the multiplication has the nuw flag, or constant is a power of two.
https://github.com/llvm/llvm-project/pull/83428
More information about the llvm-commits
mailing list