1 ; Test merging of blocks that only have PHI nodes in them 2 ; 3 ; RUN: opt < %s -simplifycfg -S | FileCheck %s 4 ; 5 6 define i32 @test(i1 %a, i1 %b) { 7 ; CHECK: br i1 %a 8 br i1 %a, label %M, label %O 9 ; CHECK: O: 10 O: ; preds = %0 11 ; CHECK: select i1 %b, i32 0, i32 1 12 ; CHECK-NOT: phi 13 br i1 %b, label %N, label %Q 14 Q: ; preds = %O 15 br label %N 16 N: ; preds = %Q, %O 17 ; This block should be foldable into M 18 %Wp = phi i32 [ 0, %O ], [ 1, %Q ] ; <i32> [#uses=1] 19 br label %M 20 M: ; preds = %N, %0 21 ; CHECK: %W = phi i32 22 %W = phi i32 [ %Wp, %N ], [ 2, %0 ] ; <i32> [#uses=1] 23 %R = add i32 %W, 1 ; <i32> [#uses=1] 24 ret i32 %R 25 } 26 27