summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto/llvm-lto.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move a call to getGlobalContext out of lib/LTO.Rafael Espindola2015-12-041-1/+1
| | | | llvm-svn: 254696
* Simplify the error handling in llvm-lto a bit.Rafael Espindola2015-12-041-36/+37
| | | | llvm-svn: 254675
* [ThinLTO] Deduplicate function index loading into shared helper (NFC)Teresa Johnson2015-11-231-27/+1
| | | | | | | | Add a shared helper routine to read the function index from a file and create/return the function index object. Use it in llvm-link and llvm-lto. llvm-svn: 253903
* [ThinLTO] Handle bitcode without function summary sections gracefullyTeresa Johnson2015-11-211-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Several fixes to the handling of bitcode files without function summary sections so that they are skipped during ThinLTO processing in llvm-lto and the gold plugin when appropriate instead of aborting. 1 Don't assert when trying to add a FunctionInfo that doesn't have a summary attached. 2 Skip FunctionInfo structures that don't have attached function summary sections when trying to create the combined function summary. 3 In both llvm-lto and gold-plugin, check whether a bitcode file has a function summary section before trying to parse the index, and skip the bitcode file if it does not. 4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug where we returned to early while looking for the summary section. Also added llvm-lto and gold-plugin based tests for cases where we don't have function summaries in the bitcode file. I verified that either the first couple fixes described above are enough to avoid the crashes, or fixes 1,3,4. But have combined them all here for added robustness. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D14903 llvm-svn: 253796
* [LTO] Add options to llvm-lto to select output format and dump merged moduleTobias Edler von Koch2015-11-201-0/+23
| | | | | | | | | | | | This introduces two new options: - "llvm-lto -save-merged-module -o outfile" dumps the LTO Module to outfile.merged.bc prior to CodeGen and after LTO optimizations have been run. - "llvm-lto -filetype=asm -o outfile" makes llvm-lto emit assembly instead of object code in outfile. Both are intended for use in lit tests. llvm-svn: 253624
* Do not require a Context to extract the FunctionIndex from Bitcode (NFC)Mehdi Amini2015-11-191-4/+30
| | | | | | | | | | The LLVMContext was only used for Diagnostic. Pass a DiagnosticHandler instead. Differential Revision: http://reviews.llvm.org/D14794 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 253540
* Switch lto codegen to using diagnostic handlers.Yunzhong Gao2015-11-171-11/+9
| | | | | | | | | | | This patch removes the std::string& argument from a number of C++ LTO API calls and instead makes them use the installed diagnostic handler. This would also improve consistency of diagnostic handling infrastructure: if an LTO client used lto_codegen_set_diagnostic_handler() to install a custom error handler, we do not want some error messages to go through the custom error handler, and some other error messages to go into sLastErrorString. llvm-svn: 253367
* llvm-lto: trivial spelling changes to distinguish custom diagnostic handler andYunzhong Gao2015-11-101-0/+1
| | | | | | | | default diagnostic handler. Differential Revision: http://reviews.llvm.org/D14520 llvm-svn: 252633
* Clang format a few prior patches (NFC)Teresa Johnson2015-11-021-6/+8
| | | | | | | I had clang formatted my earlier patches using the wrong style. Reformatted with the LLVM style. llvm-svn: 251812
* Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC)Teresa Johnson2015-10-191-1/+1
| | | | | | Implemented suggestion by dblakie in review for r250704. llvm-svn: 250723
* llvm-lto support for generating combined function indexesTeresa Johnson2015-10-191-0/+64
| | | | | | | | | | | | | | | | | Summary: This patch adds support to llvm-lto that mirrors the support added by r249270 to the gold plugin. This enables better testing of combined index generation for ThinLTO. Added a new test, and this support will be used in the test in D13515. Reviewers: joker.eph Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13847 llvm-svn: 250699
* Reapply "LTO: Disable extra verify runs in release builds"Duncan P. N. Exon Smith2015-09-151-2/+6
| | | | | | | This reverts commit r247730, effectively reapplying r247729. This time I have an lld commit ready to follow. llvm-svn: 247735
* Revert "LTO: Disable extra verify runs in release builds"Duncan P. N. Exon Smith2015-09-151-6/+2
| | | | | | | This temporarily reverts commit r247729, as it caused lld build failures. I'll recommit once I have an lld patch ready-to-go. llvm-svn: 247730
* LTO: Disable extra verify runs in release buildsDuncan P. N. Exon Smith2015-09-151-2/+6
| | | | | | | | | | | | | | | | | | | | | | The verifier currently runs three times in LTO: (1) after parsing, (2) at the beginning of the optimization pipeline, and (3) at the end of it. The first run is important, since we're not sure where the bitcode comes from and it's nice to validate it, but in release builds the extra runs aren't appropriate. This commit: - Allows these runs to be disabled in LTOCodeGenerator. - Adds command-line options to llvm-lto. - Adds command-line options to libLTO.dylib, and disables the verifier by default in release builds (based on NDEBUG). This shaves about 3.5% off the runtime of ld64 when linking verify-uselistorder with -flto -g. rdar://22509081 llvm-svn: 247729
* Add a non-exiting diagnostic handler for LTO.Yunzhong Gao2015-09-111-1/+4
| | | | | | | This is in order to give LTO clients a chance to do some clean-up before terminating the process. llvm-svn: 247461
* CodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.Peter Collingbourne2015-08-271-11/+33
| | | | | | | | | | | | | | | llvm::splitCodeGen is a function that implements the core of parallel LTO code generation. It uses llvm::SplitModule to split the module into linkable partitions and spawning one code generation thread per partition. The function produces multiple object files which can be linked in the usual way. This has been threaded through to LTOCodeGenerator (and llvm-lto for testing purposes). Separate patches will add parallel LTO support to the gold plugin and lld. Differential Revision: http://reviews.llvm.org/D12260 llvm-svn: 246236
* LTO: Simplify merged module ownership.Peter Collingbourne2015-08-241-1/+1
| | | | | | | | | | | This change moves LTOCodeGenerator's ownership of the merged module to a field of type std::unique_ptr<Module>. This helps simplify parts of the code and clears the way for the module to be consumed by LLVM CodeGen (see D12132 review comments). Differential Revision: http://reviews.llvm.org/D12205 llvm-svn: 245891
* LTO: Change signature of LTOCodeGenerator::setCodePICModel() to take a ↵Peter Collingbourne2015-08-211-13/+1
| | | | | | | | | Reloc::Model. This allows us to remove a bunch of code in LTOCodeGenerator and llvm-lto and has the side effect of improving error handling in the libLTO C API. llvm-svn: 245756
* llvm-lto: Re-order code.Peter Collingbourne2015-08-211-12/+10
| | | | | | | This saves us from needing to asave a pointer, and will be needed for an upcoming ownership change. llvm-svn: 245722
* Make the C++ LTO API easier to use from C++ clients.Peter Collingbourne2015-06-011-5/+3
| | | | | | | | | | | Start using C++ types such as StringRef and MemoryBuffer in the C++ LTO API. In doing so, clarify the ownership of the native object file: the caller now owns it, not the LTOCodeGenerator. The C libLTO library has been modified to use a derived class of LTOCodeGenerator that owns the object file. Differential Revision: http://reviews.llvm.org/D10114 llvm-svn: 238776
* libLTO, llvm-lto, gold: Introduce flag for controlling optimization level.Peter Collingbourne2015-03-191-5/+16
| | | | | | | | | | This change also introduces a link-time optimization level of 1. This optimization level runs only the globaldce pass as well as cleanup passes for passes that run at -O0, specifically simplifycfg which cleans up lowerbitsets. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150316/266951.html llvm-svn: 232769
* Make helper functions static.Benjamin Kramer2015-03-091-4/+4
| | | | | | Found by -Wmissing-prototypes. NFC. llvm-svn: 231664
* [LTO API] add lto_codegen_set_module to set the destination module.Manman Ren2015-02-241-4/+15
| | | | | | | | | | | | | | | | | | When debugging LTO issues with ld64, we use -save-temps to save the merged optimized bitcode file, then invoke ld64 again on the single bitcode file to speed up debugging code generation passes and ld64 stuff after code generation. llvm linking a single bitcode file via lto_codegen_add_module will generate a different bitcode file from the single input. With the newly-added lto_codegen_set_module, we can make sure the destination module is the same as the input. lto_codegen_set_module will transfer the ownship of the module to code generator. rdar://19024554 llvm-svn: 230290
* [llvm-lto] Add a line for setting LTOCodeGenerator's CPU string from commandAkira Hatanaka2015-01-301-0/+3
| | | | | | | | line. This is needed for a test case I plan to commit later. llvm-svn: 227532
* llvm-lto: Add testing coverage for local contextsDuncan P. N. Exon Smith2014-12-171-0/+47
| | | | | | | | | | | Add coverage in `llvm-lto` for the API exposed by libLTO to create modules in local contexts. The goal here isn't to test the symbol-related API extensively, just to confirm that these modules work at all. (I'll be shifting code around soon that should be NFC and I realized there was no test coverage.) llvm-svn: 224408
* Add an option to the LTO code generator to disable vectorization during LTOArnold Schwaighofer2014-10-261-3/+9
| | | | | | | | | | | | | | | | | | | | We used to always vectorize (slp and loop vectorize) in the LTO pass pipeline. r220345 changed it so that we used the PassManager's fields 'LoopVectorize' and 'SLPVectorize' out of the desire to be able to disable vectorization using the cl::opt flags 'vectorize-loops'/'slp-vectorize' which the before mentioned fields default to. Unfortunately, this turns off vectorization because those fields default to false. This commit adds flags to the LTO library to disable lto vectorization which reconciles the desire to optionally disable vectorization during LTO and the desired behavior of defaulting to enabled vectorization. We really want tools to set PassManager flags directly to enable/disable vectorization and not go the route via cl::opt flags *in* PassManagerBuilder.cpp. llvm-svn: 220652
* Update the error handling of lib/Linker.Rafael Espindola2014-10-251-5/+1
| | | | | | Instead of passing a std::string&, use the new diagnostic infrastructure. llvm-svn: 220608
* LTO: Ignore disabled diagnostic remarksDuncan P. N. Exon Smith2014-10-011-0/+26
| | | | | | | | | | | | | | | | | | | | | | | r206400 and r209442 added remarks that are disabled by default. However, if a diagnostic handler is registered, the remarks are sent unfiltered to the handler. This is the right behaviour for clang, since it has its own filters. However, the diagnostic handler exposed in the LTO API receives only the severity and message. It doesn't have the information to filter by pass name. For LTO, disabled remarks should be filtered by the producer. I've changed `LLVMContext::setDiagnosticHandler()` to take a `bool` argument indicating whether to respect the built-in filters. This defaults to `false`, so other consumers don't have a behaviour change, but `LTOCodeGenerator::setDiagnosticHandler()` sets it to `true`. To make this behaviour testable, I added a `-use-diagnostic-handler` command-line option to `llvm-lto`. This fixes PR21108. llvm-svn: 218784
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* LTO: rename the various makeLTOModule overloads.Peter Collingbourne2014-07-031-1/+1
| | | | | | | | | This rename makes it easier to identify the specific overload being called in each particular case and makes future refactorings easier. Differential Revision: http://reviews.llvm.org/D4370 llvm-svn: 212302
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-0/+1
| | | | | | necessary. llvm-svn: 207593
* Add an -mattr option to the gold plugin to support subtarget features in LTOTom Roeder2014-04-251-0/+10
| | | | | | | | | | This adds support for an -mattr option to the gold plugin and to llvm-lto. This allows the caller to specify details of the subtarget architecture, like +aes, or +ssse3 on x86. Note that this requires a change to the include/llvm-c/lto.h interface: it adds a function lto_codegen_set_attr and it increments the version of the interface. llvm-svn: 207279
* [C++] Use 'nullptr'. Tools edition.Craig Topper2014-04-251-2/+2
| | | | llvm-svn: 207176
* Teach llvm-lto to respect the given RelocModel.James Molloy2014-04-141-1/+14
| | | | | | Patch by Nick Tomlinson! llvm-svn: 206177
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+2
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-1/+1
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
* Refactor TargetOptions initialization into a single place.Eli Bendersky2014-02-191-20/+1
| | | | | | | | | | | | The same code (~20 lines) for initializing a TargetOptions object from CodeGen cmdline flags is duplicated 4 times in 4 different tools. This patch moves it into a utility function. Since the CodeGen/CommandFlags.h file defines cl::opt flags in a header, it's a bit of a touchy situation because we should only link them into tools. So this patch puts the init function in the header. llvm-svn: 201699
* Re-sort #include lines again, prior to moving headers around.Chandler Carruth2014-01-131-1/+1
| | | | llvm-svn: 199080
* Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list".Rafael Espindola2013-10-311-2/+26
| | | | | | | | | | | | | | | | | | | | | | There are two ways one could implement hiding of linkonce_odr symbols in LTO: * LLVM tells the linker which symbols can be hidden if not used from native files. * The linker tells LLVM which symbols are not used from other object files, but will be put in the dso symbol table if present. GOLD's API is the second option. It was implemented almost 1:1 in llvm by passing the list down to internalize. LLVM already had partial support for the first option. It is also very similar to how ld64 handles hiding these symbols when *not* doing LTO. This patch then * removes the APIs for the DSO list. * marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr global values and other linkonce_odr whose address is not used. * makes the gold plugin responsible for handling the API mismatch. llvm-svn: 193800
* Fix object file writing in llvm-lto on Windows.Rafael Espindola2013-10-041-1/+2
| | | | | | | | We were writing in text mode. Patch by Greg Bedwell. llvm-svn: 191985
* Optimize linkonce_odr unnamed_addr functions during LTO.Rafael Espindola2013-10-031-0/+8
| | | | | | | | | | | Generalize the API so we can distinguish symbols that are needed just for a DSO symbol table from those that are used from some native .o. The symbols that are only wanted for the dso symbol table can be dropped if llvm can prove every other dso has a copy (linkonce_odr) and the address is not important (unnamed_addr). llvm-svn: 191922
* Add a -exported-symbol option to llvm-lto.Rafael Espindola2013-10-021-0/+10
| | | | | | Patch by Tom Roeder. llvm-svn: 191825
* Remove several unused variables.Rafael Espindola2013-10-011-1/+0
| | | | | | Patch by Alp Toker. llvm-svn: 191757
* Move command line options to the users of libLTO. Fixes --enable-shared build.Rafael Espindola2013-09-301-9/+48
| | | | | | Patch by Richard Sandiford. llvm-svn: 191680
* Move LTO support library to a component, allowing it to be testedPeter Collingbourne2013-09-241-23/+26
| | | | | | more reliably across platforms. Patch by Tom Roeder! llvm-svn: 191343
* Fix LTO handling of module-level assembly (PR14152).Peter Collingbourne2013-09-191-0/+103
Patch by Tom Roeder! llvm-svn: 191042
OpenPOWER on IntegriCloud