aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-06-29 00:50:39 +0000
committerDan Gohman <gohman@apple.com>2010-06-29 00:50:39 +0000
commit6be2bd516a3022721480f8fee6986617baf0944f (patch)
treedeebad2d32c6059180d4c443324a8d94d816ef5f /test/Analysis
parent4548260ab57319273f24d25bf8d6a7eeda6fe0f6 (diff)
downloadexternal_llvm-6be2bd516a3022721480f8fee6986617baf0944f.zip
external_llvm-6be2bd516a3022721480f8fee6986617baf0944f.tar.gz
external_llvm-6be2bd516a3022721480f8fee6986617baf0944f.tar.bz2
Add an Intraprocedural form of BasicAliasAnalysis, which aims to
properly handles instructions and arguments defined in different functions, or across recursive function iterations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/BasicAA/interprocedural.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/interprocedural.ll b/test/Analysis/BasicAA/interprocedural.ll
new file mode 100644
index 0000000..2195716
--- /dev/null
+++ b/test/Analysis/BasicAA/interprocedural.ll
@@ -0,0 +1,42 @@
+; RUN: opt -interprocedural-basic-aa -interprocedural-aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s
+
+; The noalias attribute is not safe in an interprocedural context.
+; CHECK: MayAlias: i8* %p, i8* %q
+
+define void @t0(i8* noalias %p) {
+ store i8 0, i8* %p
+ ret void
+}
+define void @t1(i8* noalias %q) {
+ store i8 0, i8* %q
+ ret void
+}
+
+; An alloca can alias an argument in a different function.
+; CHECK: MayAlias: i32* %r, i32* %s
+
+define void @s0(i32* %r) {
+ store i32 0, i32* %r
+ ret void
+}
+
+define void @s1() {
+ %s = alloca i32, i32 10
+ store i32 0, i32* %s
+ call void @s0(i32* %s)
+ ret void
+}
+
+; An alloca can alias an argument in a recursive function.
+; CHECK: MayAlias: i64* %t, i64* %u
+; CHECK: MayAlias: i64* %u, i64* %v
+; CHECK: MayAlias: i64* %t, i64* %v
+
+define i64* @r0(i64* %u) {
+ %t = alloca i64, i32 10
+ %v = call i64* @r0(i64* %t)
+ store i64 0, i64* %t
+ store i64 0, i64* %u
+ store i64 0, i64* %v
+ ret i64* %t
+}