[llvm] cde5e42 - [RISCV][NFC] Get rid of additional unneeded static_cast around RISCVSubtarget

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 06:39:03 PDT 2023


Author: Alex Bradbury
Date: 2023-07-20T14:37:58+01:00
New Revision: cde5e4281b097404a879e2592cf41d0cec138715

URL: https://github.com/llvm/llvm-project/commit/cde5e4281b097404a879e2592cf41d0cec138715
DIFF: https://github.com/llvm/llvm-project/commit/cde5e4281b097404a879e2592cf41d0cec138715.diff

LOG: [RISCV][NFC] Get rid of additional unneeded static_cast around RISCVSubtarget

Some similar cases to 60152f1983336e709.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
    llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
    llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp b/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
index 967df35b4c4479..59f1e8319ae72e 100644
--- a/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
+++ b/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
@@ -72,7 +72,7 @@ class RISCVExpandAtomicPseudo : public MachineFunctionPass {
 char RISCVExpandAtomicPseudo::ID = 0;
 
 bool RISCVExpandAtomicPseudo::runOnMachineFunction(MachineFunction &MF) {
-  TII = static_cast<const RISCVInstrInfo *>(MF.getSubtarget().getInstrInfo());
+  TII = MF.getSubtarget<RISCVSubtarget>().getInstrInfo();
 
 #ifndef NDEBUG
   const unsigned OldSize = getInstSizeInBytes(MF);

diff  --git a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
index 6bb388f8e22223..6073d95c800ae8 100644
--- a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
+++ b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
@@ -394,7 +394,7 @@ class RISCVPreRAExpandPseudo : public MachineFunctionPass {
 char RISCVPreRAExpandPseudo::ID = 0;
 
 bool RISCVPreRAExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
-  TII = static_cast<const RISCVInstrInfo *>(MF.getSubtarget().getInstrInfo());
+  TII = MF.getSubtarget<RISCVSubtarget>().getInstrInfo();
 
 #ifndef NDEBUG
   const unsigned OldSize = getInstSizeInBytes(MF);

diff  --git a/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp
index 5eb990f19562f7..a93e750eadc6fa 100644
--- a/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp
@@ -121,7 +121,7 @@ bool RISCVPushPopOpt::runOnMachineFunction(MachineFunction &Fn) {
   if (Fn.getTarget().Options.DisableFramePointerElim(Fn))
     return false;
 
-  TII = static_cast<const RISCVInstrInfo *>(Subtarget->getInstrInfo());
+  TII = Subtarget->getInstrInfo();
   TRI = Subtarget->getRegisterInfo();
   // Resize the modified and used register unit trackers.  We do this once
   // per function and then clear the register units each time we determine


        


More information about the llvm-commits mailing list