[polly] r235822 - Use the original no-wrap flags for normalized AddRecs
Johannes Doerfert
doerfert at cs.uni-saarland.de
Sun Apr 26 12:55:21 PDT 2015
Author: jdoerfert
Date: Sun Apr 26 14:55:21 2015
New Revision: 235822
URL: http://llvm.org/viewvc/llvm-project?rev=235822&view=rev
Log:
Use the original no-wrap flags for normalized AddRecs
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Support/SCEVValidator.cpp
polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=235822&r1=235821&r2=235822&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Apr 26 14:55:21 2015
@@ -214,6 +214,8 @@ __isl_give isl_pw_aff *
SCEVAffinator::visitAddRecExpr(const SCEVAddRecExpr *Expr) {
assert(Expr->isAffine() && "Only affine AddRecurrences allowed");
+ auto Flags = Expr->getNoWrapFlags();
+
// Directly generate isl_pw_aff for Expr if 'start' is zero.
if (Expr->getStart()->isZero()) {
assert(S->getRegion().contains(Expr->getLoop()) &&
@@ -236,10 +238,13 @@ SCEVAffinator::visitAddRecExpr(const SCE
// Translate AddRecExpr from '{start, +, inc}' into 'start + {0, +, inc}'
// if 'start' is not zero.
+ // TODO: Using the original SCEV no-wrap flags is not always safe, however
+ // as our code generation is reordering the expression anyway it doesn't
+ // really matter.
ScalarEvolution &SE = *S->getSE();
- const SCEV *ZeroStartExpr = SE.getAddRecExpr(
- SE.getConstant(Expr->getStart()->getType(), 0),
- Expr->getStepRecurrence(SE), Expr->getLoop(), SCEV::FlagAnyWrap);
+ const SCEV *ZeroStartExpr =
+ SE.getAddRecExpr(SE.getConstant(Expr->getStart()->getType(), 0),
+ Expr->getStepRecurrence(SE), Expr->getLoop(), Flags);
isl_pw_aff *ZeroStartResult = visit(ZeroStartExpr);
isl_pw_aff *Start = visit(Expr->getStart());
Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=235822&r1=235821&r2=235822&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Sun Apr 26 14:55:21 2015
@@ -287,7 +287,7 @@ public:
// if 'start' is not zero.
const SCEV *ZeroStartExpr = SE.getAddRecExpr(
SE.getConstant(Expr->getStart()->getType(), 0),
- Expr->getStepRecurrence(SE), Expr->getLoop(), SCEV::FlagAnyWrap);
+ Expr->getStepRecurrence(SE), Expr->getLoop(), Expr->getNoWrapFlags());
ValidatorResult ZeroStartResult =
ValidatorResult(SCEVType::PARAM, ZeroStartExpr);
Modified: polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll?rev=235822&r1=235821&r2=235822&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll Sun Apr 26 14:55:21 2015
@@ -11,7 +11,7 @@
; INNERMOST: Function: f
; INNERMOST: Region: %bb15---%bb26
; INNERMOST: Max Loop Depth: 1
-; INNERMOST: p0: {0,+,{0,+,-1}<nw><%bb11>}<%bb13>
+; INNERMOST: p0: {0,+,{0,+,-1}<nw><%bb11>}<nw><%bb13>
; INNERMOST: p1: {0,+,{0,+,1}<nuw><nsw><%bb11>}<nuw><nsw><%bb13>
; INNERMOST: p2: {0,+,4}<nuw><nsw><%bb11>
; INNERMOST: p3: {0,+,4}<nuw><nsw><%bb13>
More information about the llvm-commits
mailing list