diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-03 23:21:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-03 23:21:41 +0200 |
| commit | 796bc7e9aafd3592063a485f9abed0bb65f01ba8 (patch) | |
| tree | 1e7b155cdf8d2c30c04946be1efb93c53ee2dea3 /compiler/rustc_codegen_gcc | |
| parent | 2ad4eb207b369017f5140918b5e4b0d3650b46b0 (diff) | |
| parent | 1a1f5b89a4acf44fc4720c097b4bbcebcfa26818 (diff) | |
| download | rust-796bc7e9aafd3592063a485f9abed0bb65f01ba8.tar.gz rust-796bc7e9aafd3592063a485f9abed0bb65f01ba8.zip | |
Rollup merge of #95202 - Urgau:check-cfg-perf-well-known-values, r=petrochenkov
Reduce the cost of loading all built-ins targets This PR started by measuring the exact slowdown of checking of well known conditional values. Than this PR implemented some technics to reduce the cost of loading all built-ins targets. cf. https://github.com/rust-lang/rust/issues/82450#issuecomment-1073992323
Diffstat (limited to 'compiler/rustc_codegen_gcc')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index eac4a06226c..497a28354d8 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -287,8 +287,10 @@ fn handle_native(name: &str) -> &str { } pub fn target_cpu(sess: &Session) -> &str { - let name = sess.opts.cg.target_cpu.as_ref().unwrap_or(&sess.target.cpu); - handle_native(name) + match sess.opts.cg.target_cpu { + Some(ref name) => handle_native(name), + None => handle_native(sess.target.cpu.as_ref()), + } } pub fn target_features(sess: &Session) -> Vec<Symbol> { |
