summaryrefslogtreecommitdiff
path: root/test/Analysis/TypeBasedAliasAnalysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-11 01:03:30 +0000
committerDan Gohman <gohman@apple.com>2010-11-11 01:03:30 +0000
commitf00833c4013446701506a156d370584520c86b45 (patch)
treef288ed7f711f2025ef14a61b668b902a860b8836 /test/Analysis/TypeBasedAliasAnalysis
parenta05f60b2413150ee11de7072f71d68d9567359ac (diff)
downloadllvm-f00833c4013446701506a156d370584520c86b45.tar.gz
llvm-f00833c4013446701506a156d370584520c86b45.tar.bz2
llvm-f00833c4013446701506a156d370584520c86b45.tar.xz
Add a testcase which demonstrates alias analysis pass precedence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/TypeBasedAliasAnalysis')
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/precedence.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Analysis/TypeBasedAliasAnalysis/precedence.ll b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
new file mode 100644
index 0000000000..b2095b0572
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
@@ -0,0 +1,21 @@
+; RUN: opt -enable-tbaa -basicaa -tbaa -gvn -instcombine -S < %s | grep {ret i32 0}
+; RUN: opt -enable-tbaa -tbaa -basicaa -gvn -instcombine -S < %s | grep {ret i32 1075000115}
+
+; According to the TBAA metadata the load and store don't alias. However,
+; according to the actual code, they do. The order of the alias analysis
+; passes should determine which of these takes precedence.
+
+target datalayout = "e-p:64:64:64"
+
+define i32 @trouble(i32* %x) nounwind ssp {
+entry:
+ store i32 0, i32* %x, !tbaa !0
+ %0 = bitcast i32* %x to float*
+ store float 0x4002666660000000, float* %0, !tbaa !3
+ %tmp3 = load i32* %x, !tbaa !0
+ ret i32 %tmp3
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"simple"}
+!3 = metadata !{metadata !"float", metadata !1}