diff options
| author | kennytm <kennytm@gmail.com> | 2018-05-24 16:02:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-24 16:02:41 +0800 |
| commit | e14bc2d3d4fa637044446880bbd0e17d265670f9 (patch) | |
| tree | 286853a230674cf7aa8b80098f06223412a72774 /src | |
| parent | eb26c9b390306592458de3731c46e9c1643d4ccf (diff) | |
| parent | 54f0668a1084b8e64355de5b194fc2fd02fe3854 (diff) | |
Rollup merge of #50972 - nikic:no-parallel, r=michaelwoerister
Add -Z no-parallel-llvm flag Codegen issues commonly only manifest under specific circumstances, e.g. if multiple codegen units are used and ThinLTO is enabled. However, these configuration are threaded, making the use of LLVM debugging facilities hard, as output is interleaved. This patch adds a -Z no-parallel-llvm flag, which allows disabling parallelization of codegen and linking, while otherwise preserving behavior with regard to codegen units and LTO.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/session/config.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/back/write.rs | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 960bbfdd1ef..b3f1b9c8e62 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1337,6 +1337,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "enable the experimental Chalk-based trait solving engine"), cross_lang_lto: CrossLangLto = (CrossLangLto::Disabled, parse_cross_lang_lto, [TRACKED], "generate build artifacts that are compatible with linker-based LTO."), + no_parallel_llvm: bool = (false, parse_bool, [UNTRACKED], + "don't run LLVM in parallel (while keeping codegen-units and ThinLTO)"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 1151e013131..baab3c618be 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -1738,7 +1738,9 @@ fn start_executing_work(tcx: TyCtxt, .binary_search_by_key(&cost, |&(_, cost)| cost) .unwrap_or_else(|e| e); work_items.insert(insertion_index, (work, cost)); - helper.request_token(); + if !cgcx.opts.debugging_opts.no_parallel_llvm { + helper.request_token(); + } } } @@ -1842,7 +1844,9 @@ fn start_executing_work(tcx: TyCtxt, }; work_items.insert(insertion_index, (llvm_work_item, cost)); - helper.request_token(); + if !cgcx.opts.debugging_opts.no_parallel_llvm { + helper.request_token(); + } assert_eq!(main_thread_worker_state, MainThreadWorkerState::Codegenning); main_thread_worker_state = MainThreadWorkerState::Idle; |
