1 ; RUN: opt < %s -S -passes=loop-unroll -unroll-allow-partial -unroll-max-count=1 | FileCheck %s
2 ; Checks that unroll MaxCount is honored.
5 ; CHECK-LABEL: for.body:
7 ; CHECK-NEXT: getelementptr
14 define void @foo(ptr nocapture %a) {
18 for.body: ; preds = %for.body, %entry
19 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
20 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
21 %0 = load i32, ptr %arrayidx, align 4
22 %inc = add nsw i32 %0, 1
23 store i32 %inc, ptr %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
28 for.end: ; preds = %for.body