llvm-6502/lib
Anthony Pesch a5fd3fdc5b 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242935 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 21:10:45 +00:00
..
Analysis Fix -Wextra-semi warnings. 2015-07-22 20:46:11 +00:00
AsmParser AsmParser: Add a function to parse a standalone constant value. 2015-07-17 22:07:03 +00:00
Bitcode Add argmemonly attribute. 2015-07-11 10:30:36 +00:00
CodeGen MIR Parser: Extract the MDNode parsing code into a separate method. NFC. 2015-07-22 21:07:04 +00:00
DebugInfo Return ErrorOr from getSymbolAddress. 2015-07-03 18:19:00 +00:00
ExecutionEngine Fix -Wextra-semi warnings. 2015-07-22 20:46:11 +00:00
Fuzzer [Fuzzer] Rely on $PATH expansion instead of hardcoding paths in tests. NFC. 2015-07-21 22:51:55 +00:00
IR Fix -Wextra-semi warnings. 2015-07-22 20:46:11 +00:00
IRReader Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LibDriver Add support for producing thin archives in llvm-lib. 2015-07-17 16:01:11 +00:00
LineEditor
Linker Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
LTO LTO: expose LTO_SYMBOL_ALIAS, which indicates that the symbol is an alias. 2015-07-04 03:42:35 +00:00
MC Fix a -Winconsistent-missing-override failure in the .intel_syntax 2015-07-22 11:22:29 +00:00
Object Fix fetching the symbol table of a thin archive. 2015-07-22 19:34:26 +00:00
Option [Option] Plug a leak when move-assigning an InputArgList. 2015-06-23 15:28:10 +00:00
Passes
ProfileData Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Support De-duplicate Unix & Windows CallBacksToRun 2015-07-22 19:01:14 +00:00
TableGen [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC 2015-07-06 06:23:01 +00:00
Target Fix -Wextra-semi warnings. 2015-07-22 20:46:11 +00:00
Transforms Improve merging of stores from static constructors in GlobalOpt 2015-07-22 21:10:45 +00:00
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00