1; RUN: opt -S -O1 < %s -o %t1.ll 2; RUN: opt -S < %t1.ll -o %t2.ll 3; RUN: opt -S -simplifycfg < %t1.ll -o %t3.ll 4;; Show that there's no difference after running another simplify CFG 5; RUN: diff %t2.ll %t3.ll 6 7; Test from LoopSink pass, leaves some single-entry single-exit basic blocks. 8; After LoopSink, we get a basic block .exit.loopexit which has one entry and 9; one exit, the only instruction is a branch. Make sure it doesn't show up. 10; Make sure they disappear at -O1. 11 12@g = global i32 0, align 4 13 14define i32 @t1(i32, i32) { 15 %3 = icmp eq i32 %1, 0 16 br i1 %3, label %.exit, label %.preheader 17 18.preheader: 19 %invariant = load i32, i32* @g 20 br label %.b1 21 22.b1: 23 %iv = phi i32 [ %t7, %.b7 ], [ 0, %.preheader ] 24 %c1 = icmp sgt i32 %iv, %0 25 br i1 %c1, label %.b2, label %.b6 26 27.b2: 28 %c2 = icmp sgt i32 %iv, 1 29 br i1 %c2, label %.b3, label %.b4 30 31.b3: 32 %t3 = sub nsw i32 %invariant, %iv 33 br label %.b5 34 35.b4: 36 %t4 = add nsw i32 %invariant, %iv 37 br label %.b5 38 39.b5: 40 %p5 = phi i32 [ %t3, %.b3 ], [ %t4, %.b4 ] 41 %t5 = mul nsw i32 %p5, 5 42 br label %.b7 43 44.b6: 45 %t6 = add nsw i32 %iv, 100 46 br label %.b7 47 48.b7: 49 %p7 = phi i32 [ %t6, %.b6 ], [ %t5, %.b5 ] 50 %t7 = add nuw nsw i32 %iv, 1 51 %c7 = icmp eq i32 %t7, %p7 52 br i1 %c7, label %.b1, label %.exit 53 54.exit: 55 ret i32 10 56} 57 58