mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
rustc: Actually write the optimized bitcode when --save-temps is on
This commit is contained in:
parent
8216b5fc10
commit
532a65485d
@ -7110,18 +7110,6 @@ fn run_passes(ModuleRef llmod, bool opt, bool verify, bool save_temps,
|
|||||||
llvm.LLVMAddStripDeadPrototypesPass(pm.llpm);
|
llvm.LLVMAddStripDeadPrototypesPass(pm.llpm);
|
||||||
llvm.LLVMAddDeadTypeEliminationPass(pm.llpm);
|
llvm.LLVMAddDeadTypeEliminationPass(pm.llpm);
|
||||||
llvm.LLVMAddConstantMergePass(pm.llpm);
|
llvm.LLVMAddConstantMergePass(pm.llpm);
|
||||||
|
|
||||||
// Generate a post-optimization intermediate file if -save-temps was
|
|
||||||
// specified.
|
|
||||||
if (save_temps) {
|
|
||||||
alt (ot) {
|
|
||||||
case (output_type_bitcode) { /* nothing to do */ }
|
|
||||||
case (_) {
|
|
||||||
auto filename = mk_intermediate_name(output, "opt.bc");
|
|
||||||
llvm.LLVMWriteBitcodeToFile(llmod, _str.buf(filename));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
@ -7140,6 +7128,19 @@ fn run_passes(ModuleRef llmod, bool opt, bool verify, bool save_temps,
|
|||||||
FileType = LLVMAssemblyFile;
|
FileType = LLVMAssemblyFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write optimized bitcode if --save-temps was on.
|
||||||
|
if (save_temps) {
|
||||||
|
alt (ot) {
|
||||||
|
case (output_type_bitcode) { /* nothing to do */ }
|
||||||
|
case (_) {
|
||||||
|
auto filename = mk_intermediate_name(output, "opt.bc");
|
||||||
|
llvm.LLVMRunPassManager(pm.llpm, llmod);
|
||||||
|
llvm.LLVMWriteBitcodeToFile(llmod, _str.buf(filename));
|
||||||
|
pm = mk_pass_manager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llvm.LLVMRustWriteOutputFile(pm.llpm, llmod,
|
llvm.LLVMRustWriteOutputFile(pm.llpm, llmod,
|
||||||
_str.buf(x86.get_target_triple()),
|
_str.buf(x86.get_target_triple()),
|
||||||
_str.buf(output),
|
_str.buf(output),
|
||||||
|
Loading…
Reference in New Issue
Block a user