1 ; NOTE: Assertions have been autogenerated by update_test_checks.py
2 ; Test merging of blocks that only have PHI nodes in them
4 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
7 define i32 @test(i1 %a, i1 %b) {
10 ; CHECK-NEXT: [[DOT:%.*]] = select i1 %b, i32 0, i32 1
11 ; CHECK-NEXT: [[W:%.*]] = select i1 %a, i32 2, i32 [[DOT]]
12 ; CHECK-NEXT: [[R:%.*]] = add i32 [[W]], 1
13 ; CHECK-NEXT: ret i32 [[R]]
15 br i1 %a, label %M, label %O
17 br i1 %b, label %N, label %Q
21 ; This block should be foldable into M
22 %Wp = phi i32 [ 0, %O ], [ 1, %Q ] ; <i32> [#uses=1]
25 %W = phi i32 [ %Wp, %N ], [ 2, %0 ] ; <i32> [#uses=1]
26 %R = add i32 %W, 1 ; <i32> [#uses=1]