[PATCH] Make ScalarEvolution less aggressive with respect to no-wrap flags.
David Majnemer
david.majnemer at gmail.com
Wed Jan 21 01:42:05 PST 2015
LGTM
================
Comment at: lib/Analysis/ScalarEvolution.cpp:3149-3160
@@ -3148,13 +3148,14 @@
/// getMinusSCEV - Return LHS-RHS. Minus is represented in SCEV as A+B*-1.
const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS, const SCEV *RHS,
SCEV::NoWrapFlags Flags) {
assert(!maskFlags(Flags, SCEV::FlagNUW) && "subtraction does not have NUW");
// Fast path: X - X --> 0.
if (LHS == RHS)
return getConstant(LHS->getType(), 0);
- // X - Y --> X + -Y
- return getAddExpr(LHS, getNegativeSCEV(RHS), Flags);
+ // X - Y --> X + -Y.
+ // X -(nsw || nuw) Y --> X + -Y.
+ return getAddExpr(LHS, getNegativeSCEV(RHS));
}
----------------
`Flags` doesn't seem very useful now, perhaps it should be removed?
http://reviews.llvm.org/D7081
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list