Remove unsound target_feature_inline_always feature#156242
Remove unsound target_feature_inline_always feature#156242Jamesbarford wants to merge 3 commits intorust-lang:mainfrom
target_feature_inline_always feature#156242Conversation
|
cc @Amanieu, @folkertdev, @sayantn Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
|
|
That's unfortunate, but makes sense. One thing I'm worried about here is terrible merge conflicts with |
We already do error for that, so what are you changing here? So this amounts to "just" removing the Also Cc @davidtwco |
|
No that's what happens when you update the generators and the inline annotation on most generated functions changes. Those changes are uninteresting but really inflate the line count. |
Yes 👍, I'll remove that from the description |
target_feature_inline_always feature
|
I had suggested to @Jamesbarford that we remove the uses in stdarch in this PR just to avoid the hassle of having to wait for syncs to happen before being able to make the change in rustc, but I don't feel too strongly, if we'd prefer to land the change in stdarch first and then land this after a sync, happy to do it that way too. |
|
We're not in a rush here I think, and the sync with |
This comment has been minimized.
This comment has been minimized.
…pport, reinstating error message and providing a link to the tracking issue for the full rationale.
a0d1b36 to
311cda6
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Summary
target_feature_inline_always#[inline]& regenerate stdarch.Why?
Succinctly; the feature relies on LLVMs
AlwaysInlinerPass()running before LLVMs heuristic based inliner pass. Which is not a basis for sound code.This has been discussed in the tracking issue.
If the ordering of the passes were to change, of which they have in the past, it is very possible we could inline functions across callsites with mismatching target features leading to unsound code. Checks proposed in; #155426 would only take into account caller -> callee which is not enough to guard against possibly of generating unsound code if the pass ordering were to change.
There doesn't seem to be a way, presently, this this mechanism to provide soundness guarantees nor does it seem like
AlwaysInlinerPass()is a desired feature of LLVM, which this feature relies on.r? @RalfJung