[PATCH] D122098: [BOLT] LongJmp: Check for shouldEmit

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 20 06:14:37 PDT 2022


yota9 created this revision.
yota9 added reviewers: maksfb, rafauler, Amir.
Herald added a subscriber: ayermolo.
Herald added a project: All.
yota9 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Check that the function will be emitted in the final binary. Preserving
old function address is needed in case it is PLT trampiline, that is
currently not moved by the BOLT.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122098

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Passes/LongJmp.cpp


Index: bolt/lib/Passes/LongJmp.cpp
===================================================================
--- bolt/lib/Passes/LongJmp.cpp
+++ bolt/lib/Passes/LongJmp.cpp
@@ -344,6 +344,11 @@
   CurrentIndex = 0;
   bool ColdLayoutDone = false;
   for (BinaryFunction *Func : SortedFunctions) {
+    if (!BC.shouldEmit(*Func)) {
+      HotAddresses[Func] = Func->getAddress();
+      continue;
+    }
+
     if (!ColdLayoutDone && CurrentIndex >= LastHotIndex) {
       DotAddress =
           tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress);
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -1529,6 +1529,9 @@
 }
 
 bool BinaryContext::shouldEmit(const BinaryFunction &Function) const {
+  if (Function.isPseudo())
+    return false;
+
   if (opts::processAllFunctions())
     return true;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122098.416775.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220320/6d3ec5b4/attachment.bin>


More information about the llvm-commits mailing list