summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2016-07-11 01:32:20 +0000
committerHal Finkel <hfinkel@anl.gov>2016-07-11 01:32:20 +0000
commit5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6 (patch)
treedd44cb608cfc199b1e9db70058b537669b386dcb /llvm/test
parent47646c09818bd3571d72b3f0e312b1f301ec66ee (diff)
downloadbcm5719-llvm-5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6.tar.gz
bcm5719-llvm-5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6.zip
BasicAA should look through functions with returned arguments
Motivated by the work on the llvm.noalias intrinsic, teach BasicAA to look through returned-argument functions when answering queries. This is essential so that we don't loose all other AA information when supplementing with llvm.noalias. Differential Revision: http://reviews.llvm.org/D9383 llvm-svn: 275035
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/BasicAA/returned.ll45
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/Analysis/BasicAA/returned.ll b/llvm/test/Analysis/BasicAA/returned.ll
new file mode 100644
index 00000000000..c6ef6806140
--- /dev/null
+++ b/llvm/test/Analysis/BasicAA/returned.ll
@@ -0,0 +1,45 @@
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+%struct = type { i32, i32, i32 }
+
+; CHECK-LABEL: test_simple
+
+; CHECK-DAG: MustAlias: %struct* %st, %struct* %sta
+
+; CHECK-DAG: PartialAlias: %struct* %st, i32* %x
+; CHECK-DAG: PartialAlias: %struct* %st, i32* %y
+; CHECK-DAG: PartialAlias: %struct* %st, i32* %z
+
+; CHECK-DAG: NoAlias: i32* %x, i32* %y
+; CHECK-DAG: NoAlias: i32* %x, i32* %z
+; CHECK-DAG: NoAlias: i32* %y, i32* %z
+
+; CHECK-DAG: PartialAlias: %struct* %st, %struct* %y_12
+; CHECK-DAG: PartialAlias: %struct* %y_12, i32* %x
+; CHECK-DAG: PartialAlias: i32* %x, i80* %y_10
+
+; CHECK-DAG: PartialAlias: %struct* %st, i64* %y_8
+; CHECK-DAG: PartialAlias: i32* %z, i64* %y_8
+; CHECK-DAG: NoAlias: i32* %x, i64* %y_8
+
+; CHECK-DAG: MustAlias: %struct* %y_12, i32* %y
+; CHECK-DAG: MustAlias: i32* %y, i64* %y_8
+; CHECK-DAG: MustAlias: i32* %y, i80* %y_10
+
+define void @test_simple(%struct* %st, i64 %i, i64 %j, i64 %k) {
+ %x = getelementptr %struct, %struct* %st, i64 %i, i32 0
+ %y = getelementptr %struct, %struct* %st, i64 %j, i32 1
+ %sta = call %struct* @func2(%struct* %st)
+ %z = getelementptr %struct, %struct* %sta, i64 %k, i32 2
+ %y_12 = bitcast i32* %y to %struct*
+ %y_10 = bitcast i32* %y to i80*
+ %ya = call i32* @func1(i32* %y)
+ %y_8 = bitcast i32* %ya to i64*
+ ret void
+}
+
+declare i32* @func1(i32* returned) nounwind
+declare %struct* @func2(%struct* returned) nounwind
+
OpenPOWER on IntegriCloud