1 ; RUN: opt < %s -simplifycfg -adce -S | \ 2 ; RUN: not grep "call void @f1" 3 ; END. 4 5 declare void @f1() 6 7 declare void @f2() 8 9 declare void @f3() 10 11 declare void @f4() 12 13 define i32 @test1(i32 %X, i1 %D) { 14 E: 15 %C = icmp eq i32 %X, 0 ; <i1> [#uses=2] 16 br i1 %C, label %T, label %F 17 T: ; preds = %A, %E 18 br i1 %C, label %B, label %A 19 A: ; preds = %T 20 call void @f1( ) 21 br i1 %D, label %T, label %F 22 B: ; preds = %T 23 call void @f2( ) 24 ret i32 345 25 F: ; preds = %A, %E 26 call void @f3( ) 27 ret i32 123 28 } 29 30 define i32 @test2(i32 %X, i1 %D) { 31 E: 32 %C = icmp eq i32 %X, 0 ; <i1> [#uses=2] 33 br i1 %C, label %T, label %F 34 T: ; preds = %A, %E 35 %P = phi i1 [ true, %E ], [ %C, %A ] ; <i1> [#uses=1] 36 br i1 %P, label %B, label %A 37 A: ; preds = %T 38 call void @f1( ) 39 br i1 %D, label %T, label %F 40 B: ; preds = %T 41 call void @f2( ) 42 ret i32 345 43 F: ; preds = %A, %E 44 call void @f3( ) 45 ret i32 123 46 } 47 48 define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) { 49 E: 50 %C = icmp eq i32 %X, 0 ; <i1> [#uses=2] 51 br i1 %C, label %T, label %F 52 T: ; preds = %A, %E 53 call void @f3( ) 54 %XX = load i32, i32* %AP ; <i32> [#uses=1] 55 store i32 %XX, i32* %BP 56 br i1 %C, label %B, label %A 57 A: ; preds = %T 58 call void @f1( ) 59 br i1 %D, label %T, label %F 60 B: ; preds = %T 61 call void @f2( ) 62 ret i32 345 63 F: ; preds = %A, %E 64 call void @f3( ) 65 ret i32 123 66 } 67