[llvm] [X86] Reimplement bundle alignment mode (PR #175830)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 08:56:46 PST 2026


================
@@ -402,6 +402,23 @@ void MCObjectStreamer::emitInstruction(const MCInst &Inst,
   // If this instruction doesn't need relaxation, just emit it as data.
   MCAssembler &Assembler = getAssembler();
   MCAsmBackend &Backend = Assembler.getBackend();
+
+  // To enable better bundle-nop optimization, we emits every instruction
+  // as a relaxable fragment.
+  if (Assembler.isBundlingEnabled()) {
+    if (Sec->isBundleLocked() || Assembler.getRelaxAll()) {
+      // Is there any benefit if locked instructions are relax later.
+      MCInst Relaxed = Inst;
----------------
aengelke wrote:

Why copy?

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


More information about the llvm-commits mailing list