summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2017-09-09 18:23:11 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2017-09-09 18:23:11 +0000
commit404f106d71178d3a9f27167e6a060ad577b5fadb (patch)
treec77b721b647825ed1de4f0df7f6a51434482fcb4 /llvm/test
parent97a56866a2510f8ae3ecfde7b9d9faf444299897 (diff)
downloadbcm5719-llvm-404f106d71178d3a9f27167e6a060ad577b5fadb.tar.gz
bcm5719-llvm-404f106d71178d3a9f27167e6a060ad577b5fadb.zip
Merge isKnownNonNull into isKnownNonZero
It now knows the tricks of both functions. Also, fix a bug that considered allocas of non-zero address space to be always non null Differential Revision: https://reviews.llvm.org/D37628 llvm-svn: 312869
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Other/cgscc-libcall-update.ll2
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nonnull.ll11
-rw-r--r--llvm/test/Transforms/InstCombine/lifetime.ll10
-rw-r--r--llvm/test/Transforms/InstCombine/memcpy-addrspace.ll4
-rw-r--r--llvm/test/Transforms/InstCombine/memcpy-from-global.ll2
-rw-r--r--llvm/test/Transforms/InstCombine/strcpy_chk-64.ll2
-rw-r--r--llvm/test/Transforms/InstCombine/strlen-1.ll4
-rw-r--r--llvm/test/Transforms/InstCombine/wcslen-1.ll4
-rw-r--r--llvm/test/Transforms/InstCombine/wcslen-3.ll4
9 files changed, 27 insertions, 16 deletions
diff --git a/llvm/test/Other/cgscc-libcall-update.ll b/llvm/test/Other/cgscc-libcall-update.ll
index 072eec428f2..72369bea83c 100644
--- a/llvm/test/Other/cgscc-libcall-update.ll
+++ b/llvm/test/Other/cgscc-libcall-update.ll
@@ -18,7 +18,7 @@ bb:
%tmp3 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 false, i1 true)
%tmp4 = call i8* @__strncpy_chk(i8* %arg2, i8* %tmp2, i64 1023, i64 %tmp3)
; CHECK-NOT: call
-; CHECK: call i8* @strncpy(i8* %arg2, i8* %tmp2, i64 1023)
+; CHECK: call i8* @strncpy(i8* %arg2, i8* nonnull %tmp2, i64 1023)
; CHECK-NOT: call
ret i8* %tmp4
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index 4a1ff14b204..191e6781900 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -216,3 +216,14 @@ exc:
unreachable
}
+; CHECK: define nonnull i32* @gep1(
+define i32* @gep1(i32* %p) {
+ %q = getelementptr inbounds i32, i32* %p, i32 1
+ ret i32* %q
+}
+
+; CHECK: define i32 addrspace(3)* @gep2(
+define i32 addrspace(3)* @gep2(i32 addrspace(3)* %p) {
+ %q = getelementptr inbounds i32, i32 addrspace(3)* %p, i32 1
+ ret i32 addrspace(3)* %q
+}
diff --git a/llvm/test/Transforms/InstCombine/lifetime.ll b/llvm/test/Transforms/InstCombine/lifetime.ll
index 71c676233b0..2fb9bc3495d 100644
--- a/llvm/test/Transforms/InstCombine/lifetime.ll
+++ b/llvm/test/Transforms/InstCombine/lifetime.ll
@@ -17,11 +17,11 @@ entry:
; CHECK: bb3:
; CHECK-NEXT: call void @llvm.dbg.declare
; CHECK-NEXT: br label %fin
-; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %[[T]])
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* %[[B]])
-; CHECK-NEXT: call void @foo(i8* %[[B]], i8* %[[T]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* %[[B]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* %[[T]])
+; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %[[T]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %[[B]])
+; CHECK-NEXT: call void @foo(i8* nonnull %[[B]], i8* nonnull %[[T]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %[[B]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %[[T]])
%text = alloca [1 x i8], align 1
%buff = alloca [1 x i8], align 1
%0 = getelementptr inbounds [1 x i8], [1 x i8]* %text, i64 0, i64 0
diff --git a/llvm/test/Transforms/InstCombine/memcpy-addrspace.ll b/llvm/test/Transforms/InstCombine/memcpy-addrspace.ll
index 17bc1d08f98..f0018c23642 100644
--- a/llvm/test/Transforms/InstCombine/memcpy-addrspace.ll
+++ b/llvm/test/Transforms/InstCombine/memcpy-addrspace.ll
@@ -45,7 +45,7 @@ entry:
; CHECK: alloca
; CHECK: call void @llvm.memcpy.p0i8.p2i8.i64
; CHECK-NOT: addrspacecast
-; CHECK: call i32 @foo(i32* %{{.*}})
+; CHECK: call i32 @foo(i32* nonnull %{{.*}})
define void @test_call(i32 addrspace(1)* %out, i64 %x) {
entry:
%data = alloca [8 x i32], align 4
@@ -62,7 +62,7 @@ entry:
; CHECK: alloca
; CHECK: call void @llvm.memcpy.p0i8.p2i8.i64
; CHECK: load i32, i32* %{{.*}}
-; CHECK: call i32 @foo(i32* %{{.*}})
+; CHECK: call i32 @foo(i32* nonnull %{{.*}})
; CHECK-NOT: addrspacecast
; CHECK-NOT: load i32, i32 addrspace(2)*
define void @test_load_and_call(i32 addrspace(1)* %out, i64 %x, i64 %y) {
diff --git a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
index c8b329e94b0..cbd21389e90 100644
--- a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
+++ b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
@@ -60,7 +60,7 @@ define void @test2() {
; CHECK-NEXT: getelementptr inbounds [124 x i8], [124 x i8]*
; use @G instead of %A
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.*}}, i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull %{{.*}}, i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 124, i32 4, i1 false)
call void @bar(i8* %b)
diff --git a/llvm/test/Transforms/InstCombine/strcpy_chk-64.ll b/llvm/test/Transforms/InstCombine/strcpy_chk-64.ll
index 8a2cdc2f2bb..8cfb649b634 100644
--- a/llvm/test/Transforms/InstCombine/strcpy_chk-64.ll
+++ b/llvm/test/Transforms/InstCombine/strcpy_chk-64.ll
@@ -4,7 +4,7 @@ target triple = "x86_64-apple-darwin10.0.0"
define void @func(i8* %i) nounwind ssp {
; CHECK-LABEL: @func(
-; CHECK: @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
+; CHECK: @__strcpy_chk(i8* nonnull %arraydecay, i8* %i, i64 32)
entry:
%s = alloca [32 x i8], align 16
%arraydecay = getelementptr inbounds [32 x i8], [32 x i8]* %s, i32 0, i32 0
diff --git a/llvm/test/Transforms/InstCombine/strlen-1.ll b/llvm/test/Transforms/InstCombine/strlen-1.ll
index 1e0dfb6a308..88a416be0d4 100644
--- a/llvm/test/Transforms/InstCombine/strlen-1.ll
+++ b/llvm/test/Transforms/InstCombine/strlen-1.ll
@@ -154,7 +154,7 @@ define i32 @test_no_simplify1() {
define i32 @test_no_simplify2(i32 %x) {
; CHECK-LABEL: @test_no_simplify2(
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [7 x i8], [7 x i8]* @null_hello, i32 0, i32 %x
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i32 @strlen(i8* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i32 @strlen(i8* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i32 [[HELLO_L]]
;
%hello_p = getelementptr inbounds [7 x i8], [7 x i8]* @null_hello, i32 0, i32 %x
@@ -168,7 +168,7 @@ define i32 @test_no_simplify3(i32 %x) {
; CHECK-LABEL: @test_no_simplify3(
; CHECK-NEXT: [[AND:%.*]] = and i32 %x, 15
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [13 x i8], [13 x i8]* @null_hello_mid, i32 0, i32 [[AND]]
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i32 @strlen(i8* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i32 @strlen(i8* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i32 [[HELLO_L]]
;
%and = and i32 %x, 15
diff --git a/llvm/test/Transforms/InstCombine/wcslen-1.ll b/llvm/test/Transforms/InstCombine/wcslen-1.ll
index d4e51750f6d..cdde1bfbde4 100644
--- a/llvm/test/Transforms/InstCombine/wcslen-1.ll
+++ b/llvm/test/Transforms/InstCombine/wcslen-1.ll
@@ -155,7 +155,7 @@ define i64 @test_no_simplify2(i32 %x) {
; CHECK-LABEL: @test_no_simplify2(
; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[X:%.*]] to i64
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [7 x i32], [7 x i32]* @null_hello, i64 0, i64 [[TMP1]]
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i32* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i32* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i64 [[HELLO_L]]
;
%hello_p = getelementptr inbounds [7 x i32], [7 x i32]* @null_hello, i32 0, i32 %x
@@ -170,7 +170,7 @@ define i64 @test_no_simplify3(i32 %x) {
; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 15
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[AND]] to i64
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [13 x i32], [13 x i32]* @null_hello_mid, i64 0, i64 [[TMP1]]
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i32* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i32* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i64 [[HELLO_L]]
;
%and = and i32 %x, 15
diff --git a/llvm/test/Transforms/InstCombine/wcslen-3.ll b/llvm/test/Transforms/InstCombine/wcslen-3.ll
index c766ff21412..18382c41c83 100644
--- a/llvm/test/Transforms/InstCombine/wcslen-3.ll
+++ b/llvm/test/Transforms/InstCombine/wcslen-3.ll
@@ -159,7 +159,7 @@ define i64 @test_no_simplify2(i16 %x) {
; CHECK-LABEL: @test_no_simplify2(
; CHECK-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i64
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [7 x i16], [7 x i16]* @null_hello, i64 0, i64 [[TMP1]]
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i16* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i16* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i64 [[HELLO_L]]
;
%hello_p = getelementptr inbounds [7 x i16], [7 x i16]* @null_hello, i16 0, i16 %x
@@ -174,7 +174,7 @@ define i64 @test_no_simplify3(i16 %x) {
; CHECK-NEXT: [[AND:%.*]] = and i16 [[X:%.*]], 15
; CHECK-NEXT: [[TMP1:%.*]] = zext i16 [[AND]] to i64
; CHECK-NEXT: [[HELLO_P:%.*]] = getelementptr inbounds [13 x i16], [13 x i16]* @null_hello_mid, i64 0, i64 [[TMP1]]
-; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i16* [[HELLO_P]])
+; CHECK-NEXT: [[HELLO_L:%.*]] = call i64 @wcslen(i16* nonnull [[HELLO_P]])
; CHECK-NEXT: ret i64 [[HELLO_L]]
;
%and = and i16 %x, 15
OpenPOWER on IntegriCloud