[PATCH] D21053: IR: New representation for CFI and virtual call optimization pass metadata.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 20:02:00 PDT 2016
pcc created this revision.
pcc added reviewers: mehdi_amini, kcc.
pcc added a subscriber: llvm-commits.
pcc added a dependency: D21052: IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals..
Herald added a subscriber: mehdi_amini.
The bitset metadata currently used in LLVM has a few problems:
1. It has the wrong name. The name "bitset" refers to an implementation
detail of one use of the metadata (i.e. its original use case, CFI).
This makes it harder to understand, as the name makes no sense in the
context of virtual call optimization.
2. It is represented using a global named metadata node, rather than
being directly associated with a global. This makes it harder to
manipulate the metadata when rebuilding global variables, summarise it
as part of ThinLTO and drop unused metadata when associated globals are
dropped. For this reason, CFI does not currently work correctly when
both CFI and vcall opt are enabled, as vcall opt needs to rebuild vtable
globals, and fails to associate metadata with the rebuilt globals. As I
understand it, the same problem could also affect ASan, which rebuilds
globals with a red zone.
This patch solves both of those problems in the following way:
1. Rename the metadata to "type metadata". This new name reflects how
the metadata is currently being used (i.e. to represent type information
for CFI and vtable opt). The new name is reflected in the name for the
associated intrinsic (llvm.type.test) and pass (LowerTypeTests).
2. Attach metadata directly to the globals that it pertains to, rather
than using the "llvm.bitsets" global metadata node as we are doing now.
This is done using the newly introduced capability to attach
metadata to global variables (r271348 and r271358).
See also: http://lists.llvm.org/pipermail/llvm-dev/2016-June/100462.html
Depends on D21052
http://reviews.llvm.org/D21053
Files:
docs/BitSets.rst
docs/LangRef.rst
docs/TypeMetadata.rst
docs/index.rst
include/llvm/Analysis/BitSetUtils.h
include/llvm/Analysis/TypeMetadataUtils.h
include/llvm/IR/GlobalObject.h
include/llvm/IR/Intrinsics.td
include/llvm/IR/LLVMContext.h
include/llvm/InitializePasses.h
include/llvm/Transforms/IPO.h
include/llvm/Transforms/IPO/LowerBitSets.h
include/llvm/Transforms/IPO/LowerTypeTests.h
include/llvm/Transforms/IPO/WholeProgramDevirt.h
lib/Analysis/BitSetUtils.cpp
lib/Analysis/CMakeLists.txt
lib/Analysis/TypeMetadataUtils.cpp
lib/IR/LLVMContext.cpp
lib/IR/Metadata.cpp
lib/IR/Verifier.cpp
lib/Linker/IRMover.cpp
lib/Transforms/IPO/CMakeLists.txt
lib/Transforms/IPO/CrossDSOCFI.cpp
lib/Transforms/IPO/IPO.cpp
lib/Transforms/IPO/LowerBitSets.cpp
lib/Transforms/IPO/LowerTypeTests.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/IPO/WholeProgramDevirt.cpp
test/Transforms/CrossDSOCFI/basic.ll
test/Transforms/LowerBitSets/constant.ll
test/Transforms/LowerBitSets/function-ext.ll
test/Transforms/LowerBitSets/function.ll
test/Transforms/LowerBitSets/layout.ll
test/Transforms/LowerBitSets/nonglobal.ll
test/Transforms/LowerBitSets/nonstring.ll
test/Transforms/LowerBitSets/pr25902.ll
test/Transforms/LowerBitSets/section.ll
test/Transforms/LowerBitSets/simple.ll
test/Transforms/LowerBitSets/single-offset.ll
test/Transforms/LowerBitSets/unnamed.ll
test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
test/Transforms/WholeProgramDevirt/constant-arg.ll
test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
test/Transforms/WholeProgramDevirt/non-array-vtable.ll
test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
test/Transforms/WholeProgramDevirt/uniform-retval.ll
test/Transforms/WholeProgramDevirt/unique-retval.ll
test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
test/Transforms/WholeProgramDevirt/vcp-no-this.ll
test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
test/tools/gold/X86/opt-level.ll
unittests/Transforms/IPO/CMakeLists.txt
unittests/Transforms/IPO/LowerBitSets.cpp
unittests/Transforms/IPO/LowerTypeTests.cpp
unittests/Transforms/IPO/WholeProgramDevirt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21053.59820.patch
Type: text/x-patch
Size: 140211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160607/9b93fa40/attachment.bin>
More information about the llvm-commits
mailing list