llvm-project/llvm
Teresa Johnson 3bd4b5a925 [CGP] Build the DominatorTree lazily
Summary:
In r355512 CGP was changed to build the DominatorTree only once per
function traversal, to avoid repeatedly building it each time it was
accessed. This solved one compile time issue but introduced another. In
the second case, we now were building the DT unnecessarily many times
when we performed many function traversals (i.e. more than once per
function when running CGP because of changes made each time).

Change to saving the DT in the CodeGenPrepare object, and building it
lazily when needed. It is reset whenever we need to rebuild it.

The case that exposed the issue there are 617 functions, and we walk
them (i.e. execute the "while (MadeChange)" loop in runOnFunction) a
total of 12083 times (so previously we were building the DT 12083
times). With this patch we only build the DT 844 times (average of 1.37
times per function). We dropped the total time to compile this file from
538.11s without this patch to 339.63s with it.

There is still an issue as CGP is taking much longer than all other
passes even with this patch, and before a recent compiler release cut at
r355392 the total time to this compile was only 97 sec with a huge
reduction in CGP time. I suspect that one of the other recent changes to
CGP led to iterating each function many more times on average, but I
need to do some more investigation.

Reviewers: spatel

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356937
2019-03-25 18:38:48 +00:00
..
benchmarks
bindings
cmake Moved everything SMT-related to LLVM and updated the cmake scripts. 2019-03-25 17:47:45 +00:00
docs IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
examples [Kaleidoscope] Fix symbol resolver to search in reverse order. 2019-02-21 16:53:04 +00:00
include Moved everything SMT-related to LLVM and updated the cmake scripts. 2019-03-25 17:47:45 +00:00
lib [CGP] Build the DominatorTree lazily 2019-03-25 18:38:48 +00:00
projects
resources
runtimes [runtime] Use --strip-all rather than --strip-sections 2019-03-10 04:26:54 +00:00
test [x86] add another vector zext test; NFC 2019-03-25 17:53:56 +00:00
tools [llvm-objcopy]Preserve data in segments not covered by sections 2019-03-25 16:36:26 +00:00
unittests [ConstantRange] Add getFull() + getEmpty() named constructors; NFC 2019-03-24 09:34:40 +00:00
utils merge-request.sh: Update 8.0 metabug for 8.0.1 2019-03-25 17:01:29 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore [clangd] Store index in '.clangd/index' instead of '.clangd-index' 2019-02-20 19:08:06 +00:00
CMakeLists.txt Moved everything SMT-related to LLVM and updated the cmake scripts. 2019-03-25 17:47:45 +00:00
CODE_OWNERS.TXT
CREDITS.TXT [NFC] Add to contributor list. 2019-02-26 05:46:45 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.