[PATCH] D134099: [RFC][BOLT] Create an independent namespace for jump tables

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 18:42:49 PDT 2022


rafauler created this revision.
rafauler added a reviewer: bolt.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
rafauler requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Make jump tables inaccessible via our global symbol
table. Make jump table symbols only accessible via
BinaryContext::getOrCreateJumpTable(), called by our jump table
recognition heuristics. In practice, this means that any data access
in code will not reference a jump table, unless disassembly/cfg
analysis explictly recognize the code fragment as accessing a jump
table.

This solves bugs related to regular data references in code
accidentally being bound to a jump table, and this reference being
updated to a new (incorrect) location because we moved this jump
table.

An alternative solution to this would be to honor the connection of
JumpTable objects with their respective BinaryData entries (in the
global symbol table). To make this consistent, we would further need
to change jump table emission to emit all labels in BinaryData at that
location whenever emitting a jump table. Currently, this is
inconsistent and jump tables are poorly synced with the global symbol
table. This solution is more complicated than severing the connection
between jump table and the global symbols (do not publish a jump table
in our global symbol table), and will also lead to less functions
being processed (albeit this number should be small).

Fixes #55004


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134099

Files:
  bolt/include/bolt/Core/BinaryContext.h
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryFunction.cpp
  bolt/lib/Passes/IdenticalCodeFolding.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/DataReader.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/X86/split-func-jump-table-fragment-bidirection.s
  bolt/test/runtime/X86/jt-symbol-disambiguation.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134099.460956.patch
Type: text/x-patch
Size: 11015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220917/202d4dbc/attachment.bin>


More information about the llvm-commits mailing list