[llvm] 95eaaa7 - [LV] Replace undef with constant and pointer argument in tests.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 04:23:30 PST 2023


Author: Florian Hahn
Date: 2023-11-16T12:23:17Z
New Revision: 95eaaa7d7157fcf5d920eff9aff9b67789322a58

URL: https://github.com/llvm/llvm-project/commit/95eaaa7d7157fcf5d920eff9aff9b67789322a58
DIFF: https://github.com/llvm/llvm-project/commit/95eaaa7d7157fcf5d920eff9aff9b67789322a58.diff

LOG: [LV] Replace undef with constant and pointer argument in tests.

This makes the tests more defined, prevents uses of the add being folded
and remove UB when loading from undef.

Added: 
    

Modified: 
    llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll b/llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll
index 56a39d37318d453..cf12c6a0d5b74ac 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll
@@ -20,7 +20,7 @@ define void @test0(ptr noalias %M3, ptr noalias %A, ptr noalias %B) {
 ; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 [[TMP0]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds i16, ptr [[TMP4]], i32 0
 ; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x i16>, ptr [[TMP5]], align 2
-; CHECK-NEXT:    [[TMP6:%.*]] = add <4 x i16> [[WIDE_LOAD]], undef
+; CHECK-NEXT:    [[TMP6:%.*]] = add <4 x i16> [[WIDE_LOAD]], <i16 10, i16 10, i16 10, i16 10>
 ; CHECK-NEXT:    [[TMP7:%.*]] = zext <4 x i16> [[TMP6]] to <4 x i32>
 ; CHECK-NEXT:    [[TMP8:%.*]] = trunc <4 x i32> [[TMP7]] to <4 x i16>
 ; CHECK-NEXT:    [[TMP9:%.*]] = getelementptr inbounds i64, ptr [[B]], i64 [[TMP0]]
@@ -60,7 +60,7 @@ define void @test0(ptr noalias %M3, ptr noalias %A, ptr noalias %B) {
 ; CHECK-NEXT:    [[GEP_A:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 [[INDVARS_IV1783]]
 ; CHECK-NEXT:    [[L_A:%.*]] = load i16, ptr [[GEP_A]], align 2
 ; CHECK-NEXT:    [[CONV1177_US:%.*]] = zext i16 [[L_A]] to i32
-; CHECK-NEXT:    [[ADD1178_US:%.*]] = add nsw i32 [[CONV1177_US]], undef
+; CHECK-NEXT:    [[ADD1178_US:%.*]] = add nsw i32 [[CONV1177_US]], 10
 ; CHECK-NEXT:    [[CONV1179_US:%.*]] = trunc i32 [[ADD1178_US]] to i16
 ; CHECK-NEXT:    [[GEP_B:%.*]] = getelementptr inbounds i64, ptr [[B]], i64 [[INDVARS_IV1783]]
 ; CHECK-NEXT:    [[L_B:%.*]] = load i64, ptr [[GEP_B]], align 8
@@ -81,7 +81,7 @@ if.then1165.us:                                   ; preds = %if.then1165.us, %en
   %gep.A  = getelementptr inbounds i16, ptr %A, i64 %indvars.iv1783
   %l.A = load i16, ptr %gep.A
   %conv1177.us = zext i16 %l.A to i32
-  %add1178.us = add nsw i32 %conv1177.us, undef
+  %add1178.us = add nsw i32 %conv1177.us, 10
   %conv1179.us = trunc i32 %add1178.us to i16
   %gep.B  = getelementptr inbounds i64, ptr %B, i64 %indvars.iv1783
   %l.B = load i64, ptr %gep.B
@@ -96,9 +96,9 @@ for.inc1286.loopexit:                             ; preds = %if.then1165.us
   ret void
 }
 
-define void @test1(ptr noalias %M3, ptr noalias %A, ptr noalias %B) {
+define void @test1(ptr noalias %M3, ptr noalias %A, ptr noalias %B, ptr noalias %C) {
 ; CHECK-LABEL: define void @test1
-; CHECK-SAME: (ptr noalias [[M3:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]]) {
+; CHECK-SAME: (ptr noalias [[M3:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], ptr noalias [[C:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
 ; CHECK:       vector.ph:
@@ -109,7 +109,7 @@ define void @test1(ptr noalias %M3, ptr noalias %A, ptr noalias %B) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = add i64 [[INDEX]], 1
 ; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[INDEX]], 2
 ; CHECK-NEXT:    [[TMP3:%.*]] = add i64 [[INDEX]], 3
-; CHECK-NEXT:    [[TMP4:%.*]] = load i32, ptr undef, align 4
+; CHECK-NEXT:    [[TMP4:%.*]] = load i32, ptr [[C]], align 4
 ; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[TMP4]], i64 0
 ; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer
 ; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 [[TMP0]]
@@ -153,7 +153,7 @@ define void @test1(ptr noalias %M3, ptr noalias %A, ptr noalias %B) {
 ; CHECK-NEXT:    br label [[IF_THEN1165_US:%.*]]
 ; CHECK:       if.then1165.us:
 ; CHECK-NEXT:    [[INDVARS_IV1783:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT1784:%.*]], [[IF_THEN1165_US]] ]
-; CHECK-NEXT:    [[FPTR:%.*]] = load i32, ptr undef, align 4
+; CHECK-NEXT:    [[FPTR:%.*]] = load i32, ptr [[C]], align 4
 ; CHECK-NEXT:    [[GEP_A:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 [[INDVARS_IV1783]]
 ; CHECK-NEXT:    [[L_A:%.*]] = load i16, ptr [[GEP_A]], align 2
 ; CHECK-NEXT:    [[CONV1177_US:%.*]] = zext i16 [[L_A]] to i32
@@ -175,7 +175,7 @@ entry:
 
 if.then1165.us:                                   ; preds = %if.then1165.us, %entry
   %indvars.iv1783 = phi i64 [ 0, %entry ], [ %indvars.iv.next1784, %if.then1165.us ]
-  %fptr = load i32, ptr undef, align 4
+  %fptr = load i32, ptr %C, align 4
   %gep.A  = getelementptr inbounds i16, ptr %A, i64 %indvars.iv1783
   %l.A = load i16, ptr %gep.A
   %conv1177.us = zext i16 %l.A to i32


        


More information about the llvm-commits mailing list