[PATCH] D36352: [LCG] Switch one of the update methods for the LazyCallGraph to support limited batch updates.
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 5 05:21:39 PDT 2017
chandlerc created this revision.
Herald added subscribers: mcrosier, mehdi_amini.
Specifically, allow removing multiple reference edges starting from
a common source node. There are a few constraints that play into
supporting this form of batching:
1. The way updates occur during the CGSCC walk, about the most we can functionally batch together are those with a common source node. This also makes the batching simpler to implement, so it seems a worthwhile restriction.
2. The far and away hottest function for large C++ files I measured (generated code for protocol buffers) showed a huge amount of time was spent removing ref edges specifically, so it seems worth focusing there.
3. The algorithm for removing ref edges is very amenable to this restricted batching. There are just both API and implementation special casing for the non-batch case that gets in the way. Once removed, supporting batches is nearly trivial.
This does modify the API in an interesting way -- now, we only preserve
the target RefSCC when the RefSCC structure is unchanged. In the face of
any splits, we create brand new RefSCC objects. However, all of the
users were OK with it that I could find. Only the unittest needed
interesting updates here.
How much does batching these updates help? I instrumented the compiler
when run over a very large generated source file for a protocol buffer
and found that the majority of updates are intrinsically updating one
function at a time. However, nearly 40% of the total ref edges removed
are removed as part of a batch of removals greater than one, so these
are the cases batching can help with.
When compiling the IR for this file with 'opt' and 'https://reviews.llvm.org/owners/package/3/', this patch
reduces the total time by 8-9%.
I'm still working on adding a bit of specific unittest coverage for the batch
part of the API, but wanted to go ahead and send for review as that isn't very
interesting.
https://reviews.llvm.org/D36352
Files:
include/llvm/Analysis/LazyCallGraph.h
lib/Analysis/CGSCCPassManager.cpp
lib/Analysis/LazyCallGraph.cpp
unittests/Analysis/LazyCallGraphTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36352.109863.patch
Type: text/x-patch
Size: 23727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170805/a5e0fb27/attachment.bin>
More information about the llvm-commits
mailing list