Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6405,8 +6405,9 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
if (VT.isScalableVector())
return SDValue();

// A CONCAT_VECTOR with all UNDEF/BUILD_VECTOR operands can be
// simplified to one big BUILD_VECTOR.
// A CONCAT_VECTOR of scalar sources, such as UNDEF, BUILD_VECTOR and
// single-element INSERT_VECTOR_ELT operands can be simplified to one big
// BUILD_VECTOR.
// FIXME: Add support for SCALAR_TO_VECTOR as well.
EVT SVT = VT.getScalarType();
SmallVector<SDValue, 16> Elts;
Expand All @@ -6416,6 +6417,10 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
Elts.append(OpVT.getVectorNumElements(), DAG.getUNDEF(SVT));
else if (Op.getOpcode() == ISD::BUILD_VECTOR)
Elts.append(Op->op_begin(), Op->op_end());
else if (Op.getOpcode() == ISD::INSERT_VECTOR_ELT &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the comment above this loop?

OpVT.getVectorNumElements() == 1 &&
isNullConstant(Op.getOperand(2)))
Elts.push_back(Op.getOperand(1));
else
return SDValue();
}
Expand Down
12 changes: 3 additions & 9 deletions llvm/test/CodeGen/X86/masked_gather_scatter.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4768,16 +4768,10 @@ declare void @llvm.masked.scatter.v8f32.v8p0(<8 x float>, <8 x ptr>, i32 immarg,
define <16 x i32> @pr163023(ptr %a0, <16 x i32> %a1) {
; X64-LABEL: pr163023:
; X64: # %bb.0:
; X64-NEXT: vpmovsxdq %ymm0, %zmm1
; X64-NEXT: vextracti64x4 $1, %zmm0, %ymm0
; X64-NEXT: vpmovsxdq %ymm0, %zmm0
; X64-NEXT: kxnorw %k0, %k0, %k1
; X64-NEXT: vpxor %xmm2, %xmm2, %xmm2
; X64-NEXT: vpxor %xmm3, %xmm3, %xmm3
; X64-NEXT: kxnorw %k0, %k0, %k2
; X64-NEXT: vpgatherqd (%rdi,%zmm0), %ymm3 {%k2}
; X64-NEXT: vpgatherqd (%rdi,%zmm1), %ymm2 {%k1}
; X64-NEXT: vinserti64x4 $1, %ymm3, %zmm2, %zmm0
; X64-NEXT: vpxor %xmm1, %xmm1, %xmm1
; X64-NEXT: vpgatherdd (%rdi,%zmm0), %zmm1 {%k1}
; X64-NEXT: vmovdqa64 %zmm1, %zmm0
; X64-NEXT: retq
;
; X86-LABEL: pr163023:
Expand Down
Loading