diff options
author | Hongbin Zheng <etherzhhb@gmail.com> | 2012-04-04 13:24:40 +0000 |
---|---|---|
committer | Hongbin Zheng <etherzhhb@gmail.com> | 2012-04-04 13:24:40 +0000 |
commit | 99c8a5a64a17b880274bf1366d20049694c88f15 (patch) | |
tree | 2ad30a798f320b7db60d51a071269d0c76a31d13 | |
parent | 26c8dcc692fb2addd475446cfff24d6a4e958bca (diff) | |
download | external_llvm-99c8a5a64a17b880274bf1366d20049694c88f15.zip external_llvm-99c8a5a64a17b880274bf1366d20049694c88f15.tar.gz external_llvm-99c8a5a64a17b880274bf1366d20049694c88f15.tar.bz2 |
Add testcase for r154007, when a function has the optsize attribute,
the loop should be unrolled according the value of OptSizeUnrollThreshold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154014 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/LoopUnroll/partial-unroll-optsize.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Transforms/LoopUnroll/partial-unroll-optsize.ll b/test/Transforms/LoopUnroll/partial-unroll-optsize.ll new file mode 100644 index 0000000..3179d55 --- /dev/null +++ b/test/Transforms/LoopUnroll/partial-unroll-optsize.ll @@ -0,0 +1,35 @@ +; RUN: opt < %s -S -loop-unroll -unroll-allow-partial | FileCheck %s +; Loop size = 3, when the function has the optsize attribute, the +; OptSizeUnrollThreshold, i.e. 50, is used, hence the loop should be unrolled +; by 16 times because 3 * 16 < 50. +define void @unroll_opt_for_size() nounwind optsize { +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: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: add +; CHECK-NEXT: icmp |