[llvm] [RISCV] Use cached SubtargetInfo in AsmPrinter (PR #147269)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 03:31:44 PDT 2025


================
@@ -1070,22 +1066,17 @@ bool RISCVAsmPrinter::lowerOperand(const MachineOperand &MO,
 }
 
 static bool lowerRISCVVMachineInstrToMCInst(const MachineInstr *MI,
-                                            MCInst &OutMI) {
+                                            MCInst &OutMI,
+                                            const RISCVSubtarget *STI) {
   const RISCVVPseudosTable::PseudoInfo *RVV =
       RISCVVPseudosTable::getPseudoInfo(MI->getOpcode());
   if (!RVV)
     return false;
 
   OutMI.setOpcode(RVV->BaseInstr);
 
-  const MachineBasicBlock *MBB = MI->getParent();
-  assert(MBB && "MI expected to be in a basic block");
-  const MachineFunction *MF = MBB->getParent();
-  assert(MF && "MBB expected to be in a machine function");
----------------
lukel97 wrote:

I'm not sure if the asserts were that useful to begin with. It looks like we previously only used MBB and MF to get the SubtargetInfo?

https://github.com/llvm/llvm-project/pull/147269


More information about the llvm-commits mailing list