[llvm] MC: Simplify fragment reuse determination (PR #149471)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 09:36:17 PDT 2025
================
@@ -106,26 +106,18 @@ void MCObjectStreamer::emitFrames(MCAsmBackend *MAB) {
MCDwarfFrameEmitter::Emit(*this, MAB, false);
}
-static bool canReuseDataFragment(const MCFragment &F,
- const MCAssembler &Assembler,
- const MCSubtargetInfo *STI) {
+static bool canReuseDataFragment(const MCFragment &F) {
if (!F.hasInstructions())
return true;
// Do not add data after a linker-relaxable instruction. The difference
// between a new label and a label at or before the linker-relaxable
// instruction cannot be resolved at assemble-time.
- if (F.isLinkerRelaxable())
- return false;
- // If the subtarget is changed mid fragment we start a new fragment to record
- // the new STI.
- return !STI || F.getSubtargetInfo() == STI;
+ return !F.isLinkerRelaxable();
----------------
MaskRay wrote:
Thanks for pointing this out. Just made setLinkerRelaxable eagerly allocate a new fragment so that we don't need to check it here.
https://github.com/llvm/llvm-project/pull/149471
More information about the llvm-commits
mailing list