1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/lib/Transforms/IPO
Anthony Pesch 7bfb3a910e Improve merging of stores from static constructors in GlobalOpt
Summary:
While working on a project I wound up generating a fairly large lookup table (10k entries) of callbacks inside of a static constructor. Clang was taking upwards of ~10 minutes to compile the lookup table. I generated a smaller test case (http://www.inolen.com/static_initializer_test.ll) that, after running with -ftime-report, pointed fingers at GlobalOpt and MemCpyOptimizer.

Running globalopt took around ~9 minutes. The slowdown came from how GlobalOpt merged stores from static constructors individually into the global initializer in EvaluateStaticConstructor. For each store it discovered and wanted to commit, it would copy the existing global initializer and then merge in the individual store. I changed this so that stores are now grouped by global, and sorted from most significant to least significant by their GEP indexes (e.g. a store to GEP 0, 0 comes before GEP 0, 0, 1). With this representation, the existing initializer can be copied and all new stores merged into it in a single pass.

With this patch and http://reviews.llvm.org/D11198, the lookup table that was taking ~10 minutes to compile now compiles in around 5 seconds. I've ran 'make check' and the test-suite, which all passed.

I'm not really sure who to tag as a reviewer, Lang mentioned that Chandler may be appropriate.

Reviewers: chandlerc, nlewycky

Subscribers: nlewycky, llvm-commits

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

llvm-svn: 242935
2015-07-22 21:10:45 +00:00
..
ArgumentPromotion.cpp [PM/AA] Remove the last of the legacy update API from AliasAnalysis as 2015-07-22 09:49:59 +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 Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
GlobalDCE.cpp Rangify for loops in GlobalDCE, NFC. 2015-07-18 19:57:34 +00:00
GlobalOpt.cpp Improve merging of stores from static constructors in GlobalOpt 2015-07-22 21:10:45 +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 Narrow Callee scope, suggestion from David Blaikie. 2015-07-19 15:48:07 +00:00
InlineSimple.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
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 Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00
LoopExtractor.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
LowerBitSets.cpp LowerBitSets: Ignore bitset entries that do not directly refer to a global. 2015-06-27 00:17:51 +00:00
Makefile
MergeFunctions.cpp MergeFunc: Transfer the callee's attributes when replacing a direct caller 2015-07-21 17:07:07 +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 [GMR] Add a flag to enable GlobalsModRef in the normal compilation 2015-07-22 11:57:28 +00:00
PruneEH.cpp [PruneEH] A naked, noinline function can return via InlineAsm 2015-06-27 07:52:53 +00:00
StripDeadPrototypes.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
StripSymbols.cpp Use foreach loop over constant operands. NFC. 2015-06-25 20:51:38 +00:00