Skip to content

Commit 3ecefba

Browse files
committed
MC: Restore emitInstToData optimization
Accidentally dropped by f36ce53
1 parent 2b8696b commit 3ecefba

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,19 @@ void MCObjectStreamer::emitInstToData(const MCInst &Inst,
435435
bool MarkedLinkerRelaxable = false;
436436
for (auto &Fixup : Fixups) {
437437
Fixup.setOffset(Fixup.getOffset() + CodeOffset);
438-
if (!Fixup.isLinkerRelaxable())
438+
if (!Fixup.isLinkerRelaxable() || MarkedLinkerRelaxable)
439439
continue;
440-
F->setLinkerRelaxable();
440+
MarkedLinkerRelaxable = true;
441+
// Set the fragment's order within the subsection for use by
442+
// MCAssembler::relaxAlign.
443+
auto *Sec = F->getParent();
444+
if (!Sec->isLinkerRelaxable())
445+
Sec->setLinkerRelaxable();
441446
// Do not add data after a linker-relaxable instruction. The difference
442447
// between a new label and a label at or before the linker-relaxable
443448
// instruction cannot be resolved at assemble-time.
444-
if (!MarkedLinkerRelaxable) {
445-
MarkedLinkerRelaxable = true;
446-
getCurrentSectionOnly()->setLinkerRelaxable();
447-
newFragment();
448-
}
449+
F->setLinkerRelaxable();
450+
newFragment();
449451
}
450452
F->appendFixups(Fixups);
451453
}

0 commit comments

Comments
 (0)