[PATCH] D109786: [SCEV] (udiv X, Y) * Y is always NUW
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 14 14:10:10 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:2403
+ Ops.size() == 2) {
+ auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[0]);
+ if (UDiv && UDiv->getNumOperands() == 2 && UDiv->getOperand(1) == Ops[1])
----------------
I think this only covers a subset of cases because it assumes the udiv is the first operand. Due to complexity sorting, this is a given for the case where `Y` is SCEVUnknown, but wouldn't we want this to trigger also for something like `3 * (udiv X, 3)`?
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:2404
+ auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[0]);
+ if (UDiv && UDiv->getNumOperands() == 2 && UDiv->getOperand(1) == Ops[1])
+ Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNUW);
----------------
I believe UDiv always has two operands, multi operand udiv isn't well-defined...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109786/new/
https://reviews.llvm.org/D109786
More information about the llvm-commits
mailing list