1; RUN: opt -simplifycfg -keep-loops=false -S < %s | FileCheck %s 2 3define void @test1(i32 %n) #0 { 4entry: 5 %n.addr = alloca i32, align 4 6 %count = alloca i32, align 4 7 store i32 %n, i32* %n.addr, align 4 8 %0 = bitcast i32* %count to i8* 9 store i32 0, i32* %count, align 4 10 br label %while.cond 11 12while.cond: ; preds = %if.end, %entry 13 %1 = load i32, i32* %count, align 4 14 %2 = load i32, i32* %n.addr, align 4 15 %cmp = icmp ule i32 %1, %2 16 br i1 %cmp, label %while.body, label %while.end 17 18while.body: ; preds = %while.cond 19 %3 = load i32, i32* %count, align 4 20 %rem = urem i32 %3, 2 21 %cmp1 = icmp eq i32 %rem, 0 22 br i1 %cmp1, label %if.then, label %if.else 23 24if.then: ; preds = %while.body 25 %4 = load i32, i32* %count, align 4 26 %add = add i32 %4, 1 27 store i32 %add, i32* %count, align 4 28 br label %if.end 29 30; CHECK: if.then: 31; CHECK: br label %while.cond, !llvm.loop !0 32 33if.else: ; preds = %while.body 34 %5 = load i32, i32* %count, align 4 35 %add2 = add i32 %5, 2 36 store i32 %add2, i32* %count, align 4 37 br label %if.end 38 39; CHECK: if.else: 40; CHECK: br label %while.cond, !llvm.loop !0 41 42if.end: ; preds = %if.else, %if.then 43 br label %while.cond, !llvm.loop !0 44 45while.end: ; preds = %while.cond 46 %6 = bitcast i32* %count to i8* 47 ret void 48} 49 50!0 = distinct !{!0, !1} 51!1 = !{!"llvm.loop.distribute.enable", i1 true} 52; CHECK: !0 = distinct !{!0, !1} 53; CHECK: !1 = !{!"llvm.loop.distribute.enable", i1 true} 54