There was an error while loading. Please reload this page.
1 parent 9903b25 commit a78fd69Copy full SHA for a78fd69
1 file changed
compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -536,6 +536,11 @@ pub(crate) fn global_llvm_features(
536
// -Ctarget-cpu=native
537
match sess.opts.cg.target_cpu{
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.
544
let features_string = unsafe{
545
let ptr = llvm::LLVMGetHostCPUFeatures();
546
let features_string = if !ptr.is_null(){
0 commit comments