Skip to content

Commit 4e678ba

Browse files
authored
Unrolled build for #152486
Rollup merge of #152486 - fneddy:s390x_simplify_backchain, r=dingxiangfei2009 remove redundant backchain attribute in codegen llvm will look at both 1. the values of `"target-features"` and 2. the function string attributes. this patch removes the redundant function string attribute because it is not needed at all. rustc sets the `+backchain` attribute through `target_features_attr(...)` https://github.com/rust-lang/rust/blob/d34f1f931489618efffc4007e6b6bdb9e10f6467/compiler/rustc_codegen_llvm/src/attributes.rs#L590 https://github.com/rust-lang/rust/blob/d34f1f931489618efffc4007e6b6bdb9e10f6467/compiler/rustc_codegen_llvm/src/attributes.rs#L326-L337
2 parents 47611e1 + c6f57be commit 4e678ba

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,6 @@ fn stackprotector_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll A
301301
Some(sspattr.create_attr(cx.llcx))
302302
}
303303

304-
fn backchain_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
305-
if sess.target.arch != Arch::S390x {
306-
return None;
307-
}
308-
309-
let requested_features = sess.opts.cg.target_feature.split(',');
310-
let found_positive = requested_features.clone().any(|r| r == "+backchain");
311-
312-
if found_positive { Some(llvm::CreateAttrString(cx.llcx, "backchain")) } else { None }
313-
}
314-
315304
pub(crate) fn target_cpu_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> &'ll Attribute {
316305
let target_cpu = llvm_util::target_cpu(sess);
317306
llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu)
@@ -530,9 +519,6 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
530519
if let Some(align) = codegen_fn_attrs.alignment {
531520
llvm::set_alignment(llfn, align);
532521
}
533-
if let Some(backchain) = backchain_attr(cx, sess) {
534-
to_add.push(backchain);
535-
}
536522
to_add.extend(patchable_function_entry_attrs(
537523
cx,
538524
sess,

tests/codegen-llvm/backchain.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ add-minicore
2+
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu -Ctarget-feature=+backchain
3+
//@ needs-llvm-components: systemz
4+
#![crate_type = "lib"]
5+
#![feature(no_core, lang_items)]
6+
#![no_core]
7+
8+
extern crate minicore;
9+
use minicore::*;
10+
11+
#[no_mangle]
12+
pub fn test_backchain() {
13+
// CHECK: @test_backchain() unnamed_addr #0
14+
}
15+
// CHECK: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+backchain{{.*}} }

0 commit comments

Comments
 (0)