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