[PATCH] D144947: [SCEV] Preserve divisibility and min/max information in applyLoopGuards
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 3 02:12:05 PST 2023
mkazantsev added reviewers: fhahn, nikic, lebedev.ri, reames.
mkazantsev added a comment.
Generally looks fine, but let this chill for couple of days in case if the other reviewers have objections.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15023
+ }
+ return false;
+ }
----------------
this return isn't needed
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15032
+ APInt &ExprVal, APInt &DivisorVal) {
+ if (!isKnownNonNegative(Expr) || !isKnownPositive(Divisor))
+ return false;
----------------
If they are both constants, it's cheaper to make this check after the constant check below with their values via `getAPInt`.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15151
+ std::swap(MulLHS, MulRHS);
+ if (auto *Div = dyn_cast<SCEVUDivExpr>(MulLHS)) {
+ if (Div->getOperand(1) == MulRHS) {
----------------
`{ }` not needed.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15158
+ }
+ if (auto *MinMax = dyn_cast<SCEVMinMaxExpr>(Expr)) {
+ return HasDivisibiltyInfo(MinMax->getOperand(0), DividesBy) ||
----------------
`{ }` not needed.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15170
+ return true;
+ if (auto *MinMax = dyn_cast<SCEVMinMaxExpr>(Expr)) {
+ return IsKnownToDivideBy(MinMax->getOperand(0), DividesBy) &&
----------------
`{ }` not needed.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144947/new/
https://reviews.llvm.org/D144947
More information about the llvm-commits
mailing list