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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 03:26:45 PDT 2025


================
@@ -517,12 +516,9 @@ void RISCVAsmPrinter::emitSled(const MachineInstr *MI, SledKind Kind) {
   // Assuming we're using JAL to jump to .tmpN, then we only need
   // (68 - 4)/2 = 32 NOPs for RV64 and (44 - 4)/2 = 20 for RV32. However, there
   // is a chance that we'll use C.JAL instead, so an additional NOP is needed.
-  const uint8_t NoopsInSledCount =
-      MI->getParent()->getParent()->getSubtarget<RISCVSubtarget>().is64Bit()
-          ? 33
-          : 21;
+  const uint8_t NoopsInSledCount = STI->is64Bit() ? 33 : 21;
 
-  OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
----------------
artagnon wrote:

Is getSubtargetInfo() unused now? Can it be stripped?

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


More information about the llvm-commits mailing list