Skip to content

Commit ab84d84

Browse files
don't support vectors in isSupportedReturnType when called from lowerCall
1 parent 36346fe commit ab84d84

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,10 @@ static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget,
347347
}
348348

349349
// TODO: Only integer, pointer and aggregate types are supported now.
350-
static bool isSupportedReturnType(Type *T, const RISCVSubtarget &Subtarget) {
350+
// TODO: Remove IsLowerRetVal argument by adding support for vectors in
351+
// lowerCall.
352+
static bool isSupportedReturnType(Type *T, const RISCVSubtarget &Subtarget,
353+
bool IsLowerRetVal = false) {
351354
// TODO: Integers larger than 2*XLen are passed indirectly which is not
352355
// supported yet.
353356
if (T->isIntegerTy())
@@ -368,7 +371,8 @@ static bool isSupportedReturnType(Type *T, const RISCVSubtarget &Subtarget) {
368371
return true;
369372
}
370373

371-
if (T->isVectorTy() && Subtarget.hasVInstructions() && T->isScalableTy() &&
374+
if (IsLowerRetVal && T->isVectorTy() && Subtarget.hasVInstructions() &&
375+
T->isScalableTy() &&
372376
isLegalElementTypeForRVV(T->getScalarType(), Subtarget))
373377
return true;
374378

@@ -384,7 +388,7 @@ bool RISCVCallLowering::lowerReturnVal(MachineIRBuilder &MIRBuilder,
384388

385389
const RISCVSubtarget &Subtarget =
386390
MIRBuilder.getMF().getSubtarget<RISCVSubtarget>();
387-
if (!isSupportedReturnType(Val->getType(), Subtarget))
391+
if (!isSupportedReturnType(Val->getType(), Subtarget, /*IsLowerRetVal=*/true))
388392
return false;
389393

390394
MachineFunction &MF = MIRBuilder.getMF();

0 commit comments

Comments
 (0)