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