[PATCH] D22295: Introduce !splitpoint metadata and GlobalSplit pass.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 19:46:32 PDT 2016


pcc created this revision.
pcc added a reviewer: eugenis.
pcc added subscribers: llvm-commits, krasin.
Herald added a subscriber: mehdi_amini.

Each split point specifies a byte offset within the global, and acts as a
promise that no pointer derived from a constant-offset reference to the global
will cross the boundary of a split point. The metadata allows the optimizer
to split a global variable at split points if possible and beneficial.
Under the Itanium C++ ABI, Clang will attach split points at each boundary
between virtual tables in a virtual table group.

A virtual table split is possible if it has local linkage. This guarantees
that nothing outside of the module can reference the virtual table group
directly. Typically, when LTO is used, the linker is able to internalize
most virtual tables.

A split is beneficial if either of the whole-program devirtualization or
control flow integrity features are being used. In the former case, under
virtual constant propagation we are able to place propagated constants
directly in front of virtual tables of classes with multiple bases. In the
latter case, we can arrange virtual tables with multiple bases in a more
hierarchical order, which reduces the required amount of runtime data and
simplifies the required checks.

http://reviews.llvm.org/D22295

Files:
  docs/LangRef.rst
  include/llvm/IR/LLVMContext.h
  include/llvm/InitializePasses.h
  include/llvm/Transforms/IPO.h
  lib/IR/LLVMContext.cpp
  lib/Transforms/IPO/CMakeLists.txt
  lib/Transforms/IPO/GlobalSplit.cpp
  lib/Transforms/IPO/IPO.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  test/Transforms/GlobalSplit/basic.ll
  test/Transforms/GlobalSplit/invalid-offset.ll
  test/Transforms/GlobalSplit/non-beneficial.ll
  test/Transforms/GlobalSplit/nonlocal.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22295.63773.patch
Type: text/x-patch
Size: 17231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160713/31cdc4ab/attachment-0001.bin>


More information about the llvm-commits mailing list