Skip to content

[BOLT] Remove workaround for flushPendingLabels #97632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MaskRay
Copy link
Member

@MaskRay MaskRay commented Jul 3, 2024

The code emits an empty MCDataFragment to ensure that the labels are
attached to SplitSection. The workaround, due to the removed
flushPendingLabels mechanism (see
7500646), is now unneeded.

Created using spr 1.3.5-bogner
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2024

@llvm/pr-subscribers-bolt

Author: Fangrui Song (MaskRay)

Changes

The code emits an empty MCDataFragment to ensure that the labels are
attached to SplitSection. The workaround, due to the removed
flushPendingLabels mechanism (see
7500646), is now unneeded.


Full diff: https://github.com/llvm/llvm-project/pull/97632.diff

1 Files Affected:

  • (modified) bolt/lib/Core/BinaryContext.cpp (-8)
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index f28a0cd6eb9c6..0a1f1bb9e0d20 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -2403,16 +2403,8 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
     Streamer->emitLabel(SplitStartLabel);
     emitFunctionBody(*Streamer, BF, FF, /*EmitCodeOnly=*/true);
     Streamer->emitLabel(SplitEndLabel);
-    // To avoid calling MCObjectStreamer::flushPendingLabels() which is
-    // private
-    Streamer->emitBytes(StringRef(""));
-    Streamer->switchSection(Section);
   }
 
-  // To avoid calling MCObjectStreamer::flushPendingLabels() which is private or
-  // MCStreamer::Finish(), which does more than we want
-  Streamer->emitBytes(StringRef(""));
-
   MCAssembler &Assembler =
       static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler();
   Assembler.layout();

@aaupov
Copy link
Contributor

aaupov commented Jul 3, 2024

Testing internally

@MaskRay MaskRay merged commit 4c79fac into main Jul 3, 2024
6 of 7 checks passed
@MaskRay MaskRay deleted the users/MaskRay/spr/bolt-remove-workaround-for-flushpendinglabels branch July 3, 2024 23:40
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
The code emits an empty MCDataFragment to ensure that the labels are
attached to `SplitSection`. The workaround, due to the removed
`flushPendingLabels` mechanism (see
7500646), is now unneeded.

Pull Request: llvm#97632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants