summaryrefslogtreecommitdiffstats
path: root/llvm/test/LTO
Commit message (Collapse)AuthorAgeFilesLines
...
* IR: Replace the "Linker Options" module flag with "llvm.linker.options" ↵Peter Collingbourne2017-06-122-4/+4
| | | | | | | | | | named metadata. The new metadata is easier to manipulate than module flags. Differential Revision: https://reviews.llvm.org/D31349 llvm-svn: 305227
* [Linker] Remove warning when linking ARM and Thumb IR modules.Florian Hahn2017-06-072-0/+47
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch updates Triple::isCompatibleWith to make armxx and thumbxx triples compatible, as long as the subarch, vendor, os, envorionment and object format match. Thumb/ARM code generation should be controlled using the thumb-mode per-function target feature rather than by the triple to allow mixing Thumb and ARM functions. D33448 updates Clang's codegen to add thumb-mode for all functions with armxx or thumbxx triples. Reviewers: echristo, t.p.northover, rafael, kristof.beyls, rengolin, tejohnson Reviewed By: tejohnson Subscribers: rinon, eugenis, pcc, srhines, aemerson, mehdi_amini, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D33287 llvm-svn: 304884
* Symbols re-defined with -wrap and -defsym need to be excluded from inter-Dmitry Mikulin2017-06-051-0/+16
| | | | | | | | | | 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
* PMB: Run the whole-program-devirt pass during LTO at --lto-O0.Peter Collingbourne2017-05-261-0/+16
| | | | | | | | | | The whole-program-devirt pass needs to run at -O0 because only it knows about the llvm.type.checked.load intrinsic: it needs to both lower the intrinsic itself and handle it in the summary. Differential Revision: https://reviews.llvm.org/D33571 llvm-svn: 304019
* LTO: Do summary-based prevailing symbol resolution at --lto-O0.Peter Collingbourne2017-05-251-0/+11
| | | | | | | | | Prevailing symbol resolution is necessary for correctness. Without this we can end up dropping a referenced linkonce symbol from the link. Differential Revision: https://reviews.llvm.org/D33570 llvm-svn: 303939
* Revert "Revert "ThinLTO: Verify bitcode before lauching the ↵Adrian Prantl2017-05-203-2/+62
| | | | | | | | | | | | | ThinLTOCodeGenerator."" This reapplies commit r303438 modified to not verify cross-imported bitcode in FunctionImporter. rdar://problem/31233625 Differential Revision: https://reviews.llvm.org/D33370 llvm-svn: 303470
* Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."Adrian Prantl2017-05-193-62/+2
| | | | | | This reverts commit r303438 while deliberating buildbot breakage. llvm-svn: 303467
* ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.Adrian Prantl2017-05-193-2/+62
| | | | | | | | rdar://problem/31233625 Differential Revision: https://reviews.llvm.org/D33151 llvm-svn: 303438
* Add support for handling ifuncs to GlobalValue::getBaseObjectTeresa Johnson2017-05-151-0/+15
| | | | | | | | | | | | | | | | | Summary: All GlobalIndirectSymbol types (not just GlobalAlias) should return their base object. Without this patch LTO would warn "Unable to determine comdat of alias!" for an ifunc. Reviewers: pcc Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D33202 llvm-svn: 303096
* LTO: Mark undefined module asm symbols as used.Peter Collingbourne2017-04-262-0/+14
| | | | | | | | | | | | | | | | Marking them as used causes them to be considered visible outside of LTO. This prevents the symbols from being internalized or discarded, either by GlobalDCE or by summary-based dead stripping in ThinLTO. This change makes it unnecessary to add these symbols to llvm.compiler.used in the backend, as the symbols are kept alive by virtue of being external, so remove the backend code that handles that. Fixes PR32798. Differential Revision: https://reviews.llvm.org/D32544 llvm-svn: 301438
* Object, LTO: Add target triple to irsymtab and LTO API.Peter Collingbourne2017-04-142-1/+17
| | | | | | | | | | 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-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+47
| | | | | | | | 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-1115-30/+30
| | | | | | | | | | | | | 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
* Perform symbol binding for .symver versioned symbolsTeresa Johnson2017-03-092-6/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In a .symver assembler directive like: .symver name, name2@@nodename "name2@@nodename" should get the same symbol binding as "name". While the ELF object writer is updating the symbol binding for .symver aliases before emitting the object file, not doing so when the module inline assembly is handled by the RecordStreamer is causing the wrong behavior in *LTO mode. E.g. when "name" is global, "name2@@nodename" must also be marked as global. Otherwise, the symbol is skipped when iterating over the LTO InputFile symbols (InputFile::Symbol::shouldSkip). So, for example, when performing any *LTO via the gold-plugin, the versioned symbol definition is not recorded by the plugin and passed back to the linker. If the object was in an archive, and there were no other symbols needed from that object, the object would not be included in the final link and references to the versioned symbol are undefined. The llvm-lto2 tests added will give an error about an unused symbol resolution without the fix. Reviewers: rafael, pcc Reviewed By: pcc Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30485 llvm-svn: 297332
* Add a testcase for r297072.Adrian Prantl2017-03-071-0/+56
| | | | | | | Check that missing debug locations on inlinable calls are a recoverable error. llvm-svn: 297113
* Implement intrinsic mangling for literal struct types.Daniel Berlin2017-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes PR 31921 Summary: Predicateinfo requires an ugly workaround to try to avoid literal struct types due to the intrinsic mangling not being implemented. This workaround actually does not work in all cases (you can hit the assert by bootstrapping with -print-predicateinfo), and can't be made to work without DFS'ing the type (IE copying getMangledStr and using a version that detects if it would crash). Rather than do that, i just implemented the mangling. It seems simple, since they are unified structurally. Looking at the overloaded-mangling testcase we have, it actually turns out the gc intrinsics will *also* crash if you try to use a literal struct. Thus, the testcase added fails before this patch, and works after, without needing to resort to predicateinfo. Reviewers: chandlerc, davide Subscribers: llvm-commits, sanjoy Differential Revision: https://reviews.llvm.org/D29925 llvm-svn: 295253
* [LTO] Add ability to emit assembly to new LTO APITobias Edler von Koch2017-02-151-0/+19
| | | | | | | | | | | | | | | | 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
* [LTO] Remove useless redirection from test. NFCI.Davide Italiano2017-02-121-1/+1
| | | | llvm-svn: 294889
* [lib/LTO] Add support for hotness optremarks in the new API.Davide Italiano2017-02-121-0/+37
| | | | llvm-svn: 294885
* [LTO] Simplify this test quite a bit, @func2 is unused/unneeded.Davide Italiano2017-02-121-42/+0
| | | | llvm-svn: 294884
* [lib/LTO] Initial support for optimization remarks in the new API.Davide Italiano2017-02-121-0/+33
| | | | llvm-svn: 294882
* [tests] Be explicit about the files we want to remove.Davide Italiano2017-02-102-2/+2
| | | | | | Hopefully Windows will stop whining after this change. llvm-svn: 294801
* [LTO] Make these tests robust across multiple iterations.Davide Italiano2017-02-102-0/+2
| | | | | | Same as r294784, but for regular LTO. llvm-svn: 294789
* Temporarily revert "For X86-64 linux and PPC64 linux align int128 to 16 bytes."Eric Christopher2017-02-107-7/+7
| | | | | | | | | until we can get better TargetMachine::isCompatibleDataLayout to compare - otherwise we can't code generate existing bitcode without a string equality data layout. This reverts commit r294702. llvm-svn: 294709
* For X86-64 linux and PPC64 linux align int128 to 16 bytes.Eric Christopher2017-02-107-7/+7
| | | | | | | | | | | | For other platforms we should find out what they need and likely make the same change, however, a smaller additional change is easier for platforms we know have it specified in the ABI. As part of this rewrite some of the handling in the backends for data layout and update a bunch of testcases. Based on a patch by Simonas Kazlauskas! llvm-svn: 294702
* LTO: Link non-prevailing weak_odr or linkonce_odr globals into the combined ↵Peter Collingbourne2017-02-022-0/+19
| | | | | | | | | | | | module with available_externally linkage. These linkages mean that the ultimately prevailing symbol will have the same semantics as any non-prevailing copy of the symbol, so we are free to ignore the linker's resolution. Differential Revision: https://reviews.llvm.org/D29367 llvm-svn: 293865
* Linker: Move special casing for available_externally in IRMover to clients. ↵Peter Collingbourne2017-02-022-0/+31
| | | | | | | | | | NFCI. The goal is to simplify the semantic model for clients of IRMover. Differential Revision: https://reviews.llvm.org/D29435 llvm-svn: 293864
* IPO, LTO: Plumb the summary from the LTO API into the pass manager.Peter Collingbourne2017-01-201-0/+21
| | | | | | Differential Revision: https://reviews.llvm.org/D28840 llvm-svn: 292661
* Renumber testcase metadata nodes after r290153.Adrian Prantl2016-12-222-38/+37
| | | | | | | | | | | | | This patch renumbers the metadata nodes in debug info testcases after https://reviews.llvm.org/D26769. This is a separate patch because it causes so much churn. This was implemented with a python script that pipes the testcases through llvm-as - | llvm-dis - and then goes through the original and new output side-by side to insert all comments at a close-enough location. Differential Revision: https://reviews.llvm.org/D27765 llvm-svn: 290292
* [IR] Remove the DIExpression field from DIGlobalVariable.Adrian Prantl2016-12-202-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements PR31013 by introducing a DIGlobalVariableExpression that holds a pair of DIGlobalVariable and DIExpression. Currently, DIGlobalVariables holds a DIExpression. This is not the best way to model this: (1) The DIGlobalVariable should describe the source level variable, not how to get to its location. (2) It makes it unsafe/hard to update the expressions when we call replaceExpression on the DIGLobalVariable. (3) It makes it impossible to represent a global variable that is in more than one location (e.g., a variable with multiple DW_OP_LLVM_fragment-s). We also moved away from attaching the DIExpression to DILocalVariable for the same reasons. This reapplies r289902 with additional testcase upgrades and a change to the Bitcode record for DIGlobalVariable, that makes upgrading the old format unambiguous also for variables without DIExpressions. <rdar://problem/29250149> https://llvm.org/bugs/show_bug.cgi?id=31013 Differential Revision: https://reviews.llvm.org/D26769 llvm-svn: 290153
* Revert "[IR] Remove the DIExpression field from DIGlobalVariable."Adrian Prantl2016-12-162-2/+2
| | | | | | | | | | | | | | | | | This reverts commit 289920 (again). I forgot to implement a Bitcode upgrade for the case where a DIGlobalVariable has not DIExpression. Unfortunately it is not possible to safely upgrade these variables without adding a flag to the bitcode record indicating which version they are. My plan of record is to roll the planned follow-up patch that adds a unit: field to DIGlobalVariable into this patch before recomitting. This way we only need one Bitcode upgrade for both changes (with a version flag in the bitcode record to safely distinguish the record formats). Sorry for the churn! llvm-svn: 289982
* [IR] Remove the DIExpression field from DIGlobalVariable.Adrian Prantl2016-12-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements PR31013 by introducing a DIGlobalVariableExpression that holds a pair of DIGlobalVariable and DIExpression. Currently, DIGlobalVariables holds a DIExpression. This is not the best way to model this: (1) The DIGlobalVariable should describe the source level variable, not how to get to its location. (2) It makes it unsafe/hard to update the expressions when we call replaceExpression on the DIGLobalVariable. (3) It makes it impossible to represent a global variable that is in more than one location (e.g., a variable with multiple DW_OP_LLVM_fragment-s). We also moved away from attaching the DIExpression to DILocalVariable for the same reasons. This reapplies r289902 with additional testcase upgrades. <rdar://problem/29250149> https://llvm.org/bugs/show_bug.cgi?id=31013 Differential Revision: https://reviews.llvm.org/D26769 llvm-svn: 289920
* Revert "[IR] Remove the DIExpression field from DIGlobalVariable."Adrian Prantl2016-12-162-2/+2
| | | | | | This reverts commit 289902 while investigating bot berakage. llvm-svn: 289906
* [IR] Remove the DIExpression field from DIGlobalVariable.Adrian Prantl2016-12-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements PR31013 by introducing a DIGlobalVariableExpression that holds a pair of DIGlobalVariable and DIExpression. Currently, DIGlobalVariables holds a DIExpression. This is not the best way to model this: (1) The DIGlobalVariable should describe the source level variable, not how to get to its location. (2) It makes it unsafe/hard to update the expressions when we call replaceExpression on the DIGLobalVariable. (3) It makes it impossible to represent a global variable that is in more than one location (e.g., a variable with multiple DW_OP_LLVM_fragment-s). We also moved away from attaching the DIExpression to DILocalVariable for the same reasons. <rdar://problem/29250149> https://llvm.org/bugs/show_bug.cgi?id=31013 Differential Revision: https://reviews.llvm.org/D26769 llvm-svn: 289902
* [LTO] Add the missing datalayout in a test.Davide Italiano2016-12-141-0/+1
| | | | llvm-svn: 289720
* [LTO] Reject modules without datalayout.Davide Italiano2016-12-148-7/+11
| | | | | | | | | | | Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 llvm-svn: 289719
* LTO: Add support for multi-module bitcode files.Peter Collingbourne2016-12-143-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D27313 llvm-svn: 289621
* [LTOs] Allow generation of hotness informationAdam Nemet2016-12-021-0/+77
| | | | | | | | The flag is passed by the clang driver. Differential Revision: https://reviews.llvm.org/D27331 llvm-svn: 288519
* Make LTO opt-remarks tests matching stricterAdam Nemet2016-12-021-9/+9
| | | | | | This ensures that we don't generate the hotness attribute by default. llvm-svn: 288518
* 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
* Fix test from r287353: don't use /dev/nullHans Wennborg2016-11-181-1/+1
| | | | llvm-svn: 287360
* [LTO] Add option to generate optimization recordsAdam Nemet2016-11-181-0/+17
| | | | | | | | | | 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
* IRMover: Avoid accidentally mapping types from the destination module (PR30799)Hans Wennborg2016-11-182-0/+70
| | | | | | | | | | | | | | During Module linking, it's possible for SrcM->getIdentifiedStructTypes(); to return types that are actually defined in the destination module (DstM). Depending on how the bitcode file was read, getIdentifiedStructTypes() might do a walk over all values, including metadata nodes, looking for types. In my case, a debug info metadata node was shared between the two modules, and it referred to a type defined in the destination module (see test case). Differential Revision: https://reviews.llvm.org/D26212 llvm-svn: 287353
* Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm"Teresa Johnson2016-11-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores the rest of r286297 (part was restored in r286475). Specifically, it restores the part requiring adding a dependency from the Analysis to Object library (downstream use changed to correctly model split BitReader vs BitWriter libraries). Original description of this part of patch follows: Module level asm may also contain defs of values. We need to prevent export of any refs to local values defined in module level asm (e.g. a ref in normal IR), since that also requires renaming/promotion of the local. To do that, the summary index builder looks at all values in the module level asm string that are not marked Weak or Global, which is exactly the set of locals that are defined. A summary is created for each of these local defs and flagged as NoRename. This required adding handling to the BitcodeWriter to look at GV declarations to see if they have a summary (rather than skipping them all). Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to ensure that an MCAsmParser is available, otherwise the module asm parse would silently fail. Initialized the asm parser in the opt tool for use in testing this fix. Fixes PR30610. llvm-svn: 286844
* Revert "[ThinLTO] Prevent exporting of locals used/defined in module level asm"Mehdi Amini2016-11-091-3/+0
| | | | | | | | This reverts commit r286297. Introduces a dependency from libAnalysis to libObject, which I missed during the review. llvm-svn: 286329
* [ThinLTO] Prevent exporting of locals used/defined in module level asmTeresa Johnson2016-11-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch uses the same approach added for inline asm in r285513 to similarly prevent promotion/renaming of locals used or defined in module level asm. All static global values defined in normal IR and used in module level asm should be included on either the llvm.used or llvm.compiler.used global. The former were already being flagged as NoRename in the summary, and I've simply added llvm.compiler.used values to this handling. Module level asm may also contain defs of values. We need to prevent export of any refs to local values defined in module level asm (e.g. a ref in normal IR), since that also requires renaming/promotion of the local. To do that, the summary index builder looks at all values in the module level asm string that are not marked Weak or Global, which is exactly the set of locals that are defined. A summary is created for each of these local defs and flagged as NoRename. This required adding handling to the BitcodeWriter to look at GV declarations to see if they have a summary (rather than skipping them all). Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to ensure that an MCAsmParser is available, otherwise the module asm parse would silently fail. Initialized the asm parser in the opt tool for use in testing this fix. Fixes PR30610. Reviewers: mehdi_amini Subscribers: johanengelen, krasin, llvm-commits Differential Revision: https://reviews.llvm.org/D26146 llvm-svn: 286297
* LTO: Use the correct mangler function in ↵Peter Collingbourne2016-10-121-0/+10
| | | | | | | | | | | | 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
* Don't drop the llvm. prefix when renaming.Rafael Espindola2016-10-032-0/+12
| | | | | | | | | | If the llvm. prefix is dropped other parts of llvm don't see this as an intrinsic. This means that the number of regular symbols depends on the context the module is loaded into, which causes LTO to abort. Fixes PR30509. llvm-svn: 283117
* [LTO] Use llvm-nm instead of nm in new testsTeresa Johnson2016-09-161-2/+2
| | | | | | | | | | | The use of nm in the new tests added with r281725 caused a couple of bot failures: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15701 http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/6939 Use llvm-nm instead. llvm-svn: 281750
OpenPOWER on IntegriCloud