File tree 1 file changed +5
-0
lines changed
compiler/rustc_codegen_llvm/src
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,11 @@ pub(crate) fn global_llvm_features(
536
536
// -Ctarget-cpu=native
537
537
match sess. opts . cg . target_cpu {
538
538
Some ( ref s) if s == "native" => {
539
+ // We have already figured out the actual CPU name with `LLVMRustGetHostCPUName` and set
540
+ // that for LLVM, so the features implied by that CPU name will be available everywhere.
541
+ // However, that is not sufficient: e.g. `skylake` alone is not sufficient to tell if
542
+ // some of the instructions are available or not. So we have to also explicitly ask for
543
+ // the exact set of features available on the host, and enable all of them.
539
544
let features_string = unsafe {
540
545
let ptr = llvm:: LLVMGetHostCPUFeatures ( ) ;
541
546
let features_string = if !ptr. is_null ( ) {
You can’t perform that action at this time.
0 commit comments