[llvm] a1ba4fb - [RISCV][GISel] Slightly simplify the regbank selection for G_LOAD/STORE. NFC (#101431)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 19:01:49 PDT 2024
Author: Craig Topper
Date: 2024-07-31T19:01:45-07:00
New Revision: a1ba4fb4516a33bd61b8219e2fc46ba3c1787460
URL: https://github.com/llvm/llvm-project/commit/a1ba4fb4516a33bd61b8219e2fc46ba3c1787460
DIFF: https://github.com/llvm/llvm-project/commit/a1ba4fb4516a33bd61b8219e2fc46ba3c1787460.diff
LOG: [RISCV][GISel] Slightly simplify the regbank selection for G_LOAD/STORE. NFC (#101431)
Merge the isVector early out with the previous check for isVector.
Added:
Modified:
llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
index 2b1df0cd4670a..5369be24f0e7c 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
@@ -311,15 +311,16 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
case TargetOpcode::G_LOAD: {
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
TypeSize Size = Ty.getSizeInBits();
- if (Ty.isVector())
- OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
- else
- OpdsMapping[0] = GPRValueMapping;
OpdsMapping[1] = GPRValueMapping;
- if (Ty.isVector())
+ if (Ty.isVector()) {
+ OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
break;
+ }
+
+ OpdsMapping[0] = GPRValueMapping;
+
// Use FPR64 for s64 loads on rv32.
if (GPRSize == 32 && Size.getFixedValue() == 64) {
assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());
@@ -342,15 +343,15 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
case TargetOpcode::G_STORE: {
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
TypeSize Size = Ty.getSizeInBits();
- if (Ty.isVector())
- OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
- else
- OpdsMapping[0] = GPRValueMapping;
OpdsMapping[1] = GPRValueMapping;
- if (Ty.isVector())
+ if (Ty.isVector()) {
+ OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
break;
+ }
+
+ OpdsMapping[0] = GPRValueMapping;
// Use FPR64 for s64 stores on rv32.
if (GPRSize == 32 && Size.getFixedValue() == 64) {
More information about the llvm-commits
mailing list