Skip to content

Commit 8aa38bd

Browse files
Unify VT element type checks
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 09e4d3e commit 8aa38bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,13 +3496,12 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
34963496
if (SplatVal.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
34973497
return SDValue();
34983498
SDValue Vec = SplatVal.getOperand(0);
3499-
// Don't perform this optimization for i1 vectors.
3499+
// Don't perform this optimization for i1 vectors, or if the element types are
3500+
// different
35003501
// FIXME: Support i1 vectors, maybe by promoting to i8?
3501-
if (VT.getVectorElementType() == MVT::i1)
3502-
return SDValue();
3503-
// Additionally the element types should match
3504-
if (Vec.getSimpleValueType().getVectorElementType() !=
3505-
VT.getVectorElementType())
3502+
MVT EltTy = VT.getVectorElementType();
3503+
if (EltTy == MVT::i1 ||
3504+
EltTy != Vec.getSimpleValueType().getVectorElementType())
35063505
return SDValue();
35073506
SDValue Idx = SplatVal.getOperand(1);
35083507
// The index must be a legal type.

0 commit comments

Comments
 (0)