summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-27 23:38:54 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-27 23:38:54 +0000
commit5a490d00261aaf3def5d71240b174b1ff6cdbb9f (patch)
tree9b54163b016b9a9f3b7edafd3dbccbc043ed5d5d /llvm/lib/LTO/LTOCodeGenerator.cpp
parent67c03759e4f788d61c4475094295d42f7b8a2a15 (diff)
downloadbcm5719-llvm-5a490d00261aaf3def5d71240b174b1ff6cdbb9f.tar.gz
bcm5719-llvm-5a490d00261aaf3def5d71240b174b1ff6cdbb9f.zip
LTO: Add API to choose whether to embed uselists
Reverse libLTO's default behaviour for preserving use-list order in bitcode, and add API for controlling it. The default setting is now `false` (don't preserve them), which is consistent with `clang`'s default behaviour. Users of libLTO should call `lto_codegen_should_embed_uselists(CG,true)` prior to calling `lto_codegen_write_merged_modules()` whenever the output file isn't part of the production workflow in order to reproduce results with subsequent calls to `llc`. (I haven't added tests since `llvm-lto` (the test tool for LTO) doesn't support bitcode output, and even if it did: there isn't actually a good way to test whether a tool has passed the flag. If the order is already "natural" (if the order will already round-trip) then no use-list directives are emitted at all. At some point I'll circle back to add tests to `llvm-as` (etc.) that they actually respect the flag, at which point I can somehow add a test here as well.) llvm-svn: 235943
Diffstat (limited to 'llvm/lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 6a19849e668..3cf13a0ef2c 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -202,8 +202,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
}
// write bitcode to it
- WriteBitcodeToFile(IRLinker.getModule(), Out.os(),
- /* ShouldPreserveUseListOrder */ true);
+ WriteBitcodeToFile(IRLinker.getModule(), Out.os(), ShouldEmbedUselists);
Out.os().close();
if (Out.os().has_error()) {
OpenPOWER on IntegriCloud