-
Notifications
You must be signed in to change notification settings - Fork 15k
[BOLT] Remove CreatePastEnd parameter in getOrCreateLocalLabel(). NFC #165065
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CreatePastEnd parameter had no effect on the label creation. Remove it.
|
@llvm/pr-subscribers-bolt Author: Maksim Panchenko (maksfb) ChangesCreatePastEnd parameter had no effect on the label creation. Remove it. Full diff: https://github.com/llvm/llvm-project/pull/165065.diff 3 Files Affected:
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index f5e9887b56f70..163f883c9ed25 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -620,13 +620,11 @@ class BinaryFunction {
}
/// Return a label at a given \p Address in the function. If the label does
- /// not exist - create it. Assert if the \p Address does not belong to
- /// the function. If \p CreatePastEnd is true, then return the function
- /// end label when the \p Address points immediately past the last byte
- /// of the function.
+ /// not exist - create it.
+ ///
/// NOTE: the function always returns a local (temp) symbol, even if there's
/// a global symbol that corresponds to an entry at this address.
- MCSymbol *getOrCreateLocalLabel(uint64_t Address, bool CreatePastEnd = false);
+ MCSymbol *getOrCreateLocalLabel(uint64_t Address);
/// Register an data entry at a given \p Offset into the function.
void markDataAtOffset(uint64_t Offset) {
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index 96878925eccad..f91454f892f2f 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -1035,13 +1035,9 @@ BinaryFunction::processIndirectBranch(MCInst &Instruction, unsigned Size,
return BranchType;
}
-MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
- bool CreatePastEnd) {
+MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address) {
const uint64_t Offset = Address - getAddress();
- if ((Offset == getSize()) && CreatePastEnd)
- return getFunctionEndLabel();
-
auto LI = Labels.find(Offset);
if (LI != Labels.end())
return LI->second;
@@ -1052,6 +1048,9 @@ MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
return IslandSym;
}
+ if (Offset == getSize())
+ return getFunctionEndLabel();
+
MCSymbol *Label = BC.Ctx->createNamedTempSymbol();
Labels[Offset] = Label;
@@ -1995,7 +1994,7 @@ void BinaryFunction::postProcessJumpTables() {
if (IsBuiltinUnreachable) {
BinaryFunction *TargetBF = BC.getBinaryFunctionAtAddress(EntryAddress);
MCSymbol *Label = TargetBF ? TargetBF->getSymbol()
- : getOrCreateLocalLabel(EntryAddress, true);
+ : getOrCreateLocalLabel(EntryAddress);
JT.Entries.push_back(Label);
continue;
}
@@ -2006,7 +2005,7 @@ void BinaryFunction::postProcessJumpTables() {
BC.getBinaryFunctionContainingAddress(EntryAddress);
MCSymbol *Label;
if (HasOneParent && TargetBF == this) {
- Label = getOrCreateLocalLabel(EntryAddress, true);
+ Label = getOrCreateLocalLabel(EntryAddress);
} else {
const uint64_t Offset = EntryAddress - TargetBF->getAddress();
Label = Offset ? TargetBF->addEntryPointAtOffset(Offset)
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index c428828956ca0..b7897837b0417 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2942,9 +2942,7 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
ReferencedSymbol =
ReferencedBF->addEntryPointAtOffset(RefFunctionOffset);
} else {
- ReferencedSymbol =
- ReferencedBF->getOrCreateLocalLabel(Address,
- /*CreatePastEnd =*/true);
+ ReferencedSymbol = ReferencedBF->getOrCreateLocalLabel(Address);
// If ContainingBF != nullptr, it equals ReferencedBF (see
// if-condition above) so we're handling a relocation from a function
|
yozhu
approved these changes
Oct 25, 2025
paschalis-mpeis
approved these changes
Oct 25, 2025
varun-r-mallya
pushed a commit
to varun-r-mallya/llvm-project
that referenced
this pull request
Oct 27, 2025
…llvm#165065) CreatePastEnd parameter had no effect on the label creation. Remove it.
dvbuka
pushed a commit
to dvbuka/llvm-project
that referenced
this pull request
Oct 27, 2025
…llvm#165065) CreatePastEnd parameter had no effect on the label creation. Remove it.
Lukacma
pushed a commit
to Lukacma/llvm-project
that referenced
this pull request
Oct 29, 2025
…llvm#165065) CreatePastEnd parameter had no effect on the label creation. Remove it.
aokblast
pushed a commit
to aokblast/llvm-project
that referenced
this pull request
Oct 30, 2025
…llvm#165065) CreatePastEnd parameter had no effect on the label creation. Remove it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CreatePastEnd parameter had no effect on the label creation. Remove it.