dominates.ll 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
  2. define i32 @f1(i32 %x) {
  3. %y = add i32 %z, 1
  4. %z = add i32 %x, 1
  5. ret i32 %y
  6. ; CHECK: Instruction does not dominate all uses!
  7. ; CHECK-NEXT: %z = add i32 %x, 1
  8. ; CHECK-NEXT: %y = add i32 %z, 1
  9. }
  10. declare i32 @g()
  11. define void @f2(i32 %x) personality i32 ()* @g {
  12. bb0:
  13. %y1 = invoke i32 @g() to label %bb1 unwind label %bb2
  14. bb1:
  15. ret void
  16. bb2:
  17. %y2 = phi i32 [%y1, %bb0]
  18. %y3 = landingpad i32
  19. cleanup
  20. ret void
  21. ; CHECK: Instruction does not dominate all uses!
  22. ; CHECK-NEXT: %y1 = invoke i32 @g()
  23. ; CHECK-NEXT: to label %bb1 unwind label %bb2
  24. ; CHECK-NEXT: %y2 = phi i32 [ %y1, %bb0 ]
  25. }
  26. define void @f3(i32 %x) personality i32 ()* @g {
  27. bb0:
  28. %y1 = invoke i32 @g() to label %bb1 unwind label %bb2
  29. bb1:
  30. ret void
  31. bb2:
  32. %y2 = landingpad i32
  33. cleanup
  34. br label %bb3
  35. bb3:
  36. %y3 = phi i32 [%y1, %bb2]
  37. ret void
  38. ; CHECK: Instruction does not dominate all uses!
  39. ; CHECK-NEXT: %y1 = invoke i32 @g()
  40. ; CHECK-NEXT: to label %bb1 unwind label %bb2
  41. ; CHECK-NEXT: %y3 = phi i32 [ %y1, %bb2 ]
  42. }
  43. define void @f4(i32 %x) {
  44. bb0:
  45. br label %bb1
  46. bb1:
  47. %y3 = phi i32 [%y1, %bb0]
  48. %y1 = add i32 %x, 1
  49. ret void
  50. ; CHECK: Instruction does not dominate all uses!
  51. ; CHECK-NEXT: %y1 = add i32 %x, 1
  52. ; CHECK-NEXT: %y3 = phi i32 [ %y1, %bb0 ]
  53. }