summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll')
-rw-r--r--llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll42
1 files changed, 39 insertions, 3 deletions
diff --git a/llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll b/llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
index 65d723e0f92..8c0ad184f16 100644
--- a/llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
+++ b/llvm/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, %T* @G, i64 0, i32 0
- %E = getelementptr %T, %T* @G, i64 0, i32 1, i64 5
%F = getelementptr i32, i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
%X = getelementptr [10 x i8], [10 x i8]* getelementptr (%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* @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]]* getelementptr (%NestedT* @NT, i64 0, i32 0),
+ i64 0,
+ i32 0),
+ i64 0,
+ i32 0
+ ret void
+}
OpenPOWER on IntegriCloud