1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/unittests/IR
Reid Kleckner 73e1a13fdc [IR] De-virtualize ~Value to save a vptr
Summary:
Implements PR889

Removing the virtual table pointer from Value saves 1% of RSS when doing
LTO of llc on Linux. The impact on time was positive, but too noisy to
conclusively say that performance improved. Here is a link to the
spreadsheet with the original data:

https://docs.google.com/spreadsheets/d/1F4FHir0qYnV0MEp2sYYp_BuvnJgWlWPhWOwZ6LbW7W4/edit?usp=sharing

This change makes it invalid to directly delete a Value, User, or
Instruction pointer. Instead, such code can be rewritten to a null check
and a call Value::deleteValue(). Value objects tend to have their
lifetimes managed through iplist, so for the most part, this isn't a big
deal.  However, there are some places where LLVM deletes values, and
those places had to be migrated to deleteValue.  I have also created
llvm::unique_value, which has a custom deleter, so it can be used in
place of std::unique_ptr<Value>.

I had to add the "DerivedUser" Deleter escape hatch for MemorySSA, which
derives from User outside of lib/IR. Code in IR cannot include MemorySSA
headers or call the MemoryAccess object destructors without introducing
a circular dependency, so we need some level of indirection.
Unfortunately, no class derived from User may have any virtual methods,
because adding a virtual method would break User::getHungOffOperands(),
which assumes that it can find the use list immediately prior to the
User object. I've added a static_assert to the appropriate OperandTraits
templates to help people avoid this trap.

Reviewers: chandlerc, mehdi_amini, pete, dberlin, george.burgess.iv

Reviewed By: chandlerc

Subscribers: krytarowski, eraman, george.burgess.iv, mzolotukhin, Prazek, nlewycky, hans, inglorion, pcc, tejohnson, dberlin, llvm-commits

Differential Revision: https://reviews.llvm.org/D31261

llvm-svn: 303362
2017-05-18 17:24:10 +00:00
..
AsmWriterTest.cpp
AttributesTest.cpp Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList" 2017-05-02 22:07:37 +00:00
CMakeLists.txt ADT: Split out simple_ilist, a simple intrusive list 2016-08-30 16:23:55 +00:00
ConstantRangeTest.cpp [ConstantRange] Fix what appear to be copy and paste mistakes in the unittest. 2017-05-15 04:40:19 +00:00
ConstantsTest.cpp [IR] De-virtualize ~Value to save a vptr 2017-05-18 17:24:10 +00:00
DebugInfoTest.cpp Formatting with clang-format patch r280700 2016-09-06 17:03:02 +00:00
DebugTypeODRUniquingTest.cpp Formatting with clang-format patch r280700 2016-09-06 17:03:02 +00:00
DominatorTreeTest.cpp [StructurizeCfg] Update dominator info. 2017-01-10 02:50:47 +00:00
FunctionTest.cpp [GlobalObject] Fix setSection("") 2017-02-15 21:42:42 +00:00
InstructionsTest.cpp [IR] De-virtualize ~Value to save a vptr 2017-05-18 17:24:10 +00:00
IntrinsicsTest.cpp
IRBuilderTest.cpp Add support for DW_TAG_thrown_type. 2017-04-26 22:56:44 +00:00
LegacyPassManagerTest.cpp Rename AttributeSet to AttributeList 2017-03-21 16:57:19 +00:00
MDBuilderTest.cpp
MetadataTest.cpp [IR] De-virtualize ~Value to save a vptr 2017-05-18 17:24:10 +00:00
ModuleTest.cpp Avoid unnecessary constexpr to appease MSVC 2013 2016-10-11 18:35:13 +00:00
PassManagerTest.cpp [PM] Introduce the facilities for registering cross-IR-unit dependencies 2016-12-27 08:40:39 +00:00
PatternMatch.cpp
TypeBuilderTest.cpp Suppress all uses of LLVM_END_WITH_NULL. NFC. 2017-05-09 19:31:13 +00:00
TypesTest.cpp
UserTest.cpp [IR] Adding const_value_op_iterator for IR/User.h 2017-01-09 14:00:57 +00:00
UseTest.cpp
ValueHandleTest.cpp Add a new WeakVH value handle; NFC 2017-05-01 17:07:54 +00:00
ValueMapTest.cpp
ValueTest.cpp Remove getArgumentList() in favor of arg_begin(), args(), etc 2017-03-16 22:59:15 +00:00
VerifierTest.cpp Rename AttributeSet to AttributeList 2017-03-21 16:57:19 +00:00
WaymarkTest.cpp