unused-phis.ll 672 B

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