Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ pub(crate) fn global_llvm_features(sess: &Session, only_base_features: bool) ->

features_string
};
features.extend(features_string.split(',').map(String::from));
if !features_string.is_empty() {
features.extend(features_string.split(',').map(String::from));
}
}
Some(_) | None => {}
};
Expand Down
8 changes: 8 additions & 0 deletions tests/run-make/target-cpu-native/foo.rs
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
fn main() {}

// This forces explicit emission of a +neon target feature on targets
// where it is implied by the target-cpu, like aarch64-apple-darwin.
// This is a regression test for #153397.
#[cfg(target_feature = "neon")]
#[target_feature(enable = "neon")]
#[unsafe(no_mangle)]
pub fn with_neon() {}
7 changes: 6 additions & 1 deletion tests/run-make/target-cpu-native/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
use run_make_support::{run, rustc};

fn main() {
let out = rustc().input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8();
let out = rustc()
.input("foo.rs")
.arg("-Ctarget-cpu=native")
.arg("-Zverify-llvm-ir")
.run()
.stderr_utf8();
run("foo");
// There should be zero warnings emitted - the bug would cause "unknown CPU `native`"
// to be printed out.
Expand Down
Loading