1 ; RUN: opt -simplifycfg -keep-loops=false -S < %s | FileCheck %s
2 ; RUN: opt -passes='simplify-cfg<no-keep-loops>' -S < %s | FileCheck %s
4 define void @test1(i32 %n) #0 {
6 %n.addr = alloca i32, align 4
7 %count = alloca i32, align 4
8 store i32 %n, i32* %n.addr, align 4
9 %0 = bitcast i32* %count to i8*
10 store i32 0, i32* %count, align 4
13 while.cond: ; preds = %if.end, %entry
14 %1 = load i32, i32* %count, align 4
15 %2 = load i32, i32* %n.addr, align 4
16 %cmp = icmp ule i32 %1, %2
17 br i1 %cmp, label %while.body, label %while.end
19 while.body: ; preds = %while.cond
20 %3 = load i32, i32* %count, align 4
22 %cmp1 = icmp eq i32 %rem, 0
23 br i1 %cmp1, label %if.then, label %if.else
25 if.then: ; preds = %while.body
26 %4 = load i32, i32* %count, align 4
28 store i32 %add, i32* %count, align 4
32 ; CHECK: br label %while.cond, !llvm.loop !0
34 if.else: ; preds = %while.body
35 %5 = load i32, i32* %count, align 4
37 store i32 %add2, i32* %count, align 4
41 ; CHECK: br label %while.cond, !llvm.loop !0
43 if.end: ; preds = %if.else, %if.then
44 br label %while.cond, !llvm.loop !0
46 while.end: ; preds = %while.cond
47 %6 = bitcast i32* %count to i8*
51 !0 = distinct !{!0, !1}
52 !1 = !{!"llvm.loop.distribute.enable", i1 true}
53 ; CHECK: !0 = distinct !{!0, !1}
54 ; CHECK: !1 = !{!"llvm.loop.distribute.enable", i1 true}