aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-04-08 08:55:49 -0700
committerPirama Arumuga Nainar <pirama@google.com>2015-04-09 15:04:38 -0700
commit4c5e43da7792f75567b693105cc53e3f1992ad98 (patch)
tree1b2c9792582e12f5af0b1512e3094425f0dc0df9 /test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
parentc75239e6119d0f9a74c57099d91cbc9bde56bf33 (diff)
downloadexternal_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.zip
external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.gz
external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.bz2
Update aosp/master llvm for rebase to r233350
Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
Diffstat (limited to 'test/Analysis/CFLAliasAnalysis/const-expr-gep.ll')
-rw-r--r--test/Analysis/CFLAliasAnalysis/const-expr-gep.ll48
1 files changed, 42 insertions, 6 deletions
diff --git a/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll b/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
index 9ae200b..c7ff407 100644
--- a/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
+++ b/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
@@ -7,15 +7,51 @@
%T = type { i32, [10 x i8] }
@G = external global %T
+@G2 = external global %T
-; CHECK: Function: test
-; CHECK-NOT: May:
+; TODO: Quite a few of these are MayAlias because we don't yet consider
+; constant offsets in CFLAA. If we start doing so, then we'll need to
+; change these test cases
+; CHECK: Function: test
+; CHECK: MayAlias: i32* %D, i32* %F
+; CHECK: MayAlias: i32* %D, i8* %X
+; CHECK: MayAlias: i32* %F, i8* %X
define void @test() {
- %D = getelementptr %T* @G, i64 0, i32 0
- %E = getelementptr %T* @G, i64 0, i32 1, i64 5
- %F = getelementptr i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
- %X = getelementptr [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5
+ %D = getelementptr %T, %T* @G, i64 0, i32 0
+ %F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
+ %X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T, %T* @G, i64 0, i32 1), i64 0, i64 5
+
+ ret void
+}
+
+; CHECK: Function: simplecheck
+; CHECK: MayAlias: i32* %F, i32* %arg0
+; CHECK: MayAlias: i32* %H, i32* %arg0
+; CHECK: MayAlias: i32* %F, i32* %H
+define void @simplecheck(i32* %arg0) {
+ %F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
+ %H = getelementptr %T, %T* @G2, i64 0, i32 0
+
+ ret void
+}
+
+; Ensure that CFLAA properly identifies and handles escaping variables (i.e.
+; globals) in nested ConstantExprs
+
+; CHECK: Function: checkNesting
+; CHECK: MayAlias: i32* %A, i32* %arg0
+
+%NestedT = type { [1 x [1 x i32]] }
+@NT = external global %NestedT
+define void @checkNesting(i32* %arg0) {
+ %A = getelementptr [1 x i32],
+ [1 x i32]* getelementptr
+ ([1 x [1 x i32]], [1 x [1 x i32]]* getelementptr (%NestedT, %NestedT* @NT, i64 0, i32 0),
+ i64 0,
+ i32 0),
+ i64 0,
+ i32 0
ret void
}