1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/include/llvm
Chandler Carruth 50332edaf7 [LPM] A targeted but somewhat horrible fix to the legacy pass manager's
querying of the pass registry.

The pass manager relies on the static registry of PassInfo objects to
perform all manner of its functionality. I don't understand why it does
much of this. My very vague understanding is that this registry is
touched both during static initialization *and* while each pass is being
constructed. As a consequence it is hard to make accessing it not
require a acquiring some lock. This lock ends up in the hot path of
setting up, tearing down, and invaliditing analyses in the legacy pass
manager.

On most systems you can observe this as a non-trivial % of the time
spent in 'ninja check-llvm'. However, I haven't really seen it be more
than 1% in extreme cases of compiling more real-world software,
including LTO.

Unfortunately, some of the GPU JITs are seeing this taking essentially
all of their time because they have very small IR running through
a small pass pipeline very many times (at least, this is the vague
understanding I have of it).

This patch tries to minimize the cost of looking up PassInfo objects by
leveraging the fact that the objects themselves are immutable and they
are allocated separately on the heap and so don't have their address
change. It also requires a change I made the last time I tried to debug
this problem which removed the ability to de-register a pass from the
registry. This patch creates a single access path to these objects
inside the PMTopLevelManager which memoizes the result of querying the
registry. This is somewhat gross as I don't really know if
PMTopLevelManager is the *right* place to put it, and I dislike using
a mutable member to memoize things, but it seems to work.

For long-lived pass managers this should completely eliminate
the cost of acquiring locks to look into the pass registry once the
memoized cache is warm. For 'ninja check' I measured about 1.5%
reduction in CPU time and in total time on a machine with 32 hardware
threads. For normal compilation, I don't know how much this will help,
sadly. We will still pay the cost while we populate the memoized cache.
I don't think it will hurt though, and for LTO or compiles with many
small functions it should still be a win. However, for tight loops
around a pass manager with many passes and small modules, this will help
tremendously. On the AArch64 backend I saw nearly 50% reductions in time
to complete 2000 cycles of spinning up and tearing down the pipeline.
Measurements from Owen of an actual long-lived pass manager show more
along the lines of 10% improvements.

Differential Revision: http://reviews.llvm.org/D7213

llvm-svn: 227299
2015-01-28 09:47:21 +00:00
..
ADT Add the triple for the Sony Playstation®4. 2015-01-25 22:46:59 +00:00
Analysis Fold fcmp in cases where value is provably non-negative. By Arch Robison. 2015-01-28 08:03:58 +00:00
AsmParser Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
Bitcode [Bitcode] Diagnose errors instead of asserting from bad input 2015-01-24 04:15:05 +00:00
CodeGen MachineRegisterInfo can access TII off of the MachineFunction's 2015-01-27 01:15:16 +00:00
Config [multilib] Add support to the autoconf build to substitute 2014-12-29 11:58:17 +00:00
DebugInfo [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
ExecutionEngine Orc/IRCompileLayer.h: Avoid non-static initializer. 2015-01-25 11:41:56 +00:00
IR [LPM] A targeted but somewhat horrible fix to the legacy pass manager's 2015-01-28 09:47:21 +00:00
IRReader Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
LineEditor
Linker Use the DiagnosticHandler to print diagnostics when reading bitcode. 2015-01-10 00:07:30 +00:00
LTO Remove StringMap::GetOrCreateValue in favor of StringMap::insert 2014-11-19 05:49:42 +00:00
MC Store the passed in CPU name string so that it can be accessed later. 2015-01-26 17:33:30 +00:00
Object dd the option, -link-opt-hints to llvm-objdump used with -macho to print the 2015-01-27 21:28:24 +00:00
Option Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData InstrProf: Add operator!= to coverage counters 2015-01-24 21:13:23 +00:00
Support Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test. 2015-01-27 22:21:06 +00:00
TableGen Make MultiClass::DefPrototypes own their Records to fix memory leaks. 2014-12-11 05:25:33 +00:00
Target Remove extraneous period. 2015-01-27 01:01:34 +00:00
Transforms [SimplifyLibCalls] Don't confuse strcpy_chk for stpcpy_chk. 2015-01-27 21:52:16 +00:00
CMakeLists.txt
InitializePasses.h [PM] Refactor the core logic to run EarlyCSE over a function into an 2015-01-27 01:34:14 +00:00
LinkAllIR.h
LinkAllPasses.h Add a new pass "inductive range check elimination" 2015-01-16 01:03:22 +00:00
module.modulemap Bring the modules buildbot back to life after r226940. 2015-01-24 01:55:52 +00:00
module.modulemap.build
Pass.h
PassAnalysisSupport.h
PassInfo.h
PassManager.h
PassRegistry.h [PM] Remove an unused and rather expensive mapping from an analysis 2014-10-06 00:30:59 +00:00
PassSupport.h Defining a new API for debug options that doesn't rely on static global cl::opts. 2014-10-15 21:54:35 +00:00