summaryrefslogtreecommitdiff
path: root/test/Analysis/TypeBasedAliasAnalysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-08 20:20:11 +0000
committerDan Gohman <gohman@apple.com>2010-11-08 20:20:11 +0000
commite5dd6624eab7efc3aff582c8ddc070462de4d4b7 (patch)
tree59278810a08af4cb7de8a648944b0e3f014cb8fd /test/Analysis/TypeBasedAliasAnalysis
parent0a67d92938d77b6a8cde6e1676750264b274cebc (diff)
downloadllvm-e5dd6624eab7efc3aff582c8ddc070462de4d4b7.tar.gz
llvm-e5dd6624eab7efc3aff582c8ddc070462de4d4b7.tar.bz2
llvm-e5dd6624eab7efc3aff582c8ddc070462de4d4b7.tar.xz
Add a testcase for a call which BasicAA says only accesses memory through
its arguments and which TBAA says doesn't write to memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/TypeBasedAliasAnalysis')
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
index 62fe8aa164..5ef355fd93 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -2,6 +2,13 @@
; FunctionAttrs should make use of TBAA.
+; Add the readnone attribute, since the only access is a store which TBAA
+; says is to constant memory.
+;
+; It's unusual to see a store to constant memory, but it isn't necessarily
+; invalid, as it's possible that this only happens after optimization on a
+; code path which isn't ever executed.
+
; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
define void @test0_yes(i32* %p) nounwind {
store i32 0, i32* %p, !tbaa !1
@@ -14,6 +21,9 @@ define void @test0_no(i32* %p) nounwind {
ret void
}
+; Add the readonly attribute, since there's just a call to a function which
+; TBAA says doesn't modify any memory.
+
; CHECK: define void @test1_yes(i32* %p) nounwind readonly {
define void @test1_yes(i32* %p) nounwind {
call void @callee(i32* %p), !tbaa !1
@@ -26,7 +36,27 @@ define void @test1_no(i32* %p) nounwind {
ret void
}
+; Add the readonly attribute, as above, but this time BasicAA will say
+; that the function accesses memory through its arguments, which TBAA
+; still says that the function doesn't write to memory.
+;
+; This is unusual, since the function is memcpy, but as above, this
+; isn't necessarily invalid.
+
+; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone {
+define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind {
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind {
+define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2
+ ret void
+}
+
declare void @callee(i32* %p) nounwind
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind
; Root note.
!0 = metadata !{ }