[llvm] MC: Store fragment content and fixups out-of-line (PR #146307)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 29 22:46:04 PDT 2025


================
@@ -398,10 +392,9 @@ void MCObjectStreamer::emitInstToData(const MCInst &Inst,
   getAssembler().getEmitter().encodeInstruction(Inst, Code, Fixups, STI);
 
   auto CodeOffset = DF->getContents().size();
-  for (MCFixup &Fixup : Fixups) {
+  for (MCFixup &Fixup : Fixups)
     Fixup.setOffset(Fixup.getOffset() + CodeOffset);
-    DF->addFixup(Fixup);
-  }
+  DF->appendFixups(Fixups);
----------------
aengelke wrote:

Check if Fixups is not empty? Most instructions don't have fixups, so we can avoid an out-of-line call in these cases.

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


More information about the llvm-commits mailing list