summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto2
Commit message (Collapse)AuthorAgeFilesLines
* Add missing library dependency to fix build break in llvm-lto2Hiroshi Inoue2017-06-282-1/+2
| | | | | | | | | error message CMakeFiles/llvm-lto2.dir/llvm-lto2.cpp.o: In function `dumpSymtab(int, char**)': llvm-lto2.cpp:(.text._ZL10dumpSymtabiPPc+0x238): undefined reference to `llvm::getBitcodeFileContents(llvm::MemoryBufferRef)' collect2: error: ld returned 1 exit status llvm-svn: 306507
* Object: Teach irsymtab::read() to try to use the irsymtab that we wrote to disk.Peter Collingbourne2017-06-271-1/+13
| | | | | | | | Fixes PR27551. Differential Revision: https://reviews.llvm.org/D33974 llvm-svn: 306488
* Symbols re-defined with -wrap and -defsym need to be excluded from inter-Dmitry Mikulin2017-06-051-0/+2
| | | | | | | | | | procedural optimizations to prevent dropping symbols and allow the linker to process re-directs. PR33145: --wrap doesn't work with lto. Differential Revision: https://reviews.llvm.org/D33621 llvm-svn: 304719
* [ThinLTO] Move -lto-use-new-pm to llvm-lto2, and change it to -use-new-pm.Tim Shen2017-06-011-1/+7
| | | | | | | | | | | | | | | | | | Summary: As we teach Clang to use ThinkLTO + new PM, it's good for the users to inject through Config, instead of setting a flag in the LTOBackend library. Move the flag to llvm-lto2. As it moves to llvm-lto2, a new name -use-new-pm seems simpler and as clear. Reviewers: davide, tejohnson Subscribers: mehdi_amini, Prazek, inglorion, eraman, chandlerc, llvm-commits Differential Revision: https://reviews.llvm.org/D33799 llvm-svn: 304492
* Object, LTO: Add target triple to irsymtab and LTO API.Peter Collingbourne2017-04-141-2/+7
| | | | | | | | | | Start using it in LLD to avoid needing to read bitcode again just to get the target triple, and in llvm-lto2 to avoid printing symbol table information that is inappropriate for the target. Differential Revision: https://reviews.llvm.org/D32038 llvm-svn: 300300
* LTO: Pass SF_Executable flag through to InputFile::SymbolTobias Edler von Koch2017-04-131-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The linker needs to be able to determine whether a symbol is text or data to handle the case of a common being overridden by a strong definition in an archive. If the archive contains a text member of the same name as the common, that function is discarded. However, if the archive contains a data member of the same name, that strong definition overrides the common. This is a behavior of ld.bfd, which the Qualcomm linker also supports in LTO. Here's a test case to illustrate: #### cat > 1.c << \! int blah; ! cat > 2.c << \! int blah() { return 0; } ! cat > 3.c << \! int blah = 20; ! clang -c 1.c clang -c 2.c clang -c 3.c ar cr lib.a 2.o 3.o ld 1.o lib.a -t #### The correct output is: 1.o (lib.a)3.o Thanks to Shankar Easwaran and Hemant Kulkarni for the test case! Reviewers: mehdi_amini, rafael, pcc, davide Reviewed By: pcc Subscribers: davide, llvm-commits, inglorion Differential Revision: https://reviews.llvm.org/D31901 llvm-svn: 300205
* llvm-lto2: Add a dump-symtab subcommand.Peter Collingbourne2017-04-121-1/+53
| | | | | | | | This allows us to test the symbol table APIs for LTO input files. Differential Revision: https://reviews.llvm.org/D31920 llvm-svn: 300086
* llvm-lto2: Move the LTO::run() action behind a subcommand.Peter Collingbourne2017-04-111-5/+26
| | | | | | | | | | | | | Move LTO::run() to a "run" subcommand so that we can introduce new subcommands for testing different parts of the LTO implementation. This doesn't use llvm::cl subcommands because it doesn't appear to be currently possible to pass an argument not associated with a subcommand to a subcommand (e.g. -lto-use-new-pm, -mcpu=yonah). Differential Revision: https://reviews.llvm.org/D31410 llvm-svn: 299967
* More accurate header inclusions. NFC.Peter Collingbourne2017-03-281-1/+1
| | | | llvm-svn: 298960
* LTO: Fix a potential race condition in the caching API.Peter Collingbourne2017-03-171-8/+3
| | | | | | | | | | | | | | | | | | | | | After the call to sys::fs::exists succeeds, indicating a cache hit, we call AddFile and the client will open the file using the supplied path. If the client is using cache pruning, there is a potential race between the pruner and the client. To avoid this, change the caching API so that it provides a MemoryBuffer to the client, and have clients use that MemoryBuffer where possible. This scheme won't work with the gold plugin because the plugin API expects a file path. So we have the gold plugin use the buffer identifier as a path and live with the race for now. (Note that the gold plugin isn't actually affected by the problem at the moment because it doesn't support cache pruning.) This effectively reverts r279883 modulo the change to use the existing path in the gold plugin. Differential Revision: https://reviews.llvm.org/D31063 llvm-svn: 298020
* Fix test and add missing return for llvm-lto2 error caseTeresa Johnson2017-03-071-1/+3
| | | | | | | | | | | | | | | | | Summary: This test was missing the target triple. Once I fixed that, the case with the invalid character error stopped returning 1 from llvm-lto2 and the test reported a failure. Fixed by adding the missing return from llvm-lto2. Apparently we were failing when we eventually tried to get the target. Reviewers: pcc Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30585 llvm-svn: 297173
* LTO: When creating a local cache, create the cache directory if it does not ↵Peter Collingbourne2017-03-021-1/+1
| | | | | | | | already exist. Differential Revision: https://reviews.llvm.org/D30519 llvm-svn: 296726
* [LTO] Add ability to emit assembly to new LTO APITobias Edler von Koch2017-02-151-0/+3
| | | | | | | | | | | | | | | | Summary: Add a field to LTO::Config, CGFileType, to select the file type to emit (object or assembly). This is useful for testing and to implement -save-temps. Reviewers: tejohnson, mehdi_amini, pcc Reviewed By: mehdi_amini Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D29475 llvm-svn: 295226
* [llvm-lto2] Fix typo spotted by Teresa (r294885 post-commit review).Davide Italiano2017-02-131-2/+2
| | | | llvm-svn: 294962
* [lib/LTO] Add support for hotness optremarks in the new API.Davide Italiano2017-02-121-0/+6
| | | | llvm-svn: 294885
* [llvm-lto2] Fix typo in error message.Davide Italiano2017-02-121-1/+1
| | | | llvm-svn: 294883
* [lib/LTO] Initial support for optimization remarks in the new API.Davide Italiano2017-02-121-0/+7
| | | | llvm-svn: 294882
* llvm-lto2: remove leading '-' for cl::opt declarationMehdi Amini2016-12-231-1/+1
| | | | llvm-svn: 290464
* llvm-lto2: Print diagnostics before exiting (NFC)Mehdi Amini2016-12-231-1/+5
| | | | llvm-svn: 290463
* LTO: Hash the parts of the LTO configuration that affect code generation.Peter Collingbourne2016-12-081-0/+42
| | | | | | | | | Most importantly, we need to hash the relocation model, otherwise we can end up trying to link non-PIC object files into PIEs or DSOs. Differential Revision: https://reviews.llvm.org/D27556 llvm-svn: 289024
* llvm-lto2: Simpler workaround for PR30396.Peter Collingbourne2016-11-301-17/+10
| | | | | | | | | | | Maintain the command line resolutions as a map to a list of resolutions rather than a single resolution, and apply the resolutions in the order observed. This is not only simpler but allows us to test the scenario where the two symbols have different resolutions. Differential Revision: https://reviews.llvm.org/D27285 llvm-svn: 288288
* [CMake] llvm-lto2 depends on intrinsics_genChris Bieneman2016-11-191-0/+3
| | | | | | | | | | | | | | | llvm-lto2.cpp has the following include chain: llvm/LTO/Caching.h llvm/LTO/LTO.h llvm/CodeGen/Analysis.h llvm/IR/CallSite.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means llvm-lto2 needs to depend on intrinsics_gen. llvm-svn: 287434
* [ThinLTO] Disable importing and other cross-module optis at -O0Teresa Johnson2016-10-311-0/+7
| | | | | | | | | | | | | | | | Summary: There is no point to importing at -O0, since we won't inline. We should also disable other cross-module optimizations. (Plan to backport this fix to the 3.9 branch to fix PR30774) Reviewers: pcc Subscribers: johanengelen, mehdi_amini Differential Revision: https://reviews.llvm.org/D25918 llvm-svn: 285648
* [ThinLTO] Default backend threads to heavyweight_hardware_concurrencyTeresa Johnson2016-10-191-1/+2
| | | | | | | | | | | | | | | | | Summary: Changes default backend parallelism from thread::hardware_concurrency to the new llvm::heavyweight_hardware_concurrency, which for X86 Linux defaults to the number of physical cores (and will fall back to thread::hardware_concurrency otherwise). This avoid oversubscribing the physical cores using hyperthreading. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25775 llvm-svn: 284618
* [ThinLTO] Fix bot failure due to unused variable with NDEBUGTeresa Johnson2016-10-121-1/+4
| | | | | | | | | Put variable only used in assert under #ifndef NDEBUG. This should fix bot failure at http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/28537 llvm-svn: 284039
* [ThinLTO] Don't link module level assembly when importingTeresa Johnson2016-10-121-1/+11
| | | | | | | | | | | | | | | | | | | | | Module inline asm was always being linked/concatenated when running the IRLinker. This is correct for full LTO but not when we are importing for ThinLTO, as it can result in multiply defined symbols when the module asm defines a global symbol. In order to test with llvm-lto2, I had to work around PR30396, where a symbol that is defined in module assembly but defined in the LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME. Fixes PR30610. Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25359 llvm-svn: 284030
* LTO: Simplify caching interface.Peter Collingbourne2016-09-231-32/+21
| | | | | | | | | | | | | | | | | The NativeObjectOutput class has a design problem: it mixes up the caching policy with the interface for output streams, which makes the client-side code hard to follow and would for example make it harder to replace the cache implementation in an arbitrary client. This change separates the two aspects by moving the caching policy to a separate field in Config, replacing NativeObjectOutput with a NativeObjectStream class which only deals with streams and does not need to be overridden by most clients and introducing an AddFile callback for adding files (e.g. from the cache) to the link. Differential Revision: https://reviews.llvm.org/D24622 llvm-svn: 282299
* [LTO] Add ability to parse AA pipelines.Davide Italiano2016-09-161-0/+5
| | | | | | | This is supposed to be a drop in replacement for what lld provides via --lto-newpm-aa-pipeline. llvm-svn: 281774
* [lib/LTO] Add a way to run a custom pipelineDavide Italiano2016-09-071-0/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D24095 llvm-svn: 280830
* [ThinLTO] Move loading of cache entry to clientTeresa Johnson2016-08-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: Have the cache pass back the path to the cache entry when it is ready to be loaded, instead of a buffer. For gold-plugin we can simply pass this file back to gold directly, which avoids expensive writing of a separate tmp file. Ensure the cache entry is not deleted on cleanup by adjusting the setting of the IsTemporary flags. Moved the loading of the buffer into llvm-lto2 to maintain current behavior. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23946 llvm-svn: 279883
* [ThinLTO] Add caching to the new LTO APIMehdi Amini2016-08-231-2/+13
| | | | | | | | | | | | Add the ability to plug a cache on the LTO API. I tried to write such that a linker implementation can control the cache backend. This is intrusive and I'm not totally happy with it, but I can't figure out a better design right now. Differential Revision: https://reviews.llvm.org/D23599 llvm-svn: 279576
* [LTO] Add the ability to test -thinlto-emit-imports-files through llvm-lto2Mehdi Amini2016-08-191-1/+15
| | | | | | | | | | | | | | Summary: Start bringing llvm-lto2 to a level where we can test the LTO API a bit deeper. Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23681 llvm-svn: 279349
* [LTO] Change addSaveTemps API: do not add dot to the supplied prefix pathMehdi Amini2016-08-181-1/+2
| | | | | | | | | | | | | | | | Summary: It does not play well with directories (end up with a bunch of hidden files). Also, do not strip the 0 suffix for the first task, especially since 0 can be used by ThinLTO as well now. Reviewers: tejohnson Subscribers: mehdi_amini, pcc, llvm-commits Differential Revision: https://reviews.llvm.org/D23612 llvm-svn: 279014
* [LTO] Fix a use-after-free introduced in r278907 and caught by ASan.Chandler Carruth2016-08-171-3/+3
| | | | | | | | | The ASan build bot caught this right away: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15580/steps/check-llvm%20asan/logs/stdio This was also breaking a Windows build bot I'm pretty sure. llvm-svn: 278912
* [LTO] Introduce an Output class to wrap the output stream creation (NFC)Mehdi Amini2016-08-171-6/+19
| | | | | | | | | | | | | | | | | Summary: While NFC for now, this will allow more flexibility on the client side to hold state necessary to back up the stream. Also when adding caching, this class will grow in complexity. Note I blindly modified the gold-plugin as I can't compile it. Reviewers: tejohnson Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23542 llvm-svn: 278907
* Add (hopefully last) remaining missing dependences to llvm-lto2Teresa Johnson2016-08-112-1/+3
| | | | | | | | | | There are still a few missing symbols reported by: http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15535/steps/build_llvmclang/logs/stdio http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15535/steps/build_llvmclang/logs/stdio This should hopefully take care of them. llvm-svn: 278353
* More missing llvm-lto2 dependenciesTeresa Johnson2016-08-111-0/+2
| | | | | | Follow-on to r278341: Update CMakeLists.txt to match LLVMBuild.txt llvm-svn: 278349
* Fix bot failure from r278338 due to missing dependencesTeresa Johnson2016-08-111-1/+1
| | | | | | | | Add some missing dependences to the llvm-lto2 tool to attempt to appease missing symbols in link from bot: http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15527 llvm-svn: 278341
* Restore "Resolution-based LTO API."Teresa Johnson2016-08-113-0/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores commit r278330, with fixes for a few bot failures: - Fix a late change I had made to the save temps output file that I missed due to existing files sitting on my disk - Fix a bunch of Windows bot failures with "ambiguous call to overloaded function" due to confusion between llvm::make_unique vs std::make_unique (preface the new make_unique calls with "llvm::") - Attempt to fix a modules bot failure by adding a missing include to LTO/Config.h. Original change: Resolution-based LTO API. Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 llvm-svn: 278338
* Revert "Resolution-based LTO API."Teresa Johnson2016-08-113-200/+0
| | | | | | | | | | This reverts commit r278330. I made a change to the save temps output that is causing issues with the bots. Didn't realize this because I had older output files sitting on disk in my test output directory. llvm-svn: 278331
* Resolution-based LTO API.Teresa Johnson2016-08-113-0/+200
Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 Address review comments llvm-svn: 278330
OpenPOWER on IntegriCloud