noalias.ll 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
  2. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
  3. target triple = "x86_64-unknown-linux-gnu"
  4. define void @hello(float* noalias nocapture %a, float* nocapture readonly %c) #0 {
  5. entry:
  6. %0 = load float, float* %c, align 4
  7. %arrayidx = getelementptr inbounds float, float* %a, i64 5
  8. store float %0, float* %arrayidx, align 4
  9. ret void
  10. }
  11. define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
  12. entry:
  13. tail call void @hello(float* %a, float* %c)
  14. %0 = load float, float* %c, align 4
  15. %arrayidx = getelementptr inbounds float, float* %a, i64 7
  16. store float %0, float* %arrayidx, align 4
  17. ret void
  18. }
  19. ; CHECK: define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
  20. ; CHECK: entry:
  21. ; CHECK: %0 = load float, float* %c, align 4, !noalias !0
  22. ; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
  23. ; CHECK: store float %0, float* %arrayidx.i, align 4, !alias.scope !0
  24. ; CHECK: %1 = load float, float* %c, align 4
  25. ; CHECK: %arrayidx = getelementptr inbounds float, float* %a, i64 7
  26. ; CHECK: store float %1, float* %arrayidx, align 4
  27. ; CHECK: ret void
  28. ; CHECK: }
  29. define void @hello2(float* noalias nocapture %a, float* noalias nocapture %b, float* nocapture readonly %c) #0 {
  30. entry:
  31. %0 = load float, float* %c, align 4
  32. %arrayidx = getelementptr inbounds float, float* %a, i64 5
  33. store float %0, float* %arrayidx, align 4
  34. %arrayidx1 = getelementptr inbounds float, float* %b, i64 8
  35. store float %0, float* %arrayidx1, align 4
  36. ret void
  37. }
  38. define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
  39. entry:
  40. tail call void @hello2(float* %a, float* %b, float* %c)
  41. %0 = load float, float* %c, align 4
  42. %arrayidx = getelementptr inbounds float, float* %a, i64 7
  43. store float %0, float* %arrayidx, align 4
  44. ret void
  45. }
  46. ; CHECK: define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
  47. ; CHECK: entry:
  48. ; CHECK: %0 = load float, float* %c, align 4, !noalias !3
  49. ; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
  50. ; CHECK: store float %0, float* %arrayidx.i, align 4, !alias.scope !7, !noalias !8
  51. ; CHECK: %arrayidx1.i = getelementptr inbounds float, float* %b, i64 8
  52. ; CHECK: store float %0, float* %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
  53. ; CHECK: %1 = load float, float* %c, align 4
  54. ; CHECK: %arrayidx = getelementptr inbounds float, float* %a, i64 7
  55. ; CHECK: store float %1, float* %arrayidx, align 4
  56. ; CHECK: ret void
  57. ; CHECK: }
  58. attributes #0 = { nounwind uwtable }
  59. ; CHECK: !0 = !{!1}
  60. ; CHECK: !1 = distinct !{!1, !2, !"hello: %a"}
  61. ; CHECK: !2 = distinct !{!2, !"hello"}
  62. ; CHECK: !3 = !{!4, !6}
  63. ; CHECK: !4 = distinct !{!4, !5, !"hello2: %a"}
  64. ; CHECK: !5 = distinct !{!5, !"hello2"}
  65. ; CHECK: !6 = distinct !{!6, !5, !"hello2: %b"}
  66. ; CHECK: !7 = !{!4}
  67. ; CHECK: !8 = !{!6}