Skip to content

Commit 18dc318

Browse files
committed
Change the shufflevector's invalid operand SrcVec to VecFNeg
1 parent 7a58cb0 commit 18dc318

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
715715
Value *VecFNeg = Builder.CreateFNegFMF(SrcVec, FNeg);
716716
if (NeedLenChg) {
717717
// shuffle DestVec, (shuffle (fneg SrcVec), poison, SrcMask), Mask
718-
Value *LenChgShuf = Builder.CreateShuffleVector(SrcVec, SrcMask);
718+
Value *LenChgShuf = Builder.CreateShuffleVector(VecFNeg, SrcMask);
719719
NewShuf = Builder.CreateShuffleVector(DestVec, LenChgShuf, Mask);
720720
} else {
721721
// shuffle DestVec, (fneg SrcVec), Mask

llvm/test/Transforms/VectorCombine/X86/extract-fneg-insert.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ define <4 x float> @ext2_v4f32(<4 x float> %x, <4 x float> %y) {
4848
define <4 x float> @ext2_v2f32v4f32(<2 x float> %x, <4 x float> %y) {
4949
; CHECK-LABEL: @ext2_v2f32v4f32(
5050
; CHECK-NEXT: [[TMP1:%.*]] = fneg <2 x float> [[X:%.*]]
51-
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[X]], <2 x float> poison, <4 x i32> <i32 poison, i32 poison, i32 2, i32 poison>
51+
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> poison, <4 x i32> <i32 poison, i32 poison, i32 2, i32 poison>
5252
; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 6, i32 3>
5353
; CHECK-NEXT: ret <4 x float> [[R]]
5454
;
@@ -81,7 +81,7 @@ define <4 x double> @ext1_v2f64v4f64(<2 x double> %x, <4 x double> %y) {
8181
;
8282
; AVX-LABEL: @ext1_v2f64v4f64(
8383
; AVX-NEXT: [[TMP1:%.*]] = fneg nsz <2 x double> [[X:%.*]]
84-
; AVX-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[X]], <2 x double> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
84+
; AVX-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
8585
; AVX-NEXT: [[R:%.*]] = shufflevector <4 x double> [[Y:%.*]], <4 x double> [[TMP2]], <4 x i32> <i32 0, i32 5, i32 2, i32 3>
8686
; AVX-NEXT: ret <4 x double> [[R]]
8787
;
@@ -326,7 +326,7 @@ define <2 x float> @ext1_v2f32_fsub_fmf(<2 x float> %x, <2 x float> %y) {
326326
define <4 x float> @ext1_v2f32v4f32_fsub_fmf(<2 x float> %x, <4 x float> %y) {
327327
; CHECK-LABEL: @ext1_v2f32v4f32_fsub_fmf(
328328
; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan nsz <2 x float> [[X:%.*]]
329-
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[X]], <2 x float> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
329+
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
330330
; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[TMP2]], <4 x i32> <i32 0, i32 5, i32 2, i32 3>
331331
; CHECK-NEXT: ret <4 x float> [[R]]
332332
;

0 commit comments

Comments
 (0)