summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOCodeGenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[LTO] Support filtering by hotness threshold"Bob Haarman2018-03-081-8/+1
| | | | | | | | This reverts commit 1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107) because it fails ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll. llvm-svn: 326975
* [LTO] Support filtering by hotness thresholdAdam Nemet2018-02-261-1/+8
| | | | | | | | | | | This wires up -pass-remarks-hotness-threshold to LTO and ThinLTO. Next is to change the clang driver to pass this with -fdiagnostics-hotness-threshold. Differential Revision: https://reviews.llvm.org/D41465 llvm-svn: 326107
* Pass a reference to a module to the bitcode writer.Rafael Espindola2018-02-141-1/+1
| | | | | | | This simplifies most callers as they are already using references or std::unique_ptr. llvm-svn: 325155
* Fix more inconsistent line endings. NFC.Dimitry Andric2017-12-181-9/+9
| | | | llvm-svn: 321016
* Remove redundant includes from lib/LTO.Michael Zolotukhin2017-12-131-3/+0
| | | | llvm-svn: 320623
* Fix a bunch more layering of CodeGen headers that are in TargetDavid Blaikie2017-11-171-3/+3
| | | | | | | | All these headers already depend on CodeGen headers so moving them into CodeGen fixes the layering (since CodeGen depends on Target, not the other way around). llvm-svn: 318490
* Add llvm::for_each as a range-based extensions to <algorithm> and make use ↵Aaron Ballman2017-11-031-11/+9
| | | | | | of it in some cases where it is a more clear alternative to std::for_each. llvm-svn: 317356
* [SimplifyCFG] use pass options and remove the latesimplifycfg passSanjay Patel2017-10-281-1/+0
| | | | | | | | | | | | | | | | | This is no-functional-change-intended. This is repackaging the functionality of D30333 (defer switch-to-lookup-tables) and D35411 (defer folding unconditional branches) with pass parameters rather than a named "latesimplifycfg" pass. Now that we have individual options to control the functionality, we could decouple when these fire (but that's an independent patch if desired). The next planned step would be to add another option bit to disable the sinking transform mentioned in D38566. This should also make it clear that the new pass manager needs to be updated to limit simplifycfg in the same way as the old pass manager. Differential Revision: https://reviews.llvm.org/D38631 llvm-svn: 316835
* [raw_fd_ostream] report actual error in error messagesBob Haarman2017-10-241-3/+5
| | | | | | | | | | | | | | | | | Summary: Previously, we would emit error messages like "IO failure on output stream". This change causes use to include information about what actually went wrong, e.g. "No space left on device". Reviewers: sunfish, rnk Reviewed By: rnk Subscribers: mehdi_amini, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D39203 llvm-svn: 316404
* Move the stripping of invalid debug info from the Verifier to AutoUpgrade.Adrian Prantl2017-10-021-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | This came out of a recent discussion on llvm-dev (https://reviews.llvm.org/D38042). Currently the Verifier will strip the debug info metadata from a module if it finds the dbeug info to be malformed. This feature is very valuable since it allows us to improve the Verifier by making it stricter without breaking bcompatibility, but arguable the Verifier pass should not be modifying the IR. This patch moves the stripping of broken debug info into AutoUpgrade (UpgradeDebugInfo to be precise), which is a much better location for this since the stripping of malformed (i.e., produced by older, buggy versions of Clang) is a (harsh) form of AutoUpgrade. This change is mostly NFC in nature, the one big difference is the behavior when LLVM module passes are introducing malformed debug info. Prior to this patch, a NoAsserts build would have printed a warning and stripped the debug info, after this patch the Verifier will report a fatal error. I believe this behavior is actually more desirable anyway. Differential Revision: https://reviews.llvm.org/D38184 llvm-svn: 314699
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-2/+2
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 Vivek Pandya2017-09-151-8/+16
| | | | | | | | | | | It enables OptimizationRemarkEmitter::allowExtraAnalysis and MachineOptimizationRemarkEmitter::allowExtraAnalysis to return true not only for -fsave-optimization-record but when specific remarks are requested with command line options. The diagnostic handler used to be callback now this patch adds a class DiagnosticHandler. It has virtual method to provide custom diagnostic handler and methods to control which particular remarks are enabled. However LLVM-C API users can still provide callback function for diagnostic handler. llvm-svn: 313390
* This reverts r313381Vivek Pandya2017-09-151-16/+8
| | | | llvm-svn: 313387
* This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 Vivek Pandya2017-09-151-8/+16
| | | | | | | | | | | It enables OptimizationRemarkEmitter::allowExtraAnalysis and MachineOptimizationRemarkEmitter::allowExtraAnalysis to return true not only for -fsave-optimization-record but when specific remarks are requested with command line options. The diagnostic handler used to be callback now this patch adds a class DiagnosticHandler. It has virtual method to provide custom diagnostic handler and methods to control which particular remarks are enabled. However LLVM-C API users can still provide callback function for diagnostic handler. llvm-svn: 313382
* Delete Default and JITDefault code modelsRafael Espindola2017-08-031-3/+2
| | | | | | | | | | | | | | | IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. llvm-svn: 309911
* [LTO] Print time-passes information at conclusion of LTO codegenJames Henderson2017-05-161-0/+1
| | | | | | | | | | | | | | | | | | | The information collected when requested by -time-passes is only printed when llvm_shutdown is called at the moment. This means that when linking against the LTO library dynamically and using the C interface, it is not possible to see the timing information, because llvm_shutdown cannot be called. This change modifies the LTO code generation functions for both regular LTO and thin LTO to explicitly print and reset the timing information. I have tested that this works with our proprietary linker. However, as this relies on a specific method of building and linking against the LTO library, I'm not sure how or if this can be tested in the LLVM testsuite. Reviewed by: mehdi_amini Differential Revision: https://reviews.llvm.org/D32803 llvm-svn: 303152
* LTO: Don't verify modules twice in verifyMergedModuleOnceAdrian Prantl2017-05-121-10/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D33140 llvm-svn: 302951
* Add support for -fno-builtin to LTO and ThinLTO to libLTOMehdi Amini2017-03-281-0/+2
| | | | | | | | | | Reviewers: tejohnson, pcc Subscribers: Prazek, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D30791 llvm-svn: 298936
* Split the SimplifyCFG pass into two variants.Joerg Sonnenberger2017-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The first variant contains all current transformations except transforming switches into lookup tables. The second variant contains all current transformations. The switch-to-lookup-table conversion results in code that is more difficult to analyze and optimize by other passes. Most importantly, it can inhibit Dead Code Elimination. As such it is often beneficial to only apply this transformation very late. A common example is inlining, which can often result in range restrictions for the switch expression. Changes in execution time according to LNT: SingleSource/Benchmarks/Misc/fp-convert +3.03% MultiSource/Benchmarks/ASC_Sequoia/CrystalMk/CrystalMk -11.20% MultiSource/Benchmarks/Olden/perimeter/perimeter -10.43% and a couple of smaller changes. For perimeter it also results 2.6% a smaller binary. Differential Revision: https://reviews.llvm.org/D30333 llvm-svn: 298799
* [LTO] Share the optimization remarks setup between Thin/Full LTO.Davide Italiano2017-02-101-19/+3
| | | | llvm-svn: 294807
* [lib/LTO] Rework optimization remarkers setup.Davide Italiano2017-02-101-16/+19
| | | | | | | | This makes this code much more similar to what ThinLTO is using (also API wise), so now we can probably use a single code path instead of copying stuff around. llvm-svn: 294792
* [LTOs] Allow generation of hotness informationAdam Nemet2016-12-021-0/+9
| | | | | | | | The flag is passed by the clang driver. Differential Revision: https://reviews.llvm.org/D27331 llvm-svn: 288519
* [LTO] Move finishOptimizationRemarks after codegenAdam Nemet2016-11-281-2/+2
| | | | | | This addresses the comment D26832. llvm-svn: 288041
* Rename option to -lto-pass-remarks-outputAdam Nemet2016-11-221-1/+1
| | | | | | | The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because of the duplicate option name with opt. llvm-svn: 287627
* [ThinLTO] Implement -pass-remarks-output in ThinLTOCodeGeneratorMehdi Amini2016-11-191-7/+7
| | | | | | | | | | | | | | Summary: This will also be added to the LTO API, right now this will bring ThinLTO on par with Monolithic LTO on Darwin. Reviewers: anemet Subscribers: tejohnson, llvm-commits Differential Revision: https://reviews.llvm.org/D26886 llvm-svn: 287450
* Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)Mehdi Amini2016-11-191-1/+1
| | | | | | | | | | | | | | Summary: This makes it explicit that ownership is taken. Also replace all `new` with make_unique<> at call sites. Reviewers: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26884 llvm-svn: 287449
* [LTO] Add option to generate optimization recordsAdam Nemet2016-11-181-0/+34
| | | | | | | | | | It is used to drive this from the clang driver via -mllvm. Same option name is used as in opt. Differential Revision: https://reviews.llvm.org/D26832 llvm-svn: 287356
* Split Bitcode/ReaderWriter.h into separate reader and writer headersTeresa Johnson2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Split ReaderWriter.h which contains the APIs into both the BitReader and BitWriter libraries into BitcodeReader.h and BitcodeWriter.h. This is to address Chandler's concern about sharing the same API header between multiple libraries (BitReader and BitWriter). That concern is why we create a single bitcode library in our downstream build of clang, which led to r286297 being reverted as it added a dependency that created a cycle only when there is a single bitcode library (not two as in upstream). Reviewers: mehdi_amini Subscribers: dlj, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D26502 llvm-svn: 286566
* Don't store Twine in a local variable.Eli Friedman2016-11-081-2/+1
| | | | | | Fixes post-commit review comment from r286177. llvm-svn: 286275
* [LTO] Add error message on IO error in compileOptimizedToFile.Eli Friedman2016-11-071-0/+2
| | | | | | | | (No testcase because it's difficult to force an error here.) Differential Revision: https://reviews.llvm.org/D26371 llvm-svn: 286177
* Utility functions for appending to llvm.used/llvm.compiler.used.Evgeniy Stepanov2016-10-251-18/+6
| | | | llvm-svn: 285143
* LTO: Use the correct mangler function in ↵Peter Collingbourne2016-10-121-2/+2
| | | | | | | | | | | | LTOCodeGenerator::applyScopeRestrictions(). We need to use the overload of Mangler::getNameWithPrefix that takes a GlobalValue in order to mangle in the stdcall stack byte count for Windows targets. Differential Revision: https://reviews.llvm.org/D25529 llvm-svn: 284040
* Recommit "Use StringRef in LTOModule implementation (NFC)""Mehdi Amini2016-10-071-1/+1
| | | | | | | | This reverts commit r283456 and reapply r282997, with explicitly zeroing the struct member to workaround a bug in MSVC2013 with zero-initialization: https://connect.microsoft.com/VisualStudio/feedback/details/802160 llvm-svn: 283581
* Revert "Use StringRef in LTOModule implementation (NFC)"Mehdi Amini2016-10-061-1/+1
| | | | | | | This reverts commit r282997, a windows bot is asserting in one test apparently. llvm-svn: 283456
* Use StringRef in LTOCodegenerator (NFC)Mehdi Amini2016-10-011-4/+4
| | | | llvm-svn: 282998
* Use StringRef in LTOModule implementation (NFC)Mehdi Amini2016-10-011-1/+1
| | | | llvm-svn: 282997
* [lib/LTO] Simplify. No functional change intended.Davide Italiano2016-09-021-11/+6
| | | | llvm-svn: 280503
* [lib/LTO] Add an assertion to catch invalid opt levels.Davide Italiano2016-08-261-4/+5
| | | | llvm-svn: 279823
* [LTOCodeGenerator] Reduce code duplication. NFCI.Davide Italiano2016-08-231-8/+8
| | | | llvm-svn: 279514
* Move legacy LTO interface headers to legacy/ directory.Peter Collingbourne2016-07-141-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D22173 llvm-svn: 275476
* New pass manager for LICM.Dehao Chen2016-07-121-1/+1
| | | | | | | | | | | | Summary: Port LICM to the new pass manager. Reviewers: davidxl, silvas Subscribers: krasin, vitalybuka, silvas, davide, sanjoy, llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21772 llvm-svn: 275222
* Revert "New pass manager for LICM."Vitaly Buka2016-07-121-1/+1
| | | | | | | | | | Summary: This reverts commit r275118. Subscribers: sanjoy, mehdi_amini Differential Revision: http://reviews.llvm.org/D22259 llvm-svn: 275156
* New pass manager for LICM.Dehao Chen2016-07-111-1/+1
| | | | | | | | | | | | Summary: Port LICM to the new pass manager. Reviewers: davidxl, silvas Subscribers: silvas, davide, sanjoy, llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21772 llvm-svn: 275118
* [UpdateCompilerUsed] API rename and cleanup, suggested by Rafaael.Davide Italiano2016-06-221-1/+1
| | | | | | | | | * UpdateCompilerUsed() -> updateCompilerUsed() * ThinLTO doesn't use the API so we can remove the include * Clean up unused #include <functional> from the header * Rename #ifdef guard comment to be correct. llvm-svn: 273461
* [LTO] Move UpdateCompilerUsed.h from lib/ to include/Davide Italiano2016-06-221-1/+1
| | | | | | | | I plan to use it in lld soon. Differential Revision: http://reviews.llvm.org/D21575 llvm-svn: 273380
* [PM] Port MergedLoadStoreMotion to the new pass manager, take two.Davide Italiano2016-06-171-1/+1
| | | | | | | | | This is indeed a much cleaner approach (thanks to Daniel Berlin for pointing out), and also David/Sean for review. Differential Revision: http://reviews.llvm.org/D21454 llvm-svn: 273032
* [PM] Revert the port of MergeLoadStoreMotion to the new pass manager.Davide Italiano2016-06-161-1/+1
| | | | | | | | Daniel Berlin expressed some real concerns about the port and proposed and alternative approach. I'll revert this for now while working on a new patch, which I hope to put up for review shortly. Sorry for the churn. llvm-svn: 272925
* Remove the ScalarReplAggregates passDavid Majnemer2016-06-151-2/+0
| | | | | | | | | | Nearly all the changes to this pass have been done while maintaining and updating other parts of LLVM. LLVM has had another pass, SROA, which has superseded ScalarReplAggregates for quite some time. Differential Revision: http://reviews.llvm.org/D21316 llvm-svn: 272737
* [PM] Port MemCpyOpt to the new PM.Sean Silva2016-06-141-1/+1
| | | | | | | | | The need for all these Lookup* functions is just because of calls to getAnalysis inside methods (i.e. not at the top level) of the runOnFunction method. They should be straightforward to clean up when the old PM is gone. llvm-svn: 272615
* [PM] Port MergedLoadStoreMotion to the new pass manager.Davide Italiano2016-06-141-1/+1
| | | | llvm-svn: 272606
OpenPOWER on IntegriCloud