Repository navigation
Do not deduce parameters for #[naked] and functions whose body may be swapped out at link-time - #164490
Do not deduce parameters for #[naked] and functions whose body may be swapped out at link-time#164490saethlin wants to merge 2 commits into
Conversation
|
Some changes occurred in compiler/rustc_attr_ir cc @jdonszelmann, @JonathanBrouwer Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @Enselic rustbot has assigned @Enselic. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This makes sense, especially if performance looks ok. Let's start with checking performance. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Do not deduce parameters for #[naked] and functions whose body may be swapped out at link-time
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (2889f76): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.2%, secondary -1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 491.717s -> 488.371s (-0.68%) |
| /// will be present at runtime. | ||
| pub fn is_definition_exact(self) -> bool { | ||
| match self { | ||
| Linkage::External | Linkage::Internal => true, |
There was a problem hiding this comment.
I currently don't have time to investigate at depth myself, but is Linkage::External really correct to return true? I'm thinking of LD_PRELOAD overriding something Linkage::External, for example. I know Rust by default prefers static linkage and not exporting symbols, but it seems like this match should still be in sync with e.g.
rust/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
Lines 292 to 293 in 8aae7a7
and
rust/compiler/rustc_attr_ir/src/encode_cross_crate.rs
Lines 268 to 276 in bb0f4a6
shouldn't it? If yes, I think it is worth considering using a common function for it, like the one you added. If no, consider adding a small comment explaining why the code looks a bit uninutitive.
There was a problem hiding this comment.
I think you are right to ask about this and after musing about it for a while, I think the linkage attribute is more a distraction than anything. I think conceptually the right thing to do here is check for contains_extern_indicator, that just breaks a lot of codegen tests because they are accidentally testing that we do parameter deduction on #[no_mangle] functions.
d7530b5 to
0748668
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. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Per #164037 (comment), this is addressing a different problem with parameter deduction. #164037 fixes an issue where we just analyzed the wrong MIR body, this PR addresses the case where we look up the right DefId, but the function implementation can be swapped out later.