[PATCH] D130673: [BOLT] Handle jump tables that point to skipped functions

Huan Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 22:23:02 PDT 2022


nhuhuan updated this revision to Diff 448512.
nhuhuan added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130673/new/

https://reviews.llvm.org/D130673

Files:
  bolt/lib/Core/BinaryFunction.cpp


Index: bolt/lib/Core/BinaryFunction.cpp
===================================================================
--- bolt/lib/Core/BinaryFunction.cpp
+++ bolt/lib/Core/BinaryFunction.cpp
@@ -1667,12 +1667,23 @@
             break;
           }
         }
+
         if (IsBuiltIn)
           continue;
-        // Create local label for targets cannot be reached by other fragments
-        // Otherwise, secondary entry point to target function
+
+        // Functions can be optionally skipped by users, or marked as ignored
+        // during branch target analysis. Since the target function is not
+        // processed, functions that access jump tables which point to these
+        // target functions also need to be marked as ignored
         BinaryFunction *TargetBF =
             BC.getBinaryFunctionContainingAddress(EntryAddress);
+        if (TargetBF->getState() != BinaryFunction::State::Disassembled ||
+            TargetBF->isIgnored()) {
+          setIgnored();
+          return;
+        }
+        // Create local label for targets cannot be reached by other fragments
+        // Otherwise, register as a secondary entry point to target function
         if (TargetBF->getAddress() != EntryAddress) {
           MCSymbol *Label =
               (HasOneParent && TargetBF == this)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130673.448512.patch
Type: text/x-patch
Size: 1302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220729/1de637af/attachment.bin>


More information about the llvm-commits mailing list