[llvm] 064aa92 - [InstCombine] Avoid UB in tests (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 07:26:16 PDT 2023


Author: Nikita Popov
Date: 2023-06-22T16:26:09+02:00
New Revision: 064aa92b999599c3758c2ad1ad4c78cb2408c0f9

URL: https://github.com/llvm/llvm-project/commit/064aa92b999599c3758c2ad1ad4c78cb2408c0f9
DIFF: https://github.com/llvm/llvm-project/commit/064aa92b999599c3758c2ad1ad4c78cb2408c0f9.diff

LOG: [InstCombine] Avoid UB in tests (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
    llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
    llvm/test/Transforms/InstCombine/phi-timeout.ll
    llvm/test/Transforms/InstCombine/pr44245.ll
    llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll
    llvm/test/Transforms/InstCombine/vscale_insertelement.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll b/llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
index 3a3097c01850a..202182d4dfa71 100644
--- a/llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
+++ b/llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
@@ -236,11 +236,11 @@ end:
 ; https://llvm.org/bugs/show_bug.cgi?id=30923
 ; Delete the widening shuffle if we're not going to reduce the extract/insert to a shuffle.
 
-define <4 x float> @PR30923(<2 x float> %x) {
+define <4 x float> @PR30923(<2 x float> %x, ptr %p) {
 ; CHECK-LABEL: @PR30923(
 ; CHECK-NEXT:  bb1:
 ; CHECK-NEXT:    [[EXT1:%.*]] = extractelement <2 x float> [[X:%.*]], i64 1
-; CHECK-NEXT:    store float [[EXT1]], ptr undef, align 4
+; CHECK-NEXT:    store float [[EXT1]], ptr [[P:%.*]], align 4
 ; CHECK-NEXT:    br label [[BB2:%.*]]
 ; CHECK:       bb2:
 ; CHECK-NEXT:    [[EXT2:%.*]] = extractelement <2 x float> [[X]], i64 0
@@ -250,7 +250,7 @@ define <4 x float> @PR30923(<2 x float> %x) {
 ;
 bb1:
   %ext1 = extractelement <2 x float> %x, i32 1
-  store float %ext1, ptr undef, align 4
+  store float %ext1, ptr %p, align 4
   br label %bb2
 
 bb2:

diff  --git a/llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll b/llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
index 93faebdb63a80..7ce50a717d192 100644
--- a/llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
+++ b/llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
@@ -236,11 +236,11 @@ end:
 ; https://llvm.org/bugs/show_bug.cgi?id=30923
 ; Delete the widening shuffle if we're not going to reduce the extract/insert to a shuffle.
 
-define <4 x float> @PR30923(<2 x float> %x) {
+define <4 x float> @PR30923(<2 x float> %x, ptr %p) {
 ; CHECK-LABEL: @PR30923(
 ; CHECK-NEXT:  bb1:
 ; CHECK-NEXT:    [[EXT1:%.*]] = extractelement <2 x float> [[X:%.*]], i64 1
-; CHECK-NEXT:    store float [[EXT1]], ptr undef, align 4
+; CHECK-NEXT:    store float [[EXT1]], ptr [[P:%.*]], align 4
 ; CHECK-NEXT:    br label [[BB2:%.*]]
 ; CHECK:       bb2:
 ; CHECK-NEXT:    [[EXT2:%.*]] = extractelement <2 x float> [[X]], i64 0
@@ -250,7 +250,7 @@ define <4 x float> @PR30923(<2 x float> %x) {
 ;
 bb1:
   %ext1 = extractelement <2 x float> %x, i32 1
-  store float %ext1, ptr undef, align 4
+  store float %ext1, ptr %p, align 4
   br label %bb2
 
 bb2:

diff  --git a/llvm/test/Transforms/InstCombine/phi-timeout.ll b/llvm/test/Transforms/InstCombine/phi-timeout.ll
index 10071a072bf79..cb28502fdbb60 100644
--- a/llvm/test/Transforms/InstCombine/phi-timeout.ll
+++ b/llvm/test/Transforms/InstCombine/phi-timeout.ll
@@ -5,7 +5,7 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 ; We are really checking that this doesn't loop forever. We would never
 ; actually get to the checks here if it did.
 
-define void @timeout(ptr nocapture readonly %cinfo) {
+define void @timeout(ptr nocapture readonly %cinfo, ptr %ptr) {
 ; CHECK-LABEL: @timeout(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
@@ -22,7 +22,7 @@ define void @timeout(ptr nocapture readonly %cinfo) {
 ; CHECK:       if.end:
 ; CHECK-NEXT:    [[P_OFF0:%.*]] = phi i8 [ [[EXTRACT_T]], [[IF_THEN]] ], [ [[EXTRACT_T1]], [[FOR_BODY]] ]
 ; CHECK-NEXT:    [[SUB:%.*]] = add i8 [[P_OFF0]], -1
-; CHECK-NEXT:    store i8 [[SUB]], ptr undef, align 1
+; CHECK-NEXT:    store i8 [[SUB]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    br label [[FOR_BODY]]
 ;
 entry:
@@ -42,6 +42,6 @@ if.end:
   %p = phi i16 [ %.pre, %if.then ], [ %l, %for.body ]
   %conv19 = trunc i16 %p to i8
   %sub = add i8 %conv19, -1
-  store i8 %sub, ptr undef, align 1
+  store i8 %sub, ptr %ptr, align 1
   br label %for.body
 }

diff  --git a/llvm/test/Transforms/InstCombine/pr44245.ll b/llvm/test/Transforms/InstCombine/pr44245.ll
index 21c95ddc1c876..895a38a4fe865 100644
--- a/llvm/test/Transforms/InstCombine/pr44245.ll
+++ b/llvm/test/Transforms/InstCombine/pr44245.ll
@@ -3,13 +3,13 @@
 
 ; This used to cause on infinite instcombine loop.
 
-define void @test(i1 %c) {
+define void @test(i1 %c, ptr %p) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  bb16:
 ; CHECK-NEXT:    br i1 [[C:%.*]], label [[BB17:%.*]], label [[BB24:%.*]]
 ; CHECK:       bb17:
 ; CHECK-NEXT:    [[I:%.*]] = phi ptr [ [[DOTIN1:%.*]], [[BB47:%.*]] ], [ undef, [[BB16:%.*]] ]
-; CHECK-NEXT:    store ptr [[I]], ptr undef, align 8
+; CHECK-NEXT:    store ptr [[I]], ptr [[P:%.*]], align 8
 ; CHECK-NEXT:    ret void
 ; CHECK:       bb24:
 ; CHECK-NEXT:    br i1 [[C]], label [[BB44:%.*]], label [[BB49:%.*]]
@@ -66,7 +66,7 @@ bb16:
 
 bb17:                                             ; preds = %bb47, %bb16
   %i = phi ptr [ %.in1, %bb47 ], [ undef, %bb16 ]
-  store ptr %i, ptr undef, align 8
+  store ptr %i, ptr %p, align 8
   ret void
 
 bb24:                                             ; preds = %bb16

diff  --git a/llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll b/llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll
index 31647ff10f7ac..ca9ab12bafad7 100644
--- a/llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll
+++ b/llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll
@@ -86,17 +86,17 @@ define <vscale x 4 x float> @insertelement_sequene_may_not_be_splat(float %x) {
 
 ; OSS-Fuzz #27416
 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27416
-define void @ossfuzz_27416(i32 %v) {
+define void @ossfuzz_27416(i32 %v, ptr %p) {
 ; CHECK-LABEL: @ossfuzz_27416(
 ; CHECK-NEXT:    [[IN:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[V:%.*]], i64 0
 ; CHECK-NEXT:    [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[IN]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
 ; CHECK-NEXT:    [[I1:%.*]] = insertelement <vscale x 4 x i32> [[SPLAT]], i32 undef, i64 128
-; CHECK-NEXT:    store <vscale x 4 x i32> [[I1]], ptr undef, align 16
+; CHECK-NEXT:    store <vscale x 4 x i32> [[I1]], ptr [[P:%.*]], align 16
 ; CHECK-NEXT:    ret void
 ;
   %in = insertelement <vscale x 4 x i32> poison, i32 %v, i32 0
   %splat = shufflevector <vscale x 4 x i32> %in, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
   %I1 = insertelement <vscale x 4 x i32> %splat, i32 undef, i8 -128
-  store <vscale x 4 x i32> %I1, ptr undef, align 16
+  store <vscale x 4 x i32> %I1, ptr %p, align 16
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/vscale_insertelement.ll b/llvm/test/Transforms/InstCombine/vscale_insertelement.ll
index 1c00fb200b066..e9dc7f75eb543 100644
--- a/llvm/test/Transforms/InstCombine/vscale_insertelement.ll
+++ b/llvm/test/Transforms/InstCombine/vscale_insertelement.ll
@@ -86,17 +86,17 @@ define <vscale x 4 x float> @insertelement_sequene_may_not_be_splat(float %x) {
 
 ; OSS-Fuzz #27416
 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27416
-define void @ossfuzz_27416(i32 %v) {
+define void @ossfuzz_27416(i32 %v, ptr %p) {
 ; CHECK-LABEL: @ossfuzz_27416(
 ; CHECK-NEXT:    [[IN:%.*]] = insertelement <vscale x 4 x i32> undef, i32 [[V:%.*]], i64 0
 ; CHECK-NEXT:    [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[IN]], <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
 ; CHECK-NEXT:    [[I1:%.*]] = insertelement <vscale x 4 x i32> [[SPLAT]], i32 undef, i64 128
-; CHECK-NEXT:    store <vscale x 4 x i32> [[I1]], ptr undef, align 16
+; CHECK-NEXT:    store <vscale x 4 x i32> [[I1]], ptr [[P:%.*]], align 16
 ; CHECK-NEXT:    ret void
 ;
   %in = insertelement <vscale x 4 x i32> undef, i32 %v, i32 0
   %splat = shufflevector <vscale x 4 x i32> %in, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
   %I1 = insertelement <vscale x 4 x i32> %splat, i32 undef, i8 -128
-  store <vscale x 4 x i32> %I1, ptr undef, align 16
+  store <vscale x 4 x i32> %I1, ptr %p, align 16
   ret void
 }


        


More information about the llvm-commits mailing list