xref: /aosp_15_r20/external/llvm/test/Transforms/LoopUnroll/unroll-count.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: opt < %s -S -loop-unroll -unroll-count=2 | FileCheck %s
2; Checks that "llvm.loop.unroll.disable" is set when
3; unroll with count set by user has been applied.
4;
5; CHECK-LABEL: @foo(
6; CHECK: llvm.loop.unroll.disable
7
8define void @foo(i32* nocapture %a) {
9entry:
10  br label %for.body
11
12for.body:                                         ; preds = %for.body, %entry
13  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
14  %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
15  %0 = load i32, i32* %arrayidx, align 4
16  %inc = add nsw i32 %0, 1
17  store i32 %inc, i32* %arrayidx, align 4
18  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
19  %exitcond = icmp eq i64 %indvars.iv.next, 64
20  br i1 %exitcond, label %for.end, label %for.body
21
22for.end:                                          ; preds = %for.body
23  ret void
24}
25
26