[PATCH] D144947: [SCEV] Preserve divisibility and min/max information in applyLoopGuards
Alon Kom via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 5 01:51:49 PST 2023
alonkom added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15023
+ }
+ return false;
+ }
----------------
mkazantsev wrote:
> this return isn't needed
Done
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15032
+ APInt &ExprVal, APInt &DivisorVal) {
+ if (!isKnownNonNegative(Expr) || !isKnownPositive(Divisor))
+ return false;
----------------
mkazantsev wrote:
> If they are both constants, it's cheaper to make this check after the constant check below with their values via `getAPInt`.
Done
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15151
+ std::swap(MulLHS, MulRHS);
+ if (auto *Div = dyn_cast<SCEVUDivExpr>(MulLHS)) {
+ if (Div->getOperand(1) == MulRHS) {
----------------
mkazantsev wrote:
> `{ }` not needed.
Done
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15158
+ }
+ if (auto *MinMax = dyn_cast<SCEVMinMaxExpr>(Expr)) {
+ return HasDivisibiltyInfo(MinMax->getOperand(0), DividesBy) ||
----------------
mkazantsev wrote:
> `{ }` not needed.
Done
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15170
+ return true;
+ if (auto *MinMax = dyn_cast<SCEVMinMaxExpr>(Expr)) {
+ return IsKnownToDivideBy(MinMax->getOperand(0), DividesBy) &&
----------------
mkazantsev wrote:
> `{ }` not needed.
Done
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144947/new/
https://reviews.llvm.org/D144947
More information about the llvm-commits
mailing list