diff options
| author | bors <bors@rust-lang.org> | 2021-01-09 04:36:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-09 04:36:24 +0000 |
| commit | c87ef0a2fcedaa865ff7713953824d0ea9734720 (patch) | |
| tree | 20881fcd1e9c6f9bd525434b29959eff51f3b725 /compiler/rustc_codegen_llvm/src/back/write.rs | |
| parent | 26438b473883ea607b30288e461187f0fb2fe589 (diff) | |
| parent | 80ca198212e967684557075b2f86b44e18048c70 (diff) | |
| download | rust-c87ef0a2fcedaa865ff7713953824d0ea9734720.tar.gz rust-c87ef0a2fcedaa865ff7713953824d0ea9734720.zip | |
Auto merge of #80749 - as-com:target-cpu-actually-native, r=nagisa
Make target-cpu=native detect individual features This PR makes target-cpu=native check for and enable/disable individual features instead of detecting and targeting a CPU by name. This brings the flag's behavior more in line with clang and gcc and ensures that the host actually supports each feature that we are compiling for. This should resolve issues with miscompilations on e.g. "Haswell" Pentiums and Celerons that lack support for AVX, and also enable support for `aes` on Broadwell processors that support it. It should also resolve issues with failing to detect feature support in newer CPUs that aren't yet known by LLVM (see: #80633). Fixes #54688 Fixes #48464 Fixes #38218
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 230e11f274e..68f319ade1e 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -164,7 +164,8 @@ pub fn target_machine_factory( let code_model = to_llvm_code_model(sess.code_model()); - let features = attributes::llvm_target_features(sess).collect::<Vec<_>>(); + let mut features = llvm_util::handle_native_features(sess); + features.extend(attributes::llvm_target_features(sess).map(|s| s.to_owned())); let mut singlethread = sess.target.singlethread; // On the wasm target once the `atomics` feature is enabled that means that |
