1 ; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll | FileCheck %s
2 define void @unroll_opt_for_size() nounwind optsize {
7 %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
9 %exitcnd = icmp uge i32 %inc, 1024
10 br i1 %exitcnd, label %exit, label %loop
16 ; CHECK-LABEL: @unroll_opt_for_size
22 define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
24 %cmp1 = icmp eq i32 %n, 0
25 br i1 %cmp1, label %for.end, label %for.body
27 for.body: ; preds = %for.body, %entry
28 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
29 %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
30 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
31 %0 = load i32* %arrayidx, align 4
32 %add = add nsw i32 %0, %sum.02
33 %indvars.iv.next = add i64 %indvars.iv, 1
34 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
35 %exitcond = icmp eq i32 %lftr.wideiv, %n
36 br i1 %exitcond, label %for.end, label %for.body
38 for.end: ; preds = %for.body, %entry
39 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
44 ; CHECK: for.body.prol{{.*}}:
46 ; CHECK: br i1 %exitcond.7, label %for.end.loopexit{{.*}}, label %for.body