Skip to content

Commit e282cdb

Browse files
committed
[RISCV][IA] Avoid use of redundant variables which differ solely by type [nfc]
Instead of using dyn_cast, just use isa combined with accessors on the base VectotType class. Working towards being able to merge code from some of these routines.
1 parent ff5f355 commit e282cdb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

llvm/lib/Target/RISCV/RISCVInterleavedAccess.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ bool RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(
257257
Type *PtrTy = LI->getPointerOperandType();
258258
Type *XLenTy = Type::getIntNTy(LI->getContext(), Subtarget.getXLen());
259259

260-
if (auto *FVTy = dyn_cast<FixedVectorType>(ResVTy)) {
261-
Value *VL = Builder.CreateElementCount(XLenTy, FVTy->getElementCount());
262-
Value *Mask = Builder.getAllOnesMask(FVTy->getElementCount());
260+
if (isa<FixedVectorType>(ResVTy)) {
261+
Value *VL = Builder.CreateElementCount(XLenTy, ResVTy->getElementCount());
262+
Value *Mask = Builder.getAllOnesMask(ResVTy->getElementCount());
263263
Return = Builder.CreateIntrinsic(FixedVlsegIntrIds[Factor - 2],
264264
{ResVTy, PtrTy, XLenTy},
265265
{LI->getPointerOperand(), Mask, VL});
@@ -327,13 +327,13 @@ bool RISCVTargetLowering::lowerInterleaveIntrinsicToStore(
327327

328328
Type *XLenTy = Type::getIntNTy(SI->getContext(), Subtarget.getXLen());
329329

330-
if (auto *FVTy = dyn_cast<FixedVectorType>(InVTy)) {
330+
if (isa<FixedVectorType>(InVTy)) {
331331
Function *VssegNFunc = Intrinsic::getOrInsertDeclaration(
332332
SI->getModule(), FixedVssegIntrIds[Factor - 2], {InVTy, PtrTy, XLenTy});
333333

334334
SmallVector<Value *, 10> Ops(InterleaveValues);
335-
Value *VL = Builder.CreateElementCount(XLenTy, FVTy->getElementCount());
336-
Value *Mask = Builder.getAllOnesMask(FVTy->getElementCount());
335+
Value *VL = Builder.CreateElementCount(XLenTy, InVTy->getElementCount());
336+
Value *Mask = Builder.getAllOnesMask(InVTy->getElementCount());
337337
Ops.append({SI->getPointerOperand(), Mask, VL});
338338

339339
Builder.CreateCall(VssegNFunc, Ops);
@@ -455,9 +455,9 @@ bool RISCVTargetLowering::lowerInterleavedVPLoad(
455455
XLenTy);
456456

457457
Value *Return = nullptr;
458-
if (auto *FVTy = dyn_cast<FixedVectorType>(VTy)) {
458+
if (isa<FixedVectorType>(VTy)) {
459459
Return = Builder.CreateIntrinsic(FixedVlsegIntrIds[Factor - 2],
460-
{FVTy, PtrTy, XLenTy},
460+
{VTy, PtrTy, XLenTy},
461461
{Load->getArgOperand(0), Mask, EVL});
462462
} else {
463463
unsigned SEW = DL.getTypeSizeInBits(VTy->getElementType());
@@ -563,11 +563,11 @@ bool RISCVTargetLowering::lowerInterleavedVPStore(
563563
Builder.CreateUDiv(WideEVL, ConstantInt::get(WideEVL->getType(), Factor)),
564564
XLenTy);
565565

566-
if (auto *FVTy = dyn_cast<FixedVectorType>(VTy)) {
566+
if (isa<FixedVectorType>(VTy)) {
567567
SmallVector<Value *, 8> Operands(InterleaveOperands);
568568
Operands.append({Store->getArgOperand(1), Mask, EVL});
569569
Builder.CreateIntrinsic(FixedVssegIntrIds[Factor - 2],
570-
{FVTy, PtrTy, XLenTy}, Operands);
570+
{VTy, PtrTy, XLenTy}, Operands);
571571
return true;
572572
}
573573

0 commit comments

Comments
 (0)