Skip to content

Commit ef140d5

Browse files
use Type instead of EVT
1 parent 558c6a5 commit ef140d5

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

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

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -306,31 +306,24 @@ RISCVCallLowering::RISCVCallLowering(const RISCVTargetLowering &TLI)
306306
: CallLowering(&TLI) {}
307307

308308
/// Return true if scalable vector with ScalarTy is legal for lowering.
309-
static bool isLegalElementTypeForRVV(EVT ScalarTy,
309+
static bool isLegalElementTypeForRVV(Type *EltTy,
310310
const RISCVSubtarget &Subtarget) {
311-
if (!ScalarTy.isSimple())
312-
return false;
313-
switch (ScalarTy.getSimpleVT().SimpleTy) {
314-
case MVT::iPTR:
311+
if (EltTy->isPointerTy())
315312
return Subtarget.is64Bit() ? Subtarget.hasVInstructionsI64() : true;
316-
case MVT::i1:
317-
case MVT::i8:
318-
case MVT::i16:
319-
case MVT::i32:
313+
if (EltTy->isIntegerTy(1) || EltTy->isIntegerTy(8) ||
314+
EltTy->isIntegerTy(16) || EltTy->isIntegerTy(32))
320315
return true;
321-
case MVT::i64:
316+
if (EltTy->isIntegerTy(64))
322317
return Subtarget.hasVInstructionsI64();
323-
case MVT::f16:
318+
if (EltTy->isHalfTy())
324319
return Subtarget.hasVInstructionsF16();
325-
case MVT::bf16:
320+
if (EltTy->isBFloatTy())
326321
return Subtarget.hasVInstructionsBF16();
327-
case MVT::f32:
322+
if (EltTy->isFloatTy())
328323
return Subtarget.hasVInstructionsF32();
329-
case MVT::f64:
324+
if (EltTy->isDoubleTy())
330325
return Subtarget.hasVInstructionsF64();
331-
default:
332-
return false;
333-
}
326+
return false;
334327
}
335328

336329
// TODO: Support all argument types.
@@ -348,7 +341,7 @@ static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget,
348341
// TODO: Support fixed vector types.
349342
if (IsLowerArgs && T->isVectorTy() && Subtarget.hasVInstructions() &&
350343
T->isScalableTy() &&
351-
isLegalElementTypeForRVV(EVT::getEVT(T->getScalarType()), Subtarget))
344+
isLegalElementTypeForRVV(T->getScalarType(), Subtarget))
352345
return true;
353346
return false;
354347
}

0 commit comments

Comments
 (0)