Skip to content

Commit 064aa92

Browse files
committed
[InstCombine] Avoid UB in tests (NFC)
1 parent fa459d9 commit 064aa92

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ end:
236236
; https://llvm.org/bugs/show_bug.cgi?id=30923
237237
; Delete the widening shuffle if we're not going to reduce the extract/insert to a shuffle.
238238

239-
define <4 x float> @PR30923(<2 x float> %x) {
239+
define <4 x float> @PR30923(<2 x float> %x, ptr %p) {
240240
; CHECK-LABEL: @PR30923(
241241
; CHECK-NEXT: bb1:
242242
; CHECK-NEXT: [[EXT1:%.*]] = extractelement <2 x float> [[X:%.*]], i64 1
243-
; CHECK-NEXT: store float [[EXT1]], ptr undef, align 4
243+
; CHECK-NEXT: store float [[EXT1]], ptr [[P:%.*]], align 4
244244
; CHECK-NEXT: br label [[BB2:%.*]]
245245
; CHECK: bb2:
246246
; CHECK-NEXT: [[EXT2:%.*]] = extractelement <2 x float> [[X]], i64 0
@@ -250,7 +250,7 @@ define <4 x float> @PR30923(<2 x float> %x) {
250250
;
251251
bb1:
252252
%ext1 = extractelement <2 x float> %x, i32 1
253-
store float %ext1, ptr undef, align 4
253+
store float %ext1, ptr %p, align 4
254254
br label %bb2
255255

256256
bb2:

llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ end:
236236
; https://llvm.org/bugs/show_bug.cgi?id=30923
237237
; Delete the widening shuffle if we're not going to reduce the extract/insert to a shuffle.
238238

239-
define <4 x float> @PR30923(<2 x float> %x) {
239+
define <4 x float> @PR30923(<2 x float> %x, ptr %p) {
240240
; CHECK-LABEL: @PR30923(
241241
; CHECK-NEXT: bb1:
242242
; CHECK-NEXT: [[EXT1:%.*]] = extractelement <2 x float> [[X:%.*]], i64 1
243-
; CHECK-NEXT: store float [[EXT1]], ptr undef, align 4
243+
; CHECK-NEXT: store float [[EXT1]], ptr [[P:%.*]], align 4
244244
; CHECK-NEXT: br label [[BB2:%.*]]
245245
; CHECK: bb2:
246246
; CHECK-NEXT: [[EXT2:%.*]] = extractelement <2 x float> [[X]], i64 0
@@ -250,7 +250,7 @@ define <4 x float> @PR30923(<2 x float> %x) {
250250
;
251251
bb1:
252252
%ext1 = extractelement <2 x float> %x, i32 1
253-
store float %ext1, ptr undef, align 4
253+
store float %ext1, ptr %p, align 4
254254
br label %bb2
255255

256256
bb2:

llvm/test/Transforms/InstCombine/phi-timeout.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
55
; We are really checking that this doesn't loop forever. We would never
66
; actually get to the checks here if it did.
77

8-
define void @timeout(ptr nocapture readonly %cinfo) {
8+
define void @timeout(ptr nocapture readonly %cinfo, ptr %ptr) {
99
; CHECK-LABEL: @timeout(
1010
; CHECK-NEXT: entry:
1111
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
@@ -22,7 +22,7 @@ define void @timeout(ptr nocapture readonly %cinfo) {
2222
; CHECK: if.end:
2323
; CHECK-NEXT: [[P_OFF0:%.*]] = phi i8 [ [[EXTRACT_T]], [[IF_THEN]] ], [ [[EXTRACT_T1]], [[FOR_BODY]] ]
2424
; CHECK-NEXT: [[SUB:%.*]] = add i8 [[P_OFF0]], -1
25-
; CHECK-NEXT: store i8 [[SUB]], ptr undef, align 1
25+
; CHECK-NEXT: store i8 [[SUB]], ptr [[PTR:%.*]], align 1
2626
; CHECK-NEXT: br label [[FOR_BODY]]
2727
;
2828
entry:
@@ -42,6 +42,6 @@ if.end:
4242
%p = phi i16 [ %.pre, %if.then ], [ %l, %for.body ]
4343
%conv19 = trunc i16 %p to i8
4444
%sub = add i8 %conv19, -1
45-
store i8 %sub, ptr undef, align 1
45+
store i8 %sub, ptr %ptr, align 1
4646
br label %for.body
4747
}

llvm/test/Transforms/InstCombine/pr44245.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
; This used to cause on infinite instcombine loop.
55

6-
define void @test(i1 %c) {
6+
define void @test(i1 %c, ptr %p) {
77
; CHECK-LABEL: @test(
88
; CHECK-NEXT: bb16:
99
; CHECK-NEXT: br i1 [[C:%.*]], label [[BB17:%.*]], label [[BB24:%.*]]
1010
; CHECK: bb17:
1111
; CHECK-NEXT: [[I:%.*]] = phi ptr [ [[DOTIN1:%.*]], [[BB47:%.*]] ], [ undef, [[BB16:%.*]] ]
12-
; CHECK-NEXT: store ptr [[I]], ptr undef, align 8
12+
; CHECK-NEXT: store ptr [[I]], ptr [[P:%.*]], align 8
1313
; CHECK-NEXT: ret void
1414
; CHECK: bb24:
1515
; CHECK-NEXT: br i1 [[C]], label [[BB44:%.*]], label [[BB49:%.*]]
@@ -66,7 +66,7 @@ bb16:
6666

6767
bb17: ; preds = %bb47, %bb16
6868
%i = phi ptr [ %.in1, %bb47 ], [ undef, %bb16 ]
69-
store ptr %i, ptr undef, align 8
69+
store ptr %i, ptr %p, align 8
7070
ret void
7171

7272
bb24: ; preds = %bb16

llvm/test/Transforms/InstCombine/vscale_insertelement-inseltpoison.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ define <vscale x 4 x float> @insertelement_sequene_may_not_be_splat(float %x) {
8686

8787
; OSS-Fuzz #27416
8888
; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27416
89-
define void @ossfuzz_27416(i32 %v) {
89+
define void @ossfuzz_27416(i32 %v, ptr %p) {
9090
; CHECK-LABEL: @ossfuzz_27416(
9191
; CHECK-NEXT: [[IN:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[V:%.*]], i64 0
9292
; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[IN]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
9393
; CHECK-NEXT: [[I1:%.*]] = insertelement <vscale x 4 x i32> [[SPLAT]], i32 undef, i64 128
94-
; CHECK-NEXT: store <vscale x 4 x i32> [[I1]], ptr undef, align 16
94+
; CHECK-NEXT: store <vscale x 4 x i32> [[I1]], ptr [[P:%.*]], align 16
9595
; CHECK-NEXT: ret void
9696
;
9797
%in = insertelement <vscale x 4 x i32> poison, i32 %v, i32 0
9898
%splat = shufflevector <vscale x 4 x i32> %in, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
9999
%I1 = insertelement <vscale x 4 x i32> %splat, i32 undef, i8 -128
100-
store <vscale x 4 x i32> %I1, ptr undef, align 16
100+
store <vscale x 4 x i32> %I1, ptr %p, align 16
101101
ret void
102102
}

llvm/test/Transforms/InstCombine/vscale_insertelement.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ define <vscale x 4 x float> @insertelement_sequene_may_not_be_splat(float %x) {
8686

8787
; OSS-Fuzz #27416
8888
; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27416
89-
define void @ossfuzz_27416(i32 %v) {
89+
define void @ossfuzz_27416(i32 %v, ptr %p) {
9090
; CHECK-LABEL: @ossfuzz_27416(
9191
; CHECK-NEXT: [[IN:%.*]] = insertelement <vscale x 4 x i32> undef, i32 [[V:%.*]], i64 0
9292
; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[IN]], <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
9393
; CHECK-NEXT: [[I1:%.*]] = insertelement <vscale x 4 x i32> [[SPLAT]], i32 undef, i64 128
94-
; CHECK-NEXT: store <vscale x 4 x i32> [[I1]], ptr undef, align 16
94+
; CHECK-NEXT: store <vscale x 4 x i32> [[I1]], ptr [[P:%.*]], align 16
9595
; CHECK-NEXT: ret void
9696
;
9797
%in = insertelement <vscale x 4 x i32> undef, i32 %v, i32 0
9898
%splat = shufflevector <vscale x 4 x i32> %in, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
9999
%I1 = insertelement <vscale x 4 x i32> %splat, i32 undef, i8 -128
100-
store <vscale x 4 x i32> %I1, ptr undef, align 16
100+
store <vscale x 4 x i32> %I1, ptr %p, align 16
101101
ret void
102102
}

0 commit comments

Comments
 (0)