Skip to content

Commit 299b1b4

Browse files
committed
[SelectionDAG][RISCV] Teach getConstant to use SPLAT_VECTOR_PARTS if vXi64 SPLAT_VECTOR is legal but i64 scalars are not.
That matches how such a SPLAT_VECTOR would have been type legalized so assume it is ok to use for creating constants after type legalization. Still need some improvements to SPLAT_VECTOR lowering. This overlaps with some of what D158742 was trying to fix. Reviewed By: luke Differential Revision: https://reviews.llvm.org/D158870
1 parent 760eca1 commit 299b1b4

14 files changed

+4612
-4809
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,8 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, const SDLoc &DL,
16311631
unsigned ViaEltSizeInBits = ViaEltVT.getSizeInBits();
16321632

16331633
// For scalable vectors, try to use a SPLAT_VECTOR_PARTS node.
1634-
if (VT.isScalableVector()) {
1634+
if (VT.isScalableVector() ||
1635+
TLI->isOperationLegal(ISD::SPLAT_VECTOR, VT)) {
16351636
assert(EltVT.getSizeInBits() % ViaEltSizeInBits == 0 &&
16361637
"Can only handle an even split!");
16371638
unsigned Parts = EltVT.getSizeInBits() / ViaEltSizeInBits;

0 commit comments

Comments
 (0)