icmp.ll 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ; RUN: opt -correlated-propagation -S %s | FileCheck %s
  2. target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  3. target triple = "x86_64-apple-macosx10.10.0"
  4. ; Function Attrs: noreturn
  5. declare void @check1(i1) #1
  6. ; Function Attrs: noreturn
  7. declare void @check2(i1) #1
  8. ; Make sure we propagate the value of %tmp35 to the true/false cases
  9. ; CHECK-LABEL: @test1
  10. ; CHECK: call void @check1(i1 false)
  11. ; CHECK: call void @check2(i1 true)
  12. define void @test1(i64 %tmp35) {
  13. bb:
  14. %tmp36 = icmp sgt i64 %tmp35, 0
  15. br i1 %tmp36, label %bb_true, label %bb_false
  16. bb_true:
  17. %tmp47 = icmp slt i64 %tmp35, 0
  18. tail call void @check1(i1 %tmp47) #4
  19. unreachable
  20. bb_false:
  21. %tmp48 = icmp sle i64 %tmp35, 0
  22. tail call void @check2(i1 %tmp48) #4
  23. unreachable
  24. }
  25. ; Function Attrs: noreturn
  26. ; This is the same as test1 but with a diamond to ensure we
  27. ; get %tmp36 from both true and false BBs.
  28. ; CHECK-LABEL: @test2
  29. ; CHECK: call void @check1(i1 false)
  30. ; CHECK: call void @check2(i1 true)
  31. define void @test2(i64 %tmp35, i1 %inner_cmp) {
  32. bb:
  33. %tmp36 = icmp sgt i64 %tmp35, 0
  34. br i1 %tmp36, label %bb_true, label %bb_false
  35. bb_true:
  36. br i1 %inner_cmp, label %inner_true, label %inner_false
  37. inner_true:
  38. br label %merge
  39. inner_false:
  40. br label %merge
  41. merge:
  42. %tmp47 = icmp slt i64 %tmp35, 0
  43. tail call void @check1(i1 %tmp47) #0
  44. unreachable
  45. bb_false:
  46. %tmp48 = icmp sle i64 %tmp35, 0
  47. tail call void @check2(i1 %tmp48) #4
  48. unreachable
  49. }
  50. attributes #4 = { noreturn }