[llvm] 60152f1 - [RISCV][NFC] Use templated getSubtarget in RISCVExpandPseudo::runOnMachineFunction

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


Author: Alex Bradbury
Date: 2023-07-20T14:08:41+01:00
New Revision: 60152f1983336e7098f0d28343cc0cf7c92af702

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

LOG: [RISCV][NFC] Use templated getSubtarget in RISCVExpandPseudo::runOnMachineFunction

This avoids a static_cast.

Added: 
    

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

Removed: 
    


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


        


More information about the llvm-commits mailing list