1 ; RUN: opt < %s -S -passes="default<O2>" -unroll-runtime=true -enable-unroll-and-jam -unroll-threshold-default=0 -unroll-threshold-aggressive=300 | FileCheck %s -check-prefix=O2
2 ; RUN: opt < %s -S -passes="default<O3>" -unroll-runtime=true -enable-unroll-and-jam -unroll-threshold-default=0 -unroll-threshold-aggressive=300 | FileCheck %s -check-prefix=O3
3 ; RUN: opt < %s -S -passes="default<Os>" -unroll-runtime=true -enable-unroll-and-jam -unroll-threshold-default=0 -unroll-threshold-aggressive=300 | FileCheck %s -check-prefix=Os
4 ; RUN: opt < %s -S -passes="default<Oz>" -unroll-runtime=true -enable-unroll-and-jam -unroll-threshold-default=0 -unroll-threshold-aggressive=300 | FileCheck %s -check-prefix=Oz
6 ; Check that Os and Oz are optimized like O2, not like O3. To easily highlight
7 ; the behavior, we artificially disable unrolling for anything but O3 by setting
8 ; the default threshold to 0.
15 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
17 define void @test1(i32 %I, i32 %J, ptr noalias nocapture %A, ptr noalias nocapture readonly %B) #0 {
19 %cmp = icmp ne i32 %J, 0
20 %cmpJ = icmp ne i32 %I, 0
21 %or.cond = and i1 %cmp, %cmpJ
22 br i1 %or.cond, label %for.outer.preheader, label %for.end
28 %i = phi i32 [ %add8, %for.latch ], [ 0, %for.outer.preheader ]
32 %j = phi i32 [ 0, %for.outer ], [ %inc, %for.inner ]
33 %sum = phi i32 [ 0, %for.outer ], [ %add, %for.inner ]
34 %arrayidx = getelementptr inbounds i32, ptr %B, i32 %j
35 %0 = load i32, ptr %arrayidx, align 4, !tbaa !5
36 %add = add i32 %0, %sum
37 %inc = add nuw i32 %j, 1
38 %exitcond = icmp eq i32 %inc, %J
39 br i1 %exitcond, label %for.latch, label %for.inner
42 %add.lcssa = phi i32 [ %add, %for.inner ]
43 %arrayidx6 = getelementptr inbounds i32, ptr %A, i32 %i
44 store i32 %add.lcssa, ptr %arrayidx6, align 4, !tbaa !5
45 %add8 = add nuw i32 %i, 1
46 %exitcond25 = icmp eq i32 %add8, %I
47 br i1 %exitcond25, label %for.end.loopexit, label %for.outer
59 !6 = !{!"int", !7, i64 0}
60 !7 = !{!"omnipotent char", !8, i64 0}
61 !8 = !{!"Simple C/C++ TBAA"}