full-store-partial-alias.ll 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ; RUN: opt -S -tbaa -basicaa -gvn < %s | FileCheck -check-prefix=BASICAA %s
  2. ; RUN: opt -S -tbaa -gvn < %s | FileCheck %s
  3. ; rdar://8875631, rdar://8875069
  4. ; BasicAA should notice that the store stores to the entire %u object,
  5. ; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
  6. ; Without BasicAA, TBAA should say that %tmp5 is NoAlias with the store.
  7. target datalayout = "e-p:64:64:64"
  8. %union.anon = type { double }
  9. @u = global %union.anon { double -2.500000e-01 }, align 8
  10. @endianness_test = global i64 1, align 8
  11. define i32 @signbit(double %x) nounwind {
  12. ; BASICAA: ret i32 %tmp5.lobit
  13. ; CHECK: ret i32 0
  14. entry:
  15. %u = alloca %union.anon, align 8
  16. %tmp9 = getelementptr inbounds %union.anon, %union.anon* %u, i64 0, i32 0
  17. store double %x, double* %tmp9, align 8, !tbaa !0
  18. %tmp2 = load i32, i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
  19. %idxprom = sext i32 %tmp2 to i64
  20. %tmp4 = bitcast %union.anon* %u to [2 x i32]*
  21. %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %tmp4, i64 0, i64 %idxprom
  22. %tmp5 = load i32, i32* %arrayidx, align 4, !tbaa !3
  23. %tmp5.lobit = lshr i32 %tmp5, 31
  24. ret i32 %tmp5.lobit
  25. }
  26. !0 = !{!4, !4, i64 0}
  27. !1 = !{!"omnipotent char", !2}
  28. !2 = !{!"Simple C/C++ TBAA", null}
  29. !3 = !{!5, !5, i64 0}
  30. !4 = !{!"double", !1}
  31. !5 = !{!"int", !1}