Skip to content

Commit f28442a

Browse files
committed
OpsMapping[1] is always GPR; use getFixedValue when type is not vector
1 parent 1957eeb commit f28442a

File tree

3 files changed

+353
-184
lines changed

3 files changed

+353
-184
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,15 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
311311
case TargetOpcode::G_LOAD: {
312312
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
313313
TypeSize Size = Ty.getSizeInBits();
314-
if (Ty.isVector()) {
314+
if (Ty.isVector())
315315
OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
316-
OpdsMapping[1] = getVRBValueMapping(Size.getKnownMinValue());
317-
} else {
316+
else
318317
OpdsMapping[0] = GPRValueMapping;
319-
OpdsMapping[1] = GPRValueMapping;
320-
}
318+
319+
OpdsMapping[1] = GPRValueMapping;
321320
// Use FPR64 for s64 loads on rv32.
322321
if (!Ty.isVector() && GPRSize == 32 &&
323-
Ty.getSizeInBits().getKnownMinValue() == 64) {
322+
Ty.getSizeInBits().getFixedValue() == 64) {
324323
assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());
325324
OpdsMapping[0] = getFPValueMapping(Ty.getSizeInBits());
326325
break;
@@ -341,17 +340,15 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
341340
case TargetOpcode::G_STORE: {
342341
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
343342
TypeSize Size = Ty.getSizeInBits();
344-
if (Ty.isVector()) {
343+
if (Ty.isVector())
345344
OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
346-
OpdsMapping[1] = getVRBValueMapping(Size.getKnownMinValue());
347-
} else {
345+
else
348346
OpdsMapping[0] = GPRValueMapping;
349-
OpdsMapping[1] = GPRValueMapping;
350-
}
351347

348+
OpdsMapping[1] = GPRValueMapping;
352349
// Use FPR64 for s64 stores on rv32.
353350
if (!Ty.isVector() && GPRSize == 32 &&
354-
Ty.getSizeInBits().getKnownMinValue() == 64) {
351+
Ty.getSizeInBits().getFixedValue() == 64) {
355352
assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());
356353
OpdsMapping[0] = getFPValueMapping(Ty.getSizeInBits());
357354
break;

0 commit comments

Comments
 (0)