summaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-08 17:12:04 +0000
committerDan Gohman <gohman@apple.com>2010-11-08 17:12:04 +0000
commitea8900f5df76e11efb9464157af160f5fa41e9c0 (patch)
tree7a4ba9c7e4d6a835a298caee7537fbf47babcf98 /test/Analysis
parenta8598bec287108d0359880d33955759dc90cd5a1 (diff)
downloadllvm-ea8900f5df76e11efb9464157af160f5fa41e9c0.tar.gz
llvm-ea8900f5df76e11efb9464157af160f5fa41e9c0.tar.bz2
llvm-ea8900f5df76e11efb9464157af160f5fa41e9c0.tar.xz
Make FunctionAttrs TBAA-aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
new file mode 100644
index 0000000000..62fe8aa164
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -0,0 +1,37 @@
+; RUN: opt < %s -enable-tbaa -tbaa -basicaa -functionattrs -S | FileCheck %s
+
+; FunctionAttrs should make use of TBAA.
+
+; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
+define void @test0_yes(i32* %p) nounwind {
+ store i32 0, i32* %p, !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test0_no(i32* nocapture %p) nounwind {
+define void @test0_no(i32* %p) nounwind {
+ store i32 0, i32* %p, !tbaa !2
+ ret void
+}
+
+; CHECK: define void @test1_yes(i32* %p) nounwind readonly {
+define void @test1_yes(i32* %p) nounwind {
+ call void @callee(i32* %p), !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test1_no(i32* %p) nounwind {
+define void @test1_no(i32* %p) nounwind {
+ call void @callee(i32* %p), !tbaa !2
+ ret void
+}
+
+declare void @callee(i32* %p) nounwind
+
+; Root note.
+!0 = metadata !{ }
+
+; Invariant memory.
+!1 = metadata !{ metadata !"foo", metadata !0, i1 1 }
+; Not invariant memory.
+!2 = metadata !{ metadata !"foo", metadata !0, i1 0 }