1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
llvm-mirror/lib/Transforms/IPO
Mehdi Amini 490bf85c83 Require Dominator Tree For SROA, improve compile-time
TL-DR: SROA is followed by EarlyCSE which requires the DominatorTree.
There is no reason not to require it up-front for SROA.

Some history is necessary to understand why we ended-up here.

r123437 switched the second (Legacy)SROA in the optimizer pipeline to
use SSAUpdater in order to avoid recomputing the costly
DominanceFrontier. The purpose was to speed-up the compile-time.

Later r123609 removed the need for the DominanceFrontier in
(Legacy)SROA.

Right after, some cleanup was made in r123724 to remove any reference
to the DominanceFrontier. SROA existed in two flavors: SROA_SSAUp and
SROA_DT (the latter replacing SROA_DF).
The second argument of `createScalarReplAggregatesPass` was renamed
from `UseDomFrontier` to `UseDomTree`.
I believe this is were a mistake was made. The pipeline was not
updated and the call site was still:
    PM->add(createScalarReplAggregatesPass(-1, false));

At that time, SROA was immediately followed in the pipeline by
EarlyCSE which required alread the DominatorTree. Not requiring
the DominatorTree in SROA didn't save anything, but unfortunately
it was lost at this point.

When the new SROA Pass was introduced in r163965, I believe the goal
was to have an exact replacement of the existing SROA, this bug
slipped through.

You can see currently:

$ echo "" | clang -x c++  -O3 -c - -mllvm -debug-pass=Structure
...
...
      FunctionPass Manager
        SROA
        Dominator Tree Construction
        Early CSE

After this patch:

$ echo "" | clang -x c++  -O3 -c - -mllvm -debug-pass=Structure
...
...
      FunctionPass Manager
        Dominator Tree Construction
        SROA
        Early CSE

This improves the compile time from 88s to 23s for PR17855.
https://llvm.org/bugs/show_bug.cgi?id=17855

And from 113s to 12s for PR16756
https://llvm.org/bugs/show_bug.cgi?id=16756

Reviewers: chandlerc

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 245820
2015-08-23 22:15:49 +00:00
..
ArgumentPromotion.cpp Use foreach loops for StructType::elements(). NFC. 2015-07-24 18:55:49 +00:00
BarrierNoopPass.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
CMakeLists.txt Resubmit "Add new EliminateAvailableExternally module pass" (r239480) 2015-07-06 16:22:42 +00:00
ConstantMerge.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
DeadArgumentElimination.cpp IR: Do not consider available_externally linkage to be linker-weak. 2015-07-05 20:52:35 +00:00
ElimAvailExtern.cpp Remove unused variable. 2015-07-13 14:43:33 +00:00
ExtractGV.cpp [llvm-extract] Drop comdats from declarations 2015-07-06 18:48:02 +00:00
FunctionAttrs.cpp Remove unused variable. NFC. 2015-07-24 19:18:32 +00:00
GlobalDCE.cpp Rangify for loops in GlobalDCE, NFC. 2015-07-18 19:57:34 +00:00
GlobalOpt.cpp Revert "Improve merging of stores from static constructors in GlobalOpt" 2015-07-22 22:26:54 +00:00
InlineAlways.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Inliner.cpp Variable names should start with an upper case letter; NFC 2015-08-11 16:05:43 +00:00
InlineSimple.cpp
Internalize.cpp Internalize: internalize comdat members as a group, and drop comdat on such members. 2015-07-16 17:42:21 +00:00
IPConstantPropagation.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
IPO.cpp Don't change the visibility when converting a definition to a declaration. 2015-07-13 14:18:22 +00:00
LLVMBuild.txt [PM/AA] Remove the last relics of the separate IPA library from LLVM, 2015-08-18 17:51:53 +00:00
LoopExtractor.cpp Drive-by fixes for LandingPad -> EHPad 2015-08-04 08:21:40 +00:00
LowerBitSets.cpp LowerBitSets: Add debugging output. 2015-07-29 18:12:36 +00:00
Makefile
MergeFunctions.cpp Improve the determinism of MergeFunctions 2015-08-21 23:27:24 +00:00
PartialInlining.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
PassManagerBuilder.cpp Require Dominator Tree For SROA, improve compile-time 2015-08-23 22:15:49 +00:00
PruneEH.cpp [PruneEH] A naked, noinline function can return via InlineAsm 2015-06-27 07:52:53 +00:00
StripDeadPrototypes.cpp
StripSymbols.cpp Use foreach loop over constant operands. NFC. 2015-06-25 20:51:38 +00:00