summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/gold
Commit message (Collapse)AuthorAgeFilesLines
...
* gold: Make powerpc support optional for the tests.Peter Collingbourne2015-03-191-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D8400 llvm-svn: 232744
* Bring r231132 back with a fix.Rafael Espindola2015-03-041-0/+22
| | | | | | | | | | The issue was that we were always printing the remarks. Fix that and add a test showing that it prints nothing if -pass-remarks is not given. Original message: Correctly handle -pass-remarks in the gold plugin. llvm-svn: 231273
* Revert r231132, "Correctly handle -pass-remarks in the gold plugin.", for ↵NAKAMURA Takumi2015-03-041-17/+0
| | | | | | now, to suppress log floodng in LTO. llvm-svn: 231253
* Correctly handle -pass-remarks in the gold plugin.Rafael Espindola2015-03-031-0/+17
| | | | llvm-svn: 231132
* Add r230655 back with a fix.Rafael Espindola2015-03-022-0/+8
| | | | | | | | | | | | | | | | | | | | The issue is that now we have a diag handler during optimizations and get forward every optimization remark, flooding stdout. The same filtering should probably be done with or without a custom handler, but for now just ignore remarks. Original message: gold-plugin: "Upgrade" debug info and handle its warnings. The gold plugin never calls MaterializeModule, so any old debug info was not deleted and could cause crashes. Now that it is being "upgraded", the plugin also has to handle warnings and create Modules with a nice id (it shows in the warning). llvm-svn: 230991
* Revert r230655, "gold-plugin: "Upgrade" debug info and handle its warnings."NAKAMURA Takumi2015-03-012-8/+0
| | | | | | It emits *millions of warnings* during selfhosting LTO build, to choke the buildbot with gigbytes of log. llvm-svn: 230885
* Remove option.ll as part of the Forward Control Flow IntegrityEric Christopher2015-02-281-39/+0
| | | | | | removal. llvm-svn: 230844
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-272-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | load instruction Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-272-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
* gold-plugin: "Upgrade" debug info and handle its warnings.Rafael Espindola2015-02-262-0/+8
| | | | | | | | | | The gold plugin never calls MaterializeModule, so any old debug info was not deleted and could cause crashes. Now that it is being "upgraded", the plugin also has to handle warnings and create Modules with a nice id (it shows in the warning). llvm-svn: 230655
* gold-plugin: fix test to allow default visibility on local symbolsMichael Kuperstein2015-02-151-1/+1
| | | | | | | | | GNU ld sets default, not hidden, visibility on local symbols. Having default or hidden visibility on local symbols makes no difference in run-time behavior. Patch by: H.J. Lu <hjl.tools@gmail.com> llvm-svn: 229297
* [gold] Consolidate the gold plugin options and actually search forChandler Carruth2015-02-1418-23/+23
| | | | | | | | | | | | | | | | a gold binary explicitly. Substitute this binary into the tests rather than just directly executing the 'ld' binary. This should allow folks to inject a cross compiling gold binary, or in my case to use a gold binary built and installed somewhere other than /usr/bin/ld. It should also allow the tests to find 'ld.gold' so that things work even if gold isn't the default on the system. I've only stubbed out support in the makefile to preserve the existing behavior with none of the fancy logic. If someone else wants to add logic here, they're welcome to do so. llvm-svn: 229251
* Gold-plugin: Broaden scope of get/release_input_file to scope of Module.Jan Wen Voung2015-02-111-0/+9
| | | | | | | | | | | | | | | | | | | | Summary: Move calls to get_input_file and release_input_file out of getModuleForFile(). Otherwise release_input_file may end up unmapping a view of the file while the view is still being used by the Module (on 32-bit hosts). Fix for PR22482. Test Plan: Add test using --no-map-whole-files. Reviewers: rafael, nlewycky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7539 llvm-svn: 228842
* Fix linking of shared libraries.Rafael Espindola2015-01-141-0/+8
| | | | | | | In shared libraries the plugin can see non-weak declarations that are still undefined. llvm-svn: 226031
* Fix handling of extern_weak. This was broken by r225983.Rafael Espindola2015-01-141-0/+8
| | | | llvm-svn: 226026
* Handle a symbol being undefined.Rafael Espindola2015-01-141-0/+5
| | | | | | | | | | | | | This can happen if: * It is present in a comdat in one file. * It is not present in the comdat of the file that is kept. * Is is not used. This should fix the LTO boostrap. Thanks to Takumi NAKAMURA for setting up the bot! llvm-svn: 225983
* Change the .ll syntax for comdats and add a syntactic sugar.Rafael Espindola2015-01-062-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to make comdats always explicit in the IR, we decided to make the syntax a bit more compact for the case of a GlobalObject in a comdat with the same name. Just dropping the $name causes problems for @foo = globabl i32 0, comdat $bar = comdat ... and declare void @foo() comdat $bar = comdat ... So the syntax is changed to @g1 = globabl i32 0, comdat($c1) @g2 = globabl i32 0, comdat and declare void @foo() comdat($c1) declare void @foo() comdat llvm-svn: 225302
* Remember the unmangled name in the plugin.Rafael Espindola2014-12-091-0/+22
| | | | | | | | | This allows it to work with non trivial manglings like the one in COFF. Amusingly, this can be tested with gold, as emit-llvm causes the plugin to exit before any COFF is generated. llvm-svn: 223790
* This test requires asserts because of -stats.Rafael Espindola2014-11-251-0/+2
| | | | | | Sorry about that. llvm-svn: 222788
* gold plugin: call llvm_shutdown so that -stats works.Rafael Espindola2014-11-251-0/+5
| | | | llvm-svn: 222787
* Add a disable-output option to the gold plugin.Rafael Espindola2014-11-241-0/+6
| | | | | | This corresponds to the opt option and is handy for profiling. llvm-svn: 222687
* Fix the test.Rafael Espindola2014-11-121-2/+10
| | | | | | It was broken since r221708. llvm-svn: 221783
* Enable the slp vectorizer in the gold plugin.Rafael Espindola2014-10-301-0/+30
| | | | llvm-svn: 220887
* Enable the loop vectorizer in the gold plugin.Rafael Espindola2014-10-301-0/+30
| | | | llvm-svn: 220886
* Replace also-emit-llvm with save-temps.Rafael Espindola2014-10-291-7/+9
| | | | | | | | The also-emit-llvm option only supported getting the IR before optimizations. This patch replaces it with a more generic save-temps option that saves the IR both before and after optimizations. llvm-svn: 220885
* gold plugin: Handle gold selecting a linkonce GV when a weak is present.Rafael Espindola2014-10-072-0/+22
| | | | | | | | | The plugin API doesn't have the notion of linkonce, only weak. It is up to the plugin to figure out if a symbol used only for the symbol table can be dropped. In particular, it has to avoid dropping a linkonce_odr selected by gold if there is also a weak_odr. llvm-svn: 219188
* gold plugin: create internal replacement with original linkage first.Rafael Espindola2014-10-072-2/+2
| | | | | | | | | The call to copyAttributesFrom will copy the visibility, which might assert if it were to produce something invalid like "internal hidden". We avoid it by first creating the replacement with the original linkage and then setting it to internal affter the call to copyAttributesFrom. llvm-svn: 219184
* gold plugin: Remap function arguments when creating a replacement function.Rafael Espindola2014-10-072-16/+18
| | | | | | | | When creating an internal function replacement for use in an alias we were not remapping the argument uses in the instructions to point to the new arguments. llvm-svn: 219177
* LTO: introduce object file-based on-disk module format.Peter Collingbourne2014-09-182-0/+13
| | | | | | | | | | | | | | | | | | This format is simply a regular object file with the bitcode stored in a section named ".llvmbc", plus any number of other (non-allocated) sections. One immediate use case for this is to accommodate compilation processes which expect the object file to contain metadata in non-allocated sections, such as the ".go_export" section used by some Go compilers [1], although I imagine that in the future we could consider compiling parts of the module (such as large non-inlinable functions) directly into the object file to improve LTO efficiency. [1] http://golang.org/doc/install/gccgo#Imports Differential Revision: http://reviews.llvm.org/D4371 llvm-svn: 218078
* Internalize common symbols when we can.Rafael Espindola2014-09-171-0/+18
| | | | | | This fixes pr20974. llvm-svn: 217981
* Remember to eraseFromParent after replaceAllUsesWith.Rafael Espindola2014-09-101-2/+4
| | | | llvm-svn: 217536
* Handle common linkage correctly in the gold plugin.Rafael Espindola2014-09-092-0/+12
| | | | | | | | | | This is the plugin version of pr20882. This handles the case of every common symbol being in the IR. We will need some support from gold to handle the case where some symbols are in ELF and some in the IR. llvm-svn: 217458
* The gold tests also require ppc to be compiled in.Rafael Espindola2014-09-051-1/+2
| | | | | | | We could create a tools/gold/PowerPC and a tools/gold/X86, but it doesn't seem worth it. llvm-svn: 217267
* Update to not depend on "llvm-objdump -d -symbolize".Rafael Espindola2014-09-031-4/+10
| | | | llvm-svn: 217047
* Add support for comdats to the gold plugin.Rafael Espindola2014-08-223-0/+96
| | | | | | | | | | | | | | | | | | | | | | | There are two parts to this. First, the plugin needs to tell gold the comdat by setting comdat_key. What gets things a bit more complicated is that gold only seems symbols. In particular, if A is an alias to B, it only sees the symbols A and B. It can then ask us to keep symbol A but drop symbol B. What we have to do instead is to create an internal version of B and make A an alias to that. At some point some of this logic should be moved to lib/Linker so that we don't map a Constant to an internal version just to have lib/Linker map that again to the destination module. The reason for implementing this in tools/gold for now is simplicity. With it in place it should be possible to update clang to use comdats for constructors and destructors on ELF without breaking the LTO bootstrap. Once that is done I intend to come back and improve the interface lib/Linker exposes. llvm-svn: 216302
* Rewrite the gold plugin to fix pr19901.Rafael Espindola2014-08-216-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a fundamental difference between how the gold API and lib/LTO view the LTO process. The gold API talks about a particular symbol in a particular file. The lib/LTO API talks about a symbol in the merged module. The merged module is then defined in terms of the IR semantics. In particular, a linkonce_odr GV is only copied if it is used, since it is valid to drop unused linkonce_odr GVs. In the testcase in pr19901 both properties collide. What happens is that gold asks us to keep a particular linkonce_odr symbol, but the IR linker doesn't copy it to the merged module and we never have a chance to ask lib/LTO to keep it. This patch fixes it by having a more direct implementation of the gold API. If it asks us to keep a symbol, we change the linkage so it is not linkonce. If it says we can drop a symbol, we do so. All of this before we even send the module to lib/Linker. Since now we don't have to produce LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN, during symbol resolution we can use a temporary LLVMContext and do lazy module loading. This allows us to keep the minimum possible amount of allocated memory around. This should also allow as much parallelism as we want, since there is no shared context. llvm-svn: 216215
* Make the test a bit more strict.Rafael Espindola2014-08-121-2/+2
| | | | | | | Before it would pass even if @b or @c ended up pointing to a variable named @a123. llvm-svn: 215450
* Add a plugin testcase for merging weak variables.Rafael Espindola2014-08-122-0/+18
| | | | | | | | | I initially thought I could implement COMDATs with aliases by just internalizing GVs instead of dropping them. This is a counter example: Internalizing one of the @a would make @b and @c point to different variables. llvm-svn: 215447
* Fix using -plugin-opt=apiflie when also using -plugin-opt=emit-llvm.Rafael Espindola2014-08-111-0/+8
| | | | llvm-svn: 215378
* Fix test failure on ARM.Rafael Espindola2014-08-071-2/+2
| | | | llvm-svn: 215140
* Add a test showing the interaction of linker scripts and plugin.Rafael Espindola2014-08-052-0/+22
| | | | | | | In particular, the linker script is processed early enough for function g to be internalized. llvm-svn: 214916
* Add a small test showing when a linkonce_odr symbol can be hidden.Rafael Espindola2014-07-301-5/+28
| | | | llvm-svn: 214311
* gold plugin: Fix handling of corrupted bitcode files.Rafael Espindola2014-07-292-0/+7
| | | | | | We should still claim them and tell gold about the error. llvm-svn: 214214
* Add a test for the mtriple plugin option.Rafael Espindola2014-07-291-0/+7
| | | | llvm-svn: 214186
* Test the linker plugin handling of llvm.used.Rafael Espindola2014-07-281-1/+13
| | | | llvm-svn: 214116
* Add tests for the various emit-llvm plugin options.Rafael Espindola2014-07-281-0/+18
| | | | llvm-svn: 214102
* Test the mcpu option.Rafael Espindola2014-07-281-1/+8
| | | | llvm-svn: 214087
* Start adding some tests for the gold plugin.Rafael Espindola2014-07-272-0/+27
These are only used when the 'ld' in the path is gold and the plugin has been built, but it is already a start to make sure we don't regress features that cannot be tested with llvm-lto. llvm-svn: 214058
OpenPOWER on IntegriCloud