Skip to content

Commit f309fab

Browse files
authored
[RISCV][GISel] Fix legalizer of G_INSERT_SUBVECTOR (#171091)
Fix early exit condition and use the right type as mask type of vslideup.
1 parent b3a5ad1 commit f309fab

File tree

2 files changed

+276
-50
lines changed

2 files changed

+276
-50
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ bool RISCVLegalizerInfo::legalizeInsertSubvector(MachineInstr &MI,
12401240
LLT BigTy = MRI.getType(BigVec);
12411241
LLT LitTy = MRI.getType(LitVec);
12421242

1243-
if (Idx == 0 ||
1243+
if (Idx == 0 &&
12441244
MRI.getVRegDef(BigVec)->getOpcode() == TargetOpcode::G_IMPLICIT_DEF)
12451245
return true;
12461246

@@ -1314,7 +1314,7 @@ bool RISCVLegalizerInfo::legalizeInsertSubvector(MachineInstr &MI,
13141314
auto Insert = MIB.buildInsertSubvector(InterLitTy, MIB.buildUndef(InterLitTy),
13151315
LitVec, 0);
13161316

1317-
auto [Mask, _] = buildDefaultVLOps(BigTy, MIB, MRI);
1317+
auto [Mask, _] = buildDefaultVLOps(InterLitTy, MIB, MRI);
13181318
auto VL = MIB.buildVScale(XLenTy, LitTy.getElementCount().getKnownMinValue());
13191319

13201320
// If we're inserting into the lowest elements, use a tail undisturbed

0 commit comments

Comments
 (0)