[llvm] 8dba4d4 - [LSR] Use pointer args instead of undef for uglygep*.ll tests.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 04:36:09 PST 2022


Author: Florian Hahn
Date: 2022-01-11T12:35:55Z
New Revision: 8dba4d42f50ea0f5eea27ec97578a9514cf27585

URL: https://github.com/llvm/llvm-project/commit/8dba4d42f50ea0f5eea27ec97578a9514cf27585
DIFF: https://github.com/llvm/llvm-project/commit/8dba4d42f50ea0f5eea27ec97578a9514cf27585.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
    llvm/test/Transforms/LoopStrengthReduce/uglygep.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll b/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
index a81e314bad863..41c2d89e03608 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 
diff erent 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 430127b3cd5dd..7a13997a83d19 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


        


More information about the llvm-commits mailing list