mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-25 13:08:00 +00:00
Revert my re-instated reverted commit, fixes the bootstrap build on x86-64 linux.
llvm-svn: 60951
This commit is contained in:
parent
06ecf57a87
commit
51228d6707
@ -2924,12 +2924,8 @@ bool ScalarEvolutionsImpl::potentialInfiniteLoop(SCEV *Stride, SCEV *RHS,
|
|||||||
if (!R)
|
if (!R)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (isSigned) {
|
if (isSigned)
|
||||||
if (SC->getValue()->isOne())
|
|
||||||
return R->getValue()->isMaxValue(true);
|
|
||||||
|
|
||||||
return true; // XXX: because we don't have an sdiv scev.
|
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.
|
// If negative, it wraps around every iteration, but we don't care about that.
|
||||||
APInt S = SC->getValue()->getValue().abs();
|
APInt S = SC->getValue()->getValue().abs();
|
||||||
@ -2975,6 +2971,14 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L,
|
|||||||
// run (m-n)/s times.
|
// run (m-n)/s times.
|
||||||
SCEVHandle End = RHS;
|
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
|
// If the expression is less-than-or-equal to, we need to extend the
|
||||||
// loop by one iteration.
|
// loop by one iteration.
|
||||||
//
|
//
|
||||||
@ -2983,16 +2987,12 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L,
|
|||||||
// division would equal one, but the loop runs twice putting the
|
// division would equal one, but the loop runs twice putting the
|
||||||
// induction variable at 12.
|
// induction variable at 12.
|
||||||
|
|
||||||
if (trueWhenEqual)
|
if (!trueWhenEqual)
|
||||||
End = SE.getAddExpr(End, One);
|
// (Stride - 1) is correct only because we know it's unsigned.
|
||||||
|
// What we really want is to decrease the magnitude of Stride by one.
|
||||||
if (!executesAtLeastOnce(L, isSigned, trueWhenEqual,
|
Start = SE.getMinusSCEV(Start, SE.getMinusSCEV(Stride, One));
|
||||||
SE.getMinusSCEV(Start, One), RHS)) {
|
else
|
||||||
// If not, we get the value of the LHS in the first iteration in which
|
Start = SE.getMinusSCEV(Start, Stride);
|
||||||
// the above condition doesn't hold. This equals to max(m,n).
|
|
||||||
End = isSigned ? SE.getSMaxExpr(End, Start)
|
|
||||||
: SE.getUMaxExpr(End, Start);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, we subtract these two values to get the number of times the
|
// Finally, we subtract these two values to get the number of times the
|
||||||
// backedge is executed: max(m,n)-n.
|
// backedge is executed: max(m,n)-n.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {255 iterations}
|
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {255 iterations}
|
||||||
|
; XFAIL: *
|
||||||
|
|
||||||
define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind {
|
define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind {
|
||||||
bb1.thread:
|
bb1.thread:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {0 smax}
|
; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {0 smax}
|
||||||
|
; XFAIL: *
|
||||||
|
|
||||||
define i32 @f(i32 %c.idx.val) {
|
define i32 @f(i32 %c.idx.val) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user