Skip to content

Conversation

@aaupov
Copy link
Contributor

@aaupov aaupov commented Apr 29, 2024

This change speeds up fragment matching for large BOLTed binaries where
all fragments of global parent functions are put under bolt-pseudo.o
file symbol:

  • before: iterating over symbols under bolt-pseudo.o only to fail
    to find a parent,
  • after: bail out immediately and use a global parent by name.

Test Plan: NFC, updated register-fragments-bolt-symbols.s

aaupov added 2 commits April 28, 2024 21:04
Created using spr 1.3.5
@llvmbot
Copy link
Member

llvmbot commented Apr 29, 2024

@llvm/pr-subscribers-llvm-binary-utilities

@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)

Changes

There should be no functional change, only faster fragment matching for
large BOLTed binaries where all fragments of global parent functions
are put under bolt-pseudo.o file symbol.

Test Plan: NFC


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

1 Files Affected:

  • (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+5)
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 8eb2e5a9d9120a..d92775e16b7cf1 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1511,6 +1511,11 @@ void RewriteInstance::registerFragments() {
 
     uint64_t ParentAddress{0};
 
+    // Check if containing FILE symbol is BOLT emitted synthetic symbol marking
+    // local fragments of global parents.
+    if (cantFail(FSI[-1].getName()) == getBOLTFileSymbolName())
+      goto registerParent;
+
     // BOLT split fragment symbols are emitted just before the main function
     // symbol.
     for (ELFSymbolRef NextSymbol = Symbol; NextSymbol < StopSymbol;

aaupov added 2 commits April 29, 2024 16:27
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
@aaupov aaupov changed the base branch from users/spr/aaupov/main.boltnfci-use-heuristic-for-matching-split-global-functions to main May 8, 2024 20:53
@aaupov aaupov force-pushed the users/spr/aaupov/boltnfci-use-heuristic-for-matching-split-global-functions branch from f94b275 to 72bf9f9 Compare May 8, 2024 20:59
@aaupov aaupov changed the base branch from main to users/spr/aaupov/main.boltnfci-use-heuristic-for-matching-split-global-functions May 8, 2024 21:00
@aaupov aaupov changed the base branch from users/spr/aaupov/main.boltnfci-use-heuristic-for-matching-split-global-functions to main May 24, 2024 21:38
@aaupov aaupov changed the base branch from main to users/spr/aaupov/main.boltnfci-use-heuristic-for-matching-split-global-functions May 24, 2024 21:38
Copy link
Contributor

@rafaelauler rafaelauler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

topperc and others added 2 commits June 20, 2025 10:57
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
@aaupov aaupov changed the base branch from users/spr/aaupov/main.boltnfci-use-heuristic-for-matching-split-global-functions to main June 20, 2025 17:58
Created using spr 1.3.4
@aaupov aaupov merged commit 4959e8a into main Jun 20, 2025
7 checks passed
@aaupov aaupov deleted the users/spr/aaupov/boltnfci-use-heuristic-for-matching-split-global-functions branch June 20, 2025 19:46
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.

5 participants