1; RUN: opt < %s -S -loop-unroll -unroll-allow-partial -unroll-max-count=1 | FileCheck %s 2; Checks that unroll MaxCount is honored. 3; 4; CHECK-LABEL: @foo( 5; CHECK-LABEL: for.body: 6; CHECK-NEXT: phi 7; CHECK-NEXT: getelementptr 8; CHECK-NEXT: load 9; CHECK-NEXT: add 10; CHECK-NEXT: store 11; CHECK-NEXT: add 12; CHECK-NEXT: icmp 13; CHECK-NEXT: br 14define void @foo(i32* nocapture %a) { 15entry: 16 br label %for.body 17 18for.body: ; preds = %for.body, %entry 19 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 20 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv 21 %0 = load i32, i32* %arrayidx, align 4 22 %inc = add nsw i32 %0, 1 23 store i32 %inc, i32* %arrayidx, align 4 24 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 25 %exitcond = icmp eq i64 %indvars.iv.next, 1024 26 br i1 %exitcond, label %for.end, label %for.body 27 28for.end: ; preds = %for.body 29 ret void 30} 31 32