summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopUnroll
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2019-09-19 06:57:29 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2019-09-19 06:57:29 +0000
commita44768858c75ae3e020bb2951af00743ae48742e (patch)
tree5f934af7543697cf3860211658ccc3ee70f067c4 /llvm/test/Transforms/LoopUnroll
parentc2d25ed1b36d1c9cd02421b09635c1ee55b8099d (diff)
downloadbcm5719-llvm-a44768858c75ae3e020bb2951af00743ae48742e.tar.gz
bcm5719-llvm-a44768858c75ae3e020bb2951af00743ae48742e.zip
[Unroll] Add an option to control complete unrolling
Add an ability to specify the max full unroll count for LoopUnrollPass pass in pass options. Reviewers: fhahn, fedor.sergeev Reviewed By: fedor.sergeev Subscribers: hiraditya, zzheng, dmgreen, llvm-commits Differential Revision: https://reviews.llvm.org/D67701 llvm-svn: 372305
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll')
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable-full-unroll-by-opt.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/disable-full-unroll-by-opt.ll b/llvm/test/Transforms/LoopUnroll/disable-full-unroll-by-opt.ll
new file mode 100644
index 00000000000..c89948ad52c
--- /dev/null
+++ b/llvm/test/Transforms/LoopUnroll/disable-full-unroll-by-opt.ll
@@ -0,0 +1,35 @@
+; Default behavior
+; RUN: opt < %s -passes='unroll' -S | FileCheck %s -check-prefixes=ENABLE,COMMON
+
+; Pass option
+; RUN: opt < %s -passes='unroll<full-unroll-max=0>' -S | FileCheck %s -check-prefixes=DISABLE,COMMON
+; RUN: opt < %s -passes='unroll<full-unroll-max=30>' -S | FileCheck %s -check-prefixes=DISABLE,COMMON
+; RUN: opt < %s -passes='unroll<full-unroll-max=36>' -S | FileCheck %s -check-prefixes=ENABLE,COMMON
+
+; cl::opt option
+; RUN: opt < %s -passes='unroll' -unroll-full-max-count=0 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
+; RUN: opt < %s -passes='unroll' -unroll-full-max-count=30 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
+; RUN: opt < %s -passes='unroll' -unroll-full-max-count=36 -S | FileCheck %s -check-prefixes=ENABLE,COMMON
+
+; Pass option has a priority over cl::opt
+; RUN: opt < %s -passes='unroll<full-unroll-max=30>' -unroll-full-max-count=36 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
+; RUN: opt < %s -passes='unroll<full-unroll-max=36>' -unroll-full-max-count=30 -S | FileCheck %s -check-prefixes=ENABLE,COMMON
+
+define void @test() {
+; COMMON-LABEL: @test(
+ entry:
+ br label %loop
+
+ loop:
+ %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
+ %idx.inc = add i32 %idx, 1
+ %be = icmp slt i32 %idx, 32
+ br i1 %be, label %loop, label %exit
+
+; COMMON: loop:
+; DISABLE: %be = icmp slt i32 %idx, 32
+; ENABLE-NOT: %be = icmp slt i32 %idx, 32
+
+ exit:
+ ret void
+}
OpenPOWER on IntegriCloud