From b5361d0d41871874926bd489b8dc014a016c3f52 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 21 Dec 2017 07:03:16 -0800 Subject: rustc: Set release mode cgus to 16 by default This commit is the next attempt to enable multiple codegen units by default in release mode, getting some of those sweet, sweet parallelism wins by running codegen in parallel. Performance should not be lost due to ThinLTO being on by default as well. Closes #45320 --- src/rustllvm/PassWrapper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/rustllvm/PassWrapper.cpp') diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 776e4a3e65a..4e326c9e199 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -1182,6 +1182,15 @@ LLVMRustThinLTOPatchDICompileUnit(LLVMModuleRef Mod, DICompileUnit *Unit) { MD->addOperand(Unit); } +extern "C" void +LLVMRustThinLTORemoveAvailableExternally(LLVMModuleRef Mod) { + Module *M = unwrap(Mod); + for (Function &F : M->functions()) { + if (F.hasAvailableExternallyLinkage()) + F.deleteBody(); + } +} + #else extern "C" bool @@ -1272,4 +1281,10 @@ extern "C" void LLVMRustThinLTOPatchDICompileUnit(LLVMModuleRef Mod) { report_fatal_error("ThinLTO not available"); } + +extern "C" void +LLVMRustThinLTORemoveAvailableExternally(LLVMModuleRef Mod) { + report_fatal_error("ThinLTO not available"); +} + #endif // LLVM_VERSION_GE(4, 0) -- cgit 1.4.1-3-g733a5