Skip to content

Conversation

@fneddy
Copy link
Contributor

@fneddy fneddy commented Feb 11, 2026

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(...)

to_add.extend(target_features_attr(cx, tcx, function_features));

pub(crate) fn target_features_attr<'ll, 'tcx>(
cx: &SimpleCx<'ll>,
tcx: TyCtxt<'tcx>,
function_features: Vec<String>,
) -> Option<&'ll Attribute> {
let global_features = tcx.global_backend_features(()).iter().map(String::as_str);
let function_features = function_features.iter().map(String::as_str);
let target_features =
global_features.chain(function_features).intersperse(",").collect::<String>();
(!target_features.is_empty())
.then(|| llvm::CreateAttrStringValue(cx.llcx, "target-features", &target_features))
}

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(...)`
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 11, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 11, 2026

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 67 candidates
  • Random selection from 15 candidates

@dingxiangfei2009
Copy link
Contributor

Thank you so much for your PR! 🙇

I don't see anything underhanded here.

@fneddy are you planning to add s390x codegen tests to demonstrate that all six target features are usable and propagated to the LLVM IR? It doesn't need to happen within this PR.

@fneddy
Copy link
Contributor Author

fneddy commented Feb 11, 2026

Hi,

backchain is already tested here. Is that sufficient or is there need for more? IMHO the test tests everything there is to backchain.

I am working also on packedstack attribute(#152432). There I will create excessive tests for all the possible combinations of softfloat+packedstack+backchain.

@fneddy
Copy link
Contributor Author

fneddy commented Feb 11, 2026

Ahh I see the test is for assembly. I could certainly create a test for the llvmir if wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants