summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-05-10 21:45:55 +0000
committerHans Wennborg <hans@hanshq.net>2016-05-10 21:45:55 +0000
commit719b26ba54bbbed99249863a6800d61778962429 (patch)
tree7440071a6e0c617b9ddb2272b814789bdedce435 /llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
parent12de4aeeb304cb497557a2c1a544382de26031e6 (diff)
downloadbcm5719-llvm-719b26ba54bbbed99249863a6800d61778962429.tar.gz
bcm5719-llvm-719b26ba54bbbed99249863a6800d61778962429.zip
Loop unroller: set thresholds for optsize and minsize functions to zero
Before r268509, Clang would disable the loop unroll pass when optimizing for size. That commit enabled it to be able to support unroll pragmas in -Os builds. However, this regressed binary size in one of Chromium's DLLs with ~100 KB. This restores the original behaviour of no unrolling at -Os, but doing it in LLVM instead of Clang makes more sense, and also allows the pragmas to keep working. Differential revision: http://reviews.llvm.org/D20115 llvm-svn: 269124
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll')
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll56
1 files changed, 13 insertions, 43 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll b/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
index 334162f5605..f4a76c71368 100644
--- a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
+++ b/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
@@ -4,10 +4,10 @@
;///////////////////// TEST 1 //////////////////////////////
-; This test shows that with optsize attribute, the loop is unrolled
-; according to the specified unroll factor.
+; This test shows that the loop is unrolled according to the specified
+; unroll factor.
-define void @Test1() nounwind optsize {
+define void @Test1() nounwind {
entry:
br label %loop
@@ -32,38 +32,10 @@ exit:
;///////////////////// TEST 2 //////////////////////////////
-; This test shows that with minsize attribute, the loop is unrolled
-; according to the specified unroll factor.
-
-define void @Test2() nounwind minsize {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; CHECK_COUNT4-LABEL: @Test2
-; CHECK_COUNT4: phi
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: icmp
-
-
-;///////////////////// TEST 3 //////////////////////////////
-
; This test shows that with optnone attribute, the loop is not unrolled
; even if an unroll factor was specified.
-define void @Test3() nounwind optnone noinline {
+define void @Test2() nounwind optnone noinline {
entry:
br label %loop
@@ -77,20 +49,19 @@ exit:
ret void
}
-; CHECK_COUNT4-LABEL: @Test3
+; CHECK_COUNT4-LABEL: @Test2
; CHECK_COUNT4: phi
; CHECK_COUNT4-NEXT: add
; CHECK_COUNT4-NEXT: icmp
-;///////////////////// TEST 4 //////////////////////////////
+;///////////////////// TEST 3 //////////////////////////////
-; This test shows that without any attribute, this loop is fully unrolled
-; by default.
+; This test shows that this loop is fully unrolled by default.
@tab = common global [24 x i32] zeroinitializer, align 4
-define i32 @Test4() {
+define i32 @Test3() {
entry:
br label %for.body
@@ -106,7 +77,7 @@ for.end: ; preds = %for.body
ret i32 42
}
-; CHECK_NOCOUNT-LABEL: @Test4
+; CHECK_NOCOUNT-LABEL: @Test3
; CHECK_NOCOUNT: store
; CHECK_NOCOUNT-NEXT: store
; CHECK_NOCOUNT-NEXT: store
@@ -134,12 +105,11 @@ for.end: ; preds = %for.body
; CHECK_NOCOUNT-NEXT: ret
-;///////////////////// TEST 5 //////////////////////////////
+;///////////////////// TEST 4 //////////////////////////////
-; This test shows that with optsize attribute, this loop is not unrolled
-; by default.
+; This test shows that with optsize attribute, this loop is not unrolled.
-define i32 @Test5() optsize {
+define i32 @Test4() optsize {
entry:
br label %for.body
@@ -155,6 +125,6 @@ for.end: ; preds = %for.body
ret i32 42
}
-; CHECK_NOCOUNT-LABEL: @Test5
+; CHECK_NOCOUNT-LABEL: @Test4
; CHECK_NOCOUNT: phi
; CHECK_NOCOUNT: icmp
OpenPOWER on IntegriCloud