1 ; RUN: opt -S <%s -simplifycfg | FileCheck %s 2 3 define void @test_br(i32 %x) { 4 entry: 5 ; CHECK-LABEL: @test_br( 6 ; CHECK-NEXT: entry: 7 ; CHECK-NEXT: ret void 8 %cmp = icmp eq i32 %x, 10 9 br i1 %cmp, label %if.then, label %if.then 10 11 if.then: ; preds = %entry 12 br label %if.end 13 14 if.end: ; preds = %if.else, %if.then 15 ret void 16 } 17 18 define void @test_switch(i32 %x) nounwind { 19 entry: 20 ; CHECK-LABEL: @test_switch( 21 ; CHECK-NEXT: entry: 22 ; CHECK-NEXT: ret void 23 %rem = srem i32 %x, 3 24 switch i32 %rem, label %sw.bb [ 25 i32 1, label %sw.bb 26 i32 10, label %sw.bb 27 ] 28 29 sw.bb: ; preds = %sw.default, %entry, %entry 30 br label %sw.epilog 31 32 sw.epilog: ; preds = %sw.bb 33 ret void 34 } 35 36 define void @test_indirectbr(i32 %x) { 37 entry: 38 ; CHECK-LABEL: @test_indirectbr( 39 ; CHECK-NEXT: entry: 40 ; Ideally this should now check: 41 ; CHK-NEXT: ret void 42 ; But that doesn't happen yet. Instead: 43 ; CHECK-NEXT: br label %L1 44 45 %label = bitcast i8* blockaddress(@test_indirectbr, %L1) to i8* 46 indirectbr i8* %label, [label %L1, label %L2] 47 48 L1: ; preds = %entry 49 ret void 50 L2: ; preds = %entry 51 ret void 52 } 53