• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -lcssa -S | FileCheck %s
2; RUN: opt < %s -passes=lcssa -S | FileCheck %s
3; CHECK: exit1:
4; CHECK: .lcssa =
5; CHECK: exit2:
6; CHECK: .lcssa1 =
7; CHECK: exit3:
8; CHECK-NOT: .lcssa
9
10; Test to ensure that when there are multiple exit blocks, PHI nodes are
11; only inserted by LCSSA when there is a use dominated by a given exit
12; block.
13
14declare void @printf(i32 %i)
15
16define i32 @unused_phis() nounwind {
17entry:
18  br label %loop
19
20loop:
21  %i = phi i32 [0, %entry], [1, %then2]
22  br i1 undef, label %exit1, label %then1
23
24then1:
25  br i1 undef, label %exit2, label %then2
26
27then2:
28  br i1 undef, label %exit3, label %loop
29
30exit1:
31  call void @printf(i32 %i)
32  ret i32 %i
33
34exit2:
35  ret i32 %i
36
37exit3:
38  ret i32 0
39}
40