mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
remove redundant backchain attribute in codegen
llvm will look at both 1. the values of "target-features" and 2. the function string attributes. this removes the redundant function string attribute because it is not needed at all. rustc sets the `+backchain` attribute through `target_features_attr(...)`
This commit is contained in:
@@ -301,17 +301,6 @@ fn stackprotector_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll A
|
||||
Some(sspattr.create_attr(cx.llcx))
|
||||
}
|
||||
|
||||
fn backchain_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
if sess.target.arch != Arch::S390x {
|
||||
return None;
|
||||
}
|
||||
|
||||
let requested_features = sess.opts.cg.target_feature.split(',');
|
||||
let found_positive = requested_features.clone().any(|r| r == "+backchain");
|
||||
|
||||
if found_positive { Some(llvm::CreateAttrString(cx.llcx, "backchain")) } else { None }
|
||||
}
|
||||
|
||||
pub(crate) fn target_cpu_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> &'ll Attribute {
|
||||
let target_cpu = llvm_util::target_cpu(sess);
|
||||
llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu)
|
||||
@@ -530,9 +519,6 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
if let Some(align) = codegen_fn_attrs.alignment {
|
||||
llvm::set_alignment(llfn, align);
|
||||
}
|
||||
if let Some(backchain) = backchain_attr(cx, sess) {
|
||||
to_add.push(backchain);
|
||||
}
|
||||
to_add.extend(patchable_function_entry_attrs(
|
||||
cx,
|
||||
sess,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//@ add-minicore
|
||||
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu -Ctarget-feature=+backchain
|
||||
//@ needs-llvm-components: systemz
|
||||
#![crate_type = "lib"]
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
#[no_mangle]
|
||||
pub fn test_backchain() {
|
||||
// CHECK: @test_backchain() unnamed_addr #0
|
||||
}
|
||||
// CHECK: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+backchain{{.*}} }
|
||||
Reference in New Issue
Block a user