[PATCH] D50754: Implementation of a vtable interleaving algorithm

Zhaomo Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 17:05:47 PDT 2019


zhaomo updated this revision to Diff 221141.
zhaomo added a comment.

This patch fixed a few bugs that can be triggered by some corner cases involved with virtual inheritance.

I tested the implementation with the Android and the Linux versions of Chromium, and SPEC 2006.

For the Android version of Chromium, this implementation introduces about 2.5% code bloat overhead (baseline: full LTO, O1 <https://reviews.llvm.org/owners/package/1/> for LTO, CFI-VCall disabled). In comparison, the upstream LLVM CFI-VCall introduces about 5.5%.

Currently this passes relies on offset global variables and calls to llvm.type.test to determine the set of types that are subject to vtable interleaving. If we have a way to do so without using calls to llvm.type.test, we can decouple this pass and CFI, making it a more independent optimization pass.

Because the offset global variables captures all the vtable accesses to the vtables subject to interleaving, this pass can remove unused vtable entries. Similarly, we could use offset global variables to remove unused virtual member functions. I wrote a separate pass for this and it works quite well.


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

https://reviews.llvm.org/D50754

Files:
  llvm/include/llvm/IR/FixedMetadataKinds.def
  llvm/include/llvm/IR/GlobalObject.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/IPO.h
  llvm/include/llvm/Transforms/IPO/InterleaveVTables.h
  llvm/lib/IR/Metadata.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/CMakeLists.txt
  llvm/lib/Transforms/IPO/GlobalSplit.cpp
  llvm/lib/Transforms/IPO/IPO.cpp
  llvm/lib/Transforms/IPO/InterleaveVTables.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/test/ThinLTO/X86/lazyload_metadata.ll
  llvm/test/Transforms/InterleaveVTables/basic.ll
  llvm/test/Transforms/InterleaveVTables/incomplete.ll
  llvm/test/Transforms/InterleaveVTables/vbase.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50754.221141.patch
Type: text/x-patch
Size: 73670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190921/9f23d874/attachment.bin>


More information about the llvm-commits mailing list