From b2840fdcd8a98de32e86e70a267b54cf0af35140 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 6 Sep 2011 02:43:13 +0000 Subject: [PATCH] Revert r139126 due to selfhost failures reported by buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139130 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScalarEvolution.cpp | 8 ++--- .../ScalarEvolution/max-trip-count.ll | 31 ------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index a2cd38b4bf5..8859c3b22fb 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -5184,12 +5184,8 @@ ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) { // Handle unitary steps, which cannot wraparound. // 1*N = -Start; -1*N = Start (mod 2^BW), so: // N = Distance (as unsigned) - if (StepC->getValue()->equalsInt(1) || StepC->getValue()->isAllOnesValue()) { - ConstantRange CR = getUnsignedRange(Start); - const SCEV *MaxBECount = getConstant(CountDown ? CR.getUnsignedMax() - : ~CR.getUnsignedMin()); - return ExitLimit(Distance, MaxBECount); - } + if (StepC->getValue()->equalsInt(1) || StepC->getValue()->isAllOnesValue()) + return Distance; // If the recurrence is known not to wraparound, unsigned divide computes the // back edge count. We know that the value will either become zero (and thus diff --git a/test/Analysis/ScalarEvolution/max-trip-count.ll b/test/Analysis/ScalarEvolution/max-trip-count.ll index 596423a4cdc..843fb073087 100644 --- a/test/Analysis/ScalarEvolution/max-trip-count.ll +++ b/test/Analysis/ScalarEvolution/max-trip-count.ll @@ -70,34 +70,3 @@ for.end: ; preds = %for.body, %for.cond } declare i32 @printf(i8*, ...) - -; Before -indvars ran on this loop, SCEV solved a max loop trip count of -; 2^31-2. Afterwards, we can only solve 2^32-1. - -define void @test(i8* %a, i32 %n) nounwind { -entry: - %cmp1 = icmp sgt i32 %n, 0 - br i1 %cmp1, label %for.body.lr.ph, label %for.end - -for.body.lr.ph: ; preds = %entry - %tmp = zext i32 %n to i64 - br label %for.body - -for.body: ; preds = %for.body, %for.body.lr.ph - %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %for.body.lr.ph ] - %arrayidx = getelementptr i8* %a, i64 %indvar - store i8 0, i8* %arrayidx, align 1 - %indvar.next = add i64 %indvar, 1 - %exitcond = icmp ne i64 %indvar.next, %tmp - br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge - -for.cond.for.end_crit_edge: ; preds = %for.body - br label %for.end - -for.end: ; preds = %for.cond.for.end_crit_edge, %entry - ret void -} - -; CHECK: Determining loop execution counts for: @test -; CHECK-NEXT: backedge-taken count is -; CHECK-NEXT: max backedge-taken count is -1