[llvm] [RISCV] Simplify interface of RISCVAsmPrinter::lowerToMCInst [nfc] (PR #156482)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 12:10:46 PDT 2025


================
@@ -329,12 +329,16 @@ void RISCVAsmPrinter::emitInstruction(const MachineInstr *MI) {
   case TargetOpcode::STATEPOINT:
     return LowerSTATEPOINT(*OutStreamer, SM, *MI);
   case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
-    // patchable-function-entry is handled in lowerToMCInst
-    // Therefore, we break out of the switch statement if we encounter it here.
     const Function &F = MI->getParent()->getParent()->getFunction();
-    if (F.hasFnAttribute("patchable-function-entry"))
-      break;
-
+    if (F.hasFnAttribute("patchable-function-entry")) {
+      unsigned Num;
+      assert(!F.getFnAttribute("patchable-function-entry")
+                  .getValueAsString()
+                  .getAsInteger(10, Num) &&
+             "Enforced by the verified");
+      emitNops(Num);
----------------
preames wrote:

Gah, you're right, that was really dump.  Fix forthcoming.

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


More information about the llvm-commits mailing list