[llvm-commits] [llvm] r113528 - in /llvm/trunk: lib/Transforms/Scalar/LoopUnrollPass.cpp test/Transforms/LoopUnroll/call.ll
Owen Anderson
resistor at mac.com
Thu Sep 9 13:02:23 PDT 2010
Author: resistor
Date: Thu Sep 9 15:02:23 2010
New Revision: 113528
URL: http://llvm.org/viewvc/llvm-project?rev=113528&view=rev
Log:
Revert r113439, which relaxed the requirement that loops containing calls cannot be unrolled. After some discussion,
there seems to be a better way to achieve the same effect.
Removed:
llvm/trunk/test/Transforms/LoopUnroll/call.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=113528&r1=113527&r2=113528&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Sep 9 15:02:23 2010
@@ -155,10 +155,8 @@
unsigned LoopSize = ApproximateLoopSize(L, NumCalls);
DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n");
if (NumCalls != 0) {
- // Even for a loop that contains calls, it can still be profitable to
- // unroll if the loop is really, REALLY small.
- DEBUG(dbgs() <<" Using lower threshold for loop with function calls.\n");
- CurrentThreshold = OptSizeUnrollThreshold;
+ DEBUG(dbgs() << " Not unrolling loop with function calls.\n");
+ return false;
}
uint64_t Size = (uint64_t)LoopSize*Count;
if (TripCount != 1 && Size > CurrentThreshold) {
Removed: llvm/trunk/test/Transforms/LoopUnroll/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/call.ll?rev=113527&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopUnroll/call.ll (original)
+++ llvm/trunk/test/Transforms/LoopUnroll/call.ll (removed)
@@ -1,51 +0,0 @@
-; RUN: opt < %s -S -loop-unroll | FileCheck %s
-
- at id = internal global i32 0
- at val = internal global [4 x i32] zeroinitializer, align 16
-
-; CHECK: @test
-define i32 @test(i32 %k) nounwind ssp {
-; CHECK-NOT: call i32 @test(i32 %t.06)
-; CHECK: call i32 @test(i32 0)
-; CHECK-NOT: call i32 @test(i32 %t.06)
-; CHECK: call i32 @test(i32 1)
-; CHECK-NOT: call i32 @test(i32 %t.06)
-; CHECK: call i32 @test(i32 2)
-; CHECK-NOT: call i32 @test(i32 %t.06)
-; CHECK: call i32 @test(i32 3)
-; CHECK-NOT: call i32 @test(i32 %t.06)
-
-bb.nph:
- %0 = load i32* @id, align 4
- %1 = add nsw i32 %0, 1
- store i32 %1, i32* @id, align 4
- %2 = sext i32 %k to i64
- %3 = getelementptr inbounds [4 x i32]* @val, i64 0, i64 %2
- store i32 %1, i32* %3, align 4
- br label %bb
-
-bb: ; preds = %bb2, %bb.nph
- %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb2 ]
- %scevgep = getelementptr [4 x i32]* @val, i64 0, i64 %indvar
- %4 = load i32* %scevgep, align 4
- %5 = icmp eq i32 %4, 0
- br i1 %5, label %bb1, label %bb2
-
-bb1: ; preds = %bb
- %t.06 = trunc i64 %indvar to i32
- %6 = tail call i32 @test(i32 %t.06) nounwind
- br label %bb2
-
-bb2: ; preds = %bb1, %bb
- %indvar.next = add i64 %indvar, 1
- %exitcond = icmp eq i64 %indvar.next, 4
- br i1 %exitcond, label %bb4, label %bb
-
-bb4: ; preds = %bb2
- %.pre = load i32* @id, align 4
- %7 = add nsw i32 %.pre, -1
- store i32 %7, i32* @id, align 4
- store i32 0, i32* %3, align 4
- ret i32 undef
-; CHECK: }
-}
More information about the llvm-commits
mailing list