summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-01-18 21:16:06 +0000
committerDan Gohman <gohman@apple.com>2011-01-18 21:16:06 +0000
commit44da55b7bead716aba4fc52f718e536f9b5a0715 (patch)
treee7afd611d9909a2c51ca53b67a1709727c119a09 /llvm/test/Analysis
parent267f6c1ab2a474af6e2bb90aa89b3b8c4be87142 (diff)
downloadbcm5719-llvm-44da55b7bead716aba4fc52f718e536f9b5a0715.tar.gz
bcm5719-llvm-44da55b7bead716aba4fc52f718e536f9b5a0715.zip
Teach BasicAA to return PartialAlias in cases where both pointers
are pointing to the same object, one pointer is accessing the entire object, and the other is access has a non-zero size. This prevents TBAA from kicking in and saying NoAlias in such cases. llvm-svn: 123775
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r--llvm/test/Analysis/BasicAA/full-store-partial-alias.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Analysis/BasicAA/full-store-partial-alias.ll b/llvm/test/Analysis/BasicAA/full-store-partial-alias.ll
new file mode 100644
index 00000000000..f92c689516e
--- /dev/null
+++ b/llvm/test/Analysis/BasicAA/full-store-partial-alias.ll
@@ -0,0 +1,33 @@
+; RUN: opt -S -tbaa -basicaa -gvn < %s | grep {ret i32 %}
+; RUN: opt -S -tbaa -gvn < %s | grep {ret i32 0}
+; rdar://8875631
+
+; BasicAA should notice that the store stores to the entire %u object,
+; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
+; Without BasicAA, TBAA should say that %tmp5 is NoAlias with the store.
+
+target datalayout = "e-p:64:64:64"
+
+%union.anon = type { double }
+
+@u = global %union.anon { double -2.500000e-01 }, align 8
+@endianness_test = global i64 1, align 8
+
+define i32 @signbit(double %x) nounwind {
+entry:
+ %u = alloca %union.anon, align 8
+ %tmp9 = getelementptr inbounds %union.anon* %u, i64 0, i32 0
+ store double %x, double* %tmp9, align 8, !tbaa !0
+ %tmp2 = load i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
+ %idxprom = sext i32 %tmp2 to i64
+ %tmp4 = bitcast %union.anon* %u to [2 x i32]*
+ %arrayidx = getelementptr inbounds [2 x i32]* %tmp4, i64 0, i64 %idxprom
+ %tmp5 = load i32* %arrayidx, align 4, !tbaa !3
+ %tmp5.lobit = lshr i32 %tmp5, 31
+ ret i32 %tmp5.lobit
+}
+
+!0 = metadata !{metadata !"double", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !"int", metadata !1}
OpenPOWER on IntegriCloud