Commit Graph

11 Commits

Author SHA1 Message Date
Alexander Kornienko
cf0db29df2 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 15:57:42 +00:00
Chandler Carruth
69774fa1c4 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227299 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 09:47:21 +00:00
Yaron Keren
b4c17e7b51 FunctionPassManager isn't used by the JIT anymore, it is used in
clang EmitAssemblyHelper::CreatePasses() in BackendUtil.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217488 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 10:48:06 +00:00
Benjamin Kramer
00e08fcaa0 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:26:38 +00:00
Hans Wennborg
bf5a4c36bc LegacyPassManagers.h: increase the size of PMDataManager::HigherLevelAnalysis.
In a Clang bootstrap, the median and max size was 9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215337 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 02:21:25 +00:00
Hans Wennborg
75762d6eae Increase the size of PMTopLevelManager::ImmutablePasses from 8 to 16.
During a bootstrap build of Clang, this SmallVector always held 14 elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215333 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 02:17:15 +00:00
Hans Wennborg
68b0d1d2b4 Fix some misplaced spaces around 'override'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209589 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-24 20:19:40 +00:00
Craig Topper
ec0f0bc6af [C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 06:08:46 +00:00
Craig Topper
98f54c09d0 [C++11] Add 'override' keyword to IR library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202939 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 06:35:38 +00:00
Duncan P. N. Exon Smith
3f8ce09441 Fix comments for PassDebuggingString
No functionality change.  Changing comments to match code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196713 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-08 01:28:17 +00:00
Chandler Carruth
49837ef811 Move the old pass manager infrastructure into a legacy namespace and
give the files a legacy prefix in the right directory. Use forwarding
headers in the old locations to paper over the name change for most
clients during the transitional period.

No functionality changed here! This is just clearing some space to
reduce renaming churn later on with a new system.

Even when the new stuff starts to go in, it is going to be hidden behind
a flag and off-by-default as it is still WIP and under development.

This patch is specifically designed so that very little out-of-tree code
has to change. I'm going to work as hard as I can to keep that the case.
Only direct forward declarations of the PassManager class are impacted
by this change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194324 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 12:26:54 +00:00