apint-ipsccp4.ll 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ; This test makes sure that these instructions are properly constant propagated.
  2. ; RUN: opt < %s -ipsccp -S | not grep load
  3. ; RUN: opt < %s -ipsccp -S | not grep add
  4. ; RUN: opt < %s -ipsccp -S | not grep phi
  5. @Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
  6. { i212, float } { i212 37, float 2.0 } ]
  7. define internal float @test2() {
  8. %A = getelementptr [2 x { i212, float}], [2 x { i212, float}]* @Y, i32 0, i32 1, i32 1
  9. %B = load float, float* %A
  10. ret float %B
  11. }
  12. define internal float @test3() {
  13. %A = getelementptr [2 x { i212, float}], [2 x { i212, float}]* @Y, i32 0, i32 0, i32 1
  14. %B = load float, float* %A
  15. ret float %B
  16. }
  17. define internal float @test()
  18. {
  19. %A = call float @test2()
  20. %B = call float @test3()
  21. %E = fdiv float %B, %A
  22. ret float %E
  23. }
  24. define float @All()
  25. {
  26. %A = call float @test()
  27. %B = fcmp oge float %A, 1.0
  28. br i1 %B, label %T, label %F
  29. T:
  30. %C = fadd float %A, 1.0
  31. br label %exit
  32. F:
  33. %D = fadd float %A, 2.0
  34. br label %exit
  35. exit:
  36. %E = phi float [%C, %T], [%D, %F]
  37. ret float %E
  38. }