precedence.ll 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ; RUN: opt -basicaa -tbaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=TBAA
  2. ; RUN: opt -tbaa -basicaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=BASICAA
  3. ; According to the TBAA metadata the load and store don't alias. However,
  4. ; according to the actual code, they do. The order of the alias analysis
  5. ; passes should determine which of these takes precedence.
  6. target datalayout = "e-p:64:64:64"
  7. ; Test for simple MustAlias aliasing.
  8. ; TBAA: @trouble
  9. ; TBAA: ret i32 0
  10. ; BASICAA: @trouble
  11. ; BASICAA: ret i32 1075000115
  12. define i32 @trouble(i32* %x) nounwind {
  13. entry:
  14. store i32 0, i32* %x, !tbaa !0
  15. %0 = bitcast i32* %x to float*
  16. store float 0x4002666660000000, float* %0, !tbaa !3
  17. %tmp3 = load i32, i32* %x, !tbaa !0
  18. ret i32 %tmp3
  19. }
  20. ; Test for PartialAlias aliasing. GVN doesn't yet eliminate the load
  21. ; in the BasicAA case.
  22. ; TBAA: @offset
  23. ; TBAA: ret i64 0
  24. ; BASICAA: @offset
  25. ; BASICAA: ret i64 %tmp3
  26. define i64 @offset(i64* %x) nounwind {
  27. entry:
  28. store i64 0, i64* %x, !tbaa !4
  29. %0 = bitcast i64* %x to i8*
  30. %1 = getelementptr i8, i8* %0, i64 1
  31. store i8 1, i8* %1, !tbaa !5
  32. %tmp3 = load i64, i64* %x, !tbaa !4
  33. ret i64 %tmp3
  34. }
  35. !0 = !{!2, !2, i64 0}
  36. !1 = !{!"simple"}
  37. !2 = !{!"int", !1}
  38. !3 = !{!6, !6, i64 0}
  39. !4 = !{!7, !7, i64 0}
  40. !5 = !{!8, !8, i64 0}
  41. !6 = !{!"float", !1}
  42. !7 = !{!"long", !1}
  43. !8 = !{!"small", !1}