Skip to content

Commit 9fdc305

Browse files
Let's still check the vector lenghts if the index is not constant
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 1901289 commit 9fdc305

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3526,9 +3526,11 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
35263526
return SDValue();
35273527

35283528
// Check that Index lies within VT
3529-
if (auto *CIdx = dyn_cast<ConstantSDNode>(Idx))
3529+
if (auto *CIdx = dyn_cast<ConstantSDNode>(Idx)) {
35303530
if (VT.getVectorElementCount().getKnownMinValue() <= CIdx->getZExtValue())
35313531
return SDValue();
3532+
} else if (!TypeSize::isKnownLE(Vec.getValueSizeInBits(), VT.getSizeInBits()))
3533+
return SDValue();
35323534

35333535
MVT ContainerVT = VT;
35343536
if (VT.isFixedLengthVector())

0 commit comments

Comments
 (0)