[PATCH] D128474: [BOLT] Support multiple parents for split jump table

Huan Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 23:52:56 PDT 2022


nhuhuan added inline comments.


================
Comment at: bolt/lib/Core/BinaryFunction.cpp:1689
+      uint64_t RelativeOffset = AbsoluteOffset - getAddress();
+      if (RelativeOffset < getSize()) {
+        TakenBranches.emplace_back(JTSiteOffset, RelativeOffset);
----------------
This is a side note. BOLT made two assumptions:
a. Jump table entries are always unsigned int.
b. Jump table entries are arranged moving forward from Jump table base.

It's very often in real-world binaries to use movsl/movsx instead of movzl/movzx,
which seem to suggests against (a). But it is rare to see cases violate (b) from my
experience.

Now keeping (a), it is messy when OffsetEntries point to another fragment whose
appear prior to current function. It will be integer overflow, and this is inconsistent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128474



More information about the llvm-commits mailing list