summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/BasicAA
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2016-05-26 19:30:49 +0000
committerMichael Kuperstein <mkuper@google.com>2016-05-26 19:30:49 +0000
commitae21491819051aa41f1e51f597b03764b0093476 (patch)
tree80b6992f8a0af5a4ef378eb017faee28224f33c6 /llvm/test/Analysis/BasicAA
parentd99068d26db69f2cdaba0ad02a6bd92512f04b60 (diff)
downloadbcm5719-llvm-ae21491819051aa41f1e51f597b03764b0093476.tar.gz
bcm5719-llvm-ae21491819051aa41f1e51f597b03764b0093476.zip
[BasicAA] Extend inbound GEP negative offset logic to GlobalVariables
r270777 improved the precision of alloca vs. inbounbds GEP alias queries: if we have (a) an inbounds GEP and (b) a pointer based on an alloca, and the beginning of the object the GEP points to would have a negative offset with respect to the alloca, then the GEP can not alias pointer (b). This makes the same logic fire when (b) is based on a GlobalVariable instead of an alloca. Differential Revision: http://reviews.llvm.org/D20652 llvm-svn: 270893
Diffstat (limited to 'llvm/test/Analysis/BasicAA')
-rw-r--r--llvm/test/Analysis/BasicAA/negoffset.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Analysis/BasicAA/negoffset.ll b/llvm/test/Analysis/BasicAA/negoffset.ll
index 9b9af787692..e8550948dc1 100644
--- a/llvm/test/Analysis/BasicAA/negoffset.ll
+++ b/llvm/test/Analysis/BasicAA/negoffset.ll
@@ -26,6 +26,17 @@ define void @arg(i32* %arg) {
ret void
}
+@gv = global i32 1
+; CHECK-LABEL: Function: global:
+; CHECK-DAG: MayAlias: i32* %p0, i32* @gv
+; CHECK-DAG: NoAlias: i32* %p1, i32* @gv
+define void @global() {
+ %random = call i32* @random.i32(i32* @gv)
+ %p0 = getelementptr inbounds i32, i32* %random, i32 0
+ %p1 = getelementptr inbounds i32, i32* %random, i32 1
+ ret void
+}
+
; CHECK-LABEL: Function: struct:
; CHECK-DAG: MayAlias: i32* %f0, i32* %p0
; CHECK-DAG: MayAlias: i32* %f1, i32* %p0
OpenPOWER on IntegriCloud