1; Default behavior
2; RUN: opt < %s -passes='loop-unroll' -S | FileCheck %s -check-prefixes=ENABLE,COMMON
3
4; Pass option
5; RUN: opt < %s -passes='loop-unroll<full-unroll-max=0>'  -S | FileCheck %s -check-prefixes=DISABLE,COMMON
6; RUN: opt < %s -passes='loop-unroll<full-unroll-max=30>' -S | FileCheck %s -check-prefixes=DISABLE,COMMON
7; RUN: opt < %s -passes='loop-unroll<full-unroll-max=36>' -S | FileCheck %s -check-prefixes=ENABLE,COMMON
8
9; cl::opt option
10; RUN: opt < %s -passes='loop-unroll' -unroll-full-max-count=0 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
11; RUN: opt < %s -passes='loop-unroll' -unroll-full-max-count=30 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
12; RUN: opt < %s -passes='loop-unroll' -unroll-full-max-count=36 -S | FileCheck %s -check-prefixes=ENABLE,COMMON
13
14; Pass option has a priority over cl::opt
15; RUN: opt < %s -passes='loop-unroll<full-unroll-max=30>' -unroll-full-max-count=36 -S | FileCheck %s -check-prefixes=DISABLE,COMMON
16; RUN: opt < %s -passes='loop-unroll<full-unroll-max=36>' -unroll-full-max-count=30 -S | FileCheck %s -check-prefixes=ENABLE,COMMON
17
18define void @test() {
19; COMMON-LABEL: @test(
20 entry:
21  br label %loop
22
23 loop:
24  %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
25  %idx.inc = add i32 %idx, 1
26  %be = icmp slt i32 %idx, 32
27  br i1 %be, label %loop, label %exit
28
29; COMMON: loop:
30; DISABLE:  %be = icmp slt i32 %idx, 32
31; ENABLE-NOT:  %be = icmp slt i32 %idx, 32
32
33 exit:
34  ret void
35}
36