1; RUN: opt -loop-unroll-and-jam -allow-unroll-and-jam -S < %s | FileCheck %s
2;
3; Verify that the llvm.loop.unroll_and_jam.count loop property overrides
4; llvm.loop.disable_nonforced.
5;
6target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
7
8; CHECK-LABEL: @disable_nonforced_enable(
9; CHECK: load
10; CHECK: load
11; CHECK-NOT: load
12; CHECK: br i1
13define void @disable_nonforced_enable(i32 %I, i32 %J, i32* noalias nocapture %A, i32* noalias nocapture readonly %B) {
14entry:
15  %cmp = icmp ne i32 %J, 0
16  %cmp122 = icmp ne i32 %I, 0
17  %or.cond = and i1 %cmp, %cmp122
18  br i1 %or.cond, label %for.outer.preheader, label %for.end
19
20for.outer.preheader:
21  br label %for.outer
22
23for.outer:
24  %i.us = phi i32 [ %add8.us, %for.latch ], [ 0, %for.outer.preheader ]
25  br label %for.inner
26
27for.inner:
28  %j.us = phi i32 [ 0, %for.outer ], [ %inc.us, %for.inner ]
29  %sum1.us = phi i32 [ 0, %for.outer ], [ %add.us, %for.inner ]
30  %arrayidx.us = getelementptr inbounds i32, i32* %B, i32 %j.us
31  %0 = load i32, i32* %arrayidx.us, align 4
32  %add.us = add i32 %0, %sum1.us
33  %inc.us = add nuw i32 %j.us, 1
34  %exitcond = icmp eq i32 %inc.us, %J
35  br i1 %exitcond, label %for.latch, label %for.inner
36
37for.latch:
38  %add.us.lcssa = phi i32 [ %add.us, %for.inner ]
39  %arrayidx6.us = getelementptr inbounds i32, i32* %A, i32 %i.us
40  store i32 %add.us.lcssa, i32* %arrayidx6.us, align 4
41  %add8.us = add nuw i32 %i.us, 1
42  %exitcond25 = icmp eq i32 %add8.us, %I
43  br i1 %exitcond25, label %for.end.loopexit, label %for.outer, !llvm.loop !0
44
45for.end.loopexit:
46  br label %for.end
47
48for.end:
49  ret void
50}
51
52!0 = distinct !{!0, !{!"llvm.loop.disable_nonforced"}, !{!"llvm.loop.unroll_and_jam.count", i32 2}}
53