diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-14 18:30:13 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-14 18:30:13 +0000 |
commit | d863f6f250e0cd459abb3a48ed9227634ed9774b (patch) | |
tree | 3280f80d2bb9fba2187e399c0fcb1039cac78f10 /clang/lib/Driver/Tools.cpp | |
parent | 8d2aff07dacbd19f270d15e4f24d6525190334be (diff) | |
download | bcm5719-llvm-d863f6f250e0cd459abb3a48ed9227634ed9774b.tar.gz bcm5719-llvm-d863f6f250e0cd459abb3a48ed9227634ed9774b.zip |
IR: Change clang to set -preserve-bc-uselistorder
Change `clang` to set `-preserve-bc-uselistorder` for the driver options
`-emit-llvm` and `-save-temps`. The former is useful for reproducing
results from `clang` in `opt` or `llc`, while the latter prevents
`-save-temps` from affecting the output. This is part of PR5680.
`-preserve-bc-uselistorder=true` is currently on by default, but a
follow-up commit in LLVM will reverse it.
llvm-svn: 234920
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 1e34d7f403a..2d2526c4bdf 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2678,6 +2678,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, assert(JA.getType() == types::TY_PP_Asm && "Unexpected output type!"); } + + // Preserve use-list order by default when emitting bitcode, so that + // loading the bitcode up in 'opt' or 'llc' and running passes gives the + // same result as running passes here. For LTO, we don't need to preserve + // the use-list order, since serialization to bitcode is part of the flow. + if (JA.getType() == types::TY_LLVM_BC) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-preserve-bc-uselistorder"); + } } // We normally speed up the clang process a bit by skipping destructors at |