summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2022-01-11 12:35:55 +0000
committerFlorian Hahn <flo@fhahn.com>2022-01-11 12:35:55 +0000
commit8dba4d42f50ea0f5eea27ec97578a9514cf27585 (patch)
tree4d61160f88d4bb06474522af8361714f1d98dbb9
parent0c7f515f88fca39458f3b3fd9db188e48db0a7e4 (diff)
downloadllvm-8dba4d42f50ea0f5eea27ec97578a9514cf27585.tar.gz
[LSR] Use pointer args instead of undef for uglygep*.ll tests.
Make the test more robust by replacing undef by pointer arguments. This ensures that the GEPs cannot be folded to undef.
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll10
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/uglygep.ll12
2 files changed, 11 insertions, 11 deletions
diff --git a/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll b/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
index a81e314bad86..41c2d89e0360 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
@@ -8,7 +8,7 @@ target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
; Copy of uglygep with a different address space
; This tests expandAddToGEP uses the right smaller integer type for
; another address space
-define void @Z4() nounwind {
+define void @Z4(i8 addrspace(1)* %ptr.i8, float addrspace(1)* addrspace(1)* %ptr.float) {
; CHECK: define void @Z4
bb:
br label %bb3
@@ -27,7 +27,7 @@ bb3: ; preds = %bb2, %bb
; CHECK: bb10:
; CHECK-NEXT: %t7 = icmp eq i16 %t4, 0
; Host %t2 computation outside the loop.
-; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* undef, i16 %t4
+; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* %ptr.i8, i16 %t4
; CHECK-NEXT: br label %bb14
bb10: ; preds = %bb9
%t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1]
@@ -36,7 +36,7 @@ bb10: ; preds = %bb9
; CHECK: bb14:
; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[SCEVGEP]]
-; CHECK-NEXT: %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef
+; CHECK-NEXT: %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* %ptr.float
; Fold %t3's add within the address.
; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float, float addrspace(1)* %t6, i16 4
; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float addrspace(1)* [[SCEVGEP1]] to i8 addrspace(1)*
@@ -45,9 +45,9 @@ bb10: ; preds = %bb9
; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[ADDRESS]]
; CHECK-NEXT: br label %bb14
bb14: ; preds = %bb14, %bb10
- %t2 = getelementptr inbounds i8, i8 addrspace(1)* undef, i16 %t4 ; <i8*> [#uses=1]
+ %t2 = getelementptr inbounds i8, i8 addrspace(1)* %ptr.i8, i16 %t4 ; <i8*> [#uses=1]
store i8 undef, i8 addrspace(1)* %t2
- %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef
+ %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* %ptr.float
%t8 = bitcast float addrspace(1)* %t6 to i8 addrspace(1)* ; <i8*> [#uses=1]
%t9 = getelementptr inbounds i8, i8 addrspace(1)* %t8, i16 %t3 ; <i8*> [#uses=1]
store i8 undef, i8 addrspace(1)* %t9
diff --git a/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll b/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll
index 430127b3cd5d..7a13997a83d1 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll
@@ -5,8 +5,8 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-define void @Z4() nounwind {
-; CHECK-LABEL: define void @Z4(
+define void @test(i8* %ptr.i8, float** %ptr.float) {
+; CHECK-LABEL: define void @test(
bb:
br label %bb3
@@ -24,7 +24,7 @@ bb3: ; preds = %bb2, %bb
; CHECK: bb10:
; CHECK-NEXT: %t7 = icmp eq i64 %t4, 0
; Host %t2 computation outside the loop.
-; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8* undef, i64 %t4
+; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8* %ptr.i8, i64 %t4
; CHECK-NEXT: br label %bb14
bb10: ; preds = %bb9
%t7 = icmp eq i64 %t4, 0 ; <i1> [#uses=1]
@@ -33,7 +33,7 @@ bb10: ; preds = %bb9
; CHECK: bb14:
; CHECK-NEXT: store i8 undef, i8* [[SCEVGEP]]
-; CHECK-NEXT: %t6 = load float*, float** undef
+; CHECK-NEXT: %t6 = load float*, float** %ptr.float
; Fold %t3's add within the address.
; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float, float* %t6, i64 4
; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float* [[SCEVGEP1]] to i8*
@@ -42,9 +42,9 @@ bb10: ; preds = %bb9
; CHECK-NEXT: store i8 undef, i8* [[ADDRESS]]
; CHECK-NEXT: br label %bb14
bb14: ; preds = %bb14, %bb10
- %t2 = getelementptr inbounds i8, i8* undef, i64 %t4 ; <i8*> [#uses=1]
+ %t2 = getelementptr inbounds i8, i8* %ptr.i8, i64 %t4 ; <i8*> [#uses=1]
store i8 undef, i8* %t2
- %t6 = load float*, float** undef
+ %t6 = load float*, float** %ptr.float
%t8 = bitcast float* %t6 to i8* ; <i8*> [#uses=1]
%t9 = getelementptr inbounds i8, i8* %t8, i64 %t3 ; <i8*> [#uses=1]
store i8 undef, i8* %t9