summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r--llvm/test/Analysis/CFLAliasAnalysis/asm-global-bugfix.ll2
-rw-r--r--llvm/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll42
-rw-r--r--llvm/test/Analysis/CFLAliasAnalysis/stratified-attrs-indexing.ll2
3 files changed, 41 insertions, 5 deletions
diff --git a/llvm/test/Analysis/CFLAliasAnalysis/asm-global-bugfix.ll b/llvm/test/Analysis/CFLAliasAnalysis/asm-global-bugfix.ll
index d8ee94ba65c..1cd19644d5c 100644
--- a/llvm/test/Analysis/CFLAliasAnalysis/asm-global-bugfix.ll
+++ b/llvm/test/Analysis/CFLAliasAnalysis/asm-global-bugfix.ll
@@ -7,7 +7,7 @@
@G = private unnamed_addr constant [1 x i8] c"\00", align 1
; CHECK: Function: test_no_crash
-; CHECK: 1 no alias responses
+; CHECK: 0 no alias responses
define void @test_no_crash() #0 {
entry:
call i8* asm "nop", "=r,r"(
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
+}
diff --git a/llvm/test/Analysis/CFLAliasAnalysis/stratified-attrs-indexing.ll b/llvm/test/Analysis/CFLAliasAnalysis/stratified-attrs-indexing.ll
index 8afedf2e139..347528583a6 100644
--- a/llvm/test/Analysis/CFLAliasAnalysis/stratified-attrs-indexing.ll
+++ b/llvm/test/Analysis/CFLAliasAnalysis/stratified-attrs-indexing.ll
@@ -18,7 +18,7 @@ define void @test(i1 %cond,
i32* %arg31, i32* %arg32, i32* %arg33, i32* %arg34, i32* %arg35) {
; CHECK: 946 Total Alias Queries Performed
- ; CHECK: 810 no alias responses (85.6%)
+ ; CHECK: 43 no alias responses (4.5%)
%a = alloca i32, align 4
%b = select i1 %cond, i32* %arg35, i32* %arg34
%c = select i1 %cond, i32* %arg34, i32* %arg33
OpenPOWER on IntegriCloud