[llvm-commits] [llvm] r60951 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
Nick Lewycky
nicholas at mxc.ca
Fri Dec 12 09:09:09 PST 2008
Author: nicholas
Date: Fri Dec 12 11:09:07 2008
New Revision: 60951
URL: http://llvm.org/viewvc/llvm-project?rev=60951&view=rev
Log:
Revert my re-instated reverted commit, fixes the bootstrap build on x86-64 linux.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
llvm/trunk/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=60951&r1=60950&r2=60951&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Dec 12 11:09:07 2008
@@ -2924,12 +2924,8 @@
if (!R)
return true;
- if (isSigned) {
- if (SC->getValue()->isOne())
- return R->getValue()->isMaxValue(true);
-
+ if (isSigned)
return true; // XXX: because we don't have an sdiv scev.
- }
// If negative, it wraps around every iteration, but we don't care about that.
APInt S = SC->getValue()->getValue().abs();
@@ -2975,6 +2971,14 @@
// run (m-n)/s times.
SCEVHandle End = RHS;
+ if (!executesAtLeastOnce(L, isSigned, trueWhenEqual,
+ SE.getMinusSCEV(Start, One), RHS)) {
+ // If not, we get the value of the LHS in the first iteration in which
+ // the above condition doesn't hold. This equals to max(m,n).
+ End = isSigned ? SE.getSMaxExpr(RHS, Start)
+ : SE.getUMaxExpr(RHS, Start);
+ }
+
// If the expression is less-than-or-equal to, we need to extend the
// loop by one iteration.
//
@@ -2983,16 +2987,12 @@
// division would equal one, but the loop runs twice putting the
// induction variable at 12.
- if (trueWhenEqual)
- End = SE.getAddExpr(End, One);
-
- if (!executesAtLeastOnce(L, isSigned, trueWhenEqual,
- SE.getMinusSCEV(Start, One), RHS)) {
- // If not, we get the value of the LHS in the first iteration in which
- // the above condition doesn't hold. This equals to max(m,n).
- End = isSigned ? SE.getSMaxExpr(End, Start)
- : SE.getUMaxExpr(End, Start);
- }
+ if (!trueWhenEqual)
+ // (Stride - 1) is correct only because we know it's unsigned.
+ // What we really want is to decrease the magnitude of Stride by one.
+ Start = SE.getMinusSCEV(Start, SE.getMinusSCEV(Stride, One));
+ else
+ Start = SE.getMinusSCEV(Start, Stride);
// Finally, we subtract these two values to get the number of times the
// backedge is executed: max(m,n)-n.
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll?rev=60951&r1=60950&r2=60951&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll Fri Dec 12 11:09:07 2008
@@ -1,4 +1,5 @@
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {255 iterations}
+; XFAIL: *
define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind {
bb1.thread:
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll?rev=60951&r1=60950&r2=60951&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll Fri Dec 12 11:09:07 2008
@@ -1,4 +1,5 @@
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {0 smax}
+; XFAIL: *
define i32 @f(i32 %c.idx.val) {
More information about the llvm-commits
mailing list