Home | History | Annotate | Download | only in LCSSA
      1 ; 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 
     13 declare void @printf(i32 %i)
     14 
     15 define i32 @unused_phis() nounwind {
     16 entry:
     17   br label %loop
     18 
     19 loop:
     20   %i = phi i32 [0, %entry], [1, %then2]
     21   br i1 undef, label %exit1, label %then1
     22 
     23 then1:
     24   br i1 undef, label %exit2, label %then2
     25 
     26 then2:
     27   br i1 undef, label %exit3, label %loop
     28 
     29 exit1:
     30   call void @printf(i32 %i)
     31   ret i32 %i
     32 
     33 exit2:
     34   ret i32 %i
     35 
     36 exit3:
     37   ret i32 0
     38 }
     39