Skip to content

Commit 4d04555

Browse files
use Type instead of EVT
1 parent c31f3e3 commit 4d04555

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

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

+11-18
Original file line numberDiff line numberDiff line change
@@ -298,31 +298,24 @@ RISCVCallLowering::RISCVCallLowering(const RISCVTargetLowering &TLI)
298298
: CallLowering(&TLI) {}
299299

300300
/// Return true if scalable vector with ScalarTy is legal for lowering.
301-
static bool isLegalElementTypeForRVV(EVT ScalarTy,
301+
static bool isLegalElementTypeForRVV(Type *EltTy,
302302
const RISCVSubtarget &Subtarget) {
303-
if (!ScalarTy.isSimple())
304-
return false;
305-
switch (ScalarTy.getSimpleVT().SimpleTy) {
306-
case MVT::iPTR:
303+
if (EltTy->isPointerTy())
307304
return Subtarget.is64Bit() ? Subtarget.hasVInstructionsI64() : true;
308-
case MVT::i1:
309-
case MVT::i8:
310-
case MVT::i16:
311-
case MVT::i32:
305+
if (EltTy->isIntegerTy(1) || EltTy->isIntegerTy(8) ||
306+
EltTy->isIntegerTy(16) || EltTy->isIntegerTy(32))
312307
return true;
313-
case MVT::i64:
308+
if (EltTy->isIntegerTy(64))
314309
return Subtarget.hasVInstructionsI64();
315-
case MVT::f16:
310+
if (EltTy->isHalfTy())
316311
return Subtarget.hasVInstructionsF16();
317-
case MVT::bf16:
312+
if (EltTy->isBFloatTy())
318313
return Subtarget.hasVInstructionsBF16();
319-
case MVT::f32:
314+
if (EltTy->isFloatTy())
320315
return Subtarget.hasVInstructionsF32();
321-
case MVT::f64:
316+
if (EltTy->isDoubleTy())
322317
return Subtarget.hasVInstructionsF64();
323-
default:
324-
return false;
325-
}
318+
return false;
326319
}
327320

328321
// TODO: Support all argument types.
@@ -340,7 +333,7 @@ static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget,
340333
// TODO: Support fixed vector types.
341334
if (IsLowerArgs && T->isVectorTy() && Subtarget.hasVInstructions() &&
342335
T->isScalableTy() &&
343-
isLegalElementTypeForRVV(EVT::getEVT(T->getScalarType()), Subtarget))
336+
isLegalElementTypeForRVV(T->getScalarType(), Subtarget))
344337
return true;
345338
return false;
346339
}

0 commit comments

Comments
 (0)