This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Allow function entry to be a cold fragment
ClosedPublic

Authored by nhuhuan on Jun 17 2022, 5:49 PM.

Details

Summary

Allow cold fragment to get new address.

Our previous assumption is that a fragment (.cold) is only reached
through the main fragment of same function. In addition, .cold fragment
must be reached through either (a) direct transfer, or (b) split jump
table. For (a), we perform a simple fix-up. For (b), we currently mark
all relevant fragments as non-simple. Therefore, there is no need to
get new address for .cold fragment.

This is not always the case, as function entry can be rarely executed,
and is placed in .text.cold segment. Essentially we cannot tell which
the source-level function entry is based on hot and cold segments,
so we must treat each fragment a function on its own. Therfore, we
remove the assertion that a function entry cannot be cold fragment.

Test Plan:

ninja check-bolt

Diff Detail

Event Timeline

nhuhuan created this revision.Jun 17 2022, 5:49 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
nhuhuan requested review of this revision.Jun 17 2022, 5:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 5:49 PM
Amir accepted this revision.Jun 17 2022, 5:54 PM

Looking good with one minor nit.

bolt/test/X86/shared_object_entry.s
3

Please split it up into multiple lines to fit into 80 characters

This revision is now accepted and ready to land.Jun 17 2022, 5:54 PM
nhuhuan edited the summary of this revision. (Show Details)Jun 17 2022, 5:55 PM
nhuhuan updated this revision to Diff 438081.Jun 17 2022, 6:15 PM

Split long command line

nhuhuan updated this revision to Diff 438093.Jun 17 2022, 8:16 PM
nhuhuan marked an inline comment as done.

Improve robustness of test case

This revision was landed with ongoing or failed builds.Jun 18 2022, 11:40 AM
This revision was automatically updated to reflect the committed changes.