Skip to content

Conversation

@tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Oct 19, 2025

Extend attribute deduction to determine whether parameters using
indirect pass mode might have their address captured. Similarly to
the deduction of readonly attribute this information facilitates
memcpy optimizations.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 19, 2025
@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 19, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 19, 2025
deduced_param_attrs: deduce captures(none)
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 19, 2025
@rust-log-analyzer

This comment has been minimized.

@tmiasko tmiasko force-pushed the deduce-captures-none branch 2 times, most recently from e902eab to 5d4db8a Compare October 19, 2025 19:33
@rust-bors
Copy link

rust-bors bot commented Oct 19, 2025

💔 Test for abbaf96 failed: CI

@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 19, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 19, 2025
deduced_param_attrs: deduce captures(none)
@bors
Copy link
Collaborator

bors commented Oct 19, 2025

☔ The latest upstream changes (presumably #147884) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-bors
Copy link

rust-bors bot commented Oct 19, 2025

☀️ Try build successful (CI)
Build commit: 470704e (470704e31911d010ae90e062e13a88db578f8f08, parent: c6efb9019b3169fc672248339dbbf13e6a134de3)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (470704e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.1%, 1.1%] 5
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 8
Improvements ✅
(secondary)
-0.4% [-1.2%, -0.1%] 27
All ❌✅ (primary) -0.3% [-0.4%, -0.2%] 8

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary 2.8%, secondary 3.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
3.4% [2.6%, 4.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.8% [2.8%, 2.8%] 1

Binary size

Results (primary 0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.1%] 10
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 10
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 35
All ❌✅ (primary) 0.0% [-0.0%, 0.1%] 14

Bootstrap: 472.659s -> 472.043s (-0.13%)
Artifact size: 390.57 MiB -> 390.61 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 19, 2025
@tmiasko tmiasko force-pushed the deduce-captures-none branch 2 times, most recently from eab5de9 to 5f7a3eb Compare October 22, 2025 17:14
@tmiasko tmiasko changed the title deduced_param_attrs: deduce captures(none) Deduce captures(none) for a return place and parameters Oct 22, 2025
@tmiasko tmiasko marked this pull request as ready for review October 22, 2025 17:14
@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 22, 2025
@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 22, 2025

r? compiler

// We're only interested in arguments.
&& let Some(param_index) = self.as_param(place.local)
&& !place.is_indirect_first_projection()
&& let Some(i) = self.as_param(place.local)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check whether that argument's type may be passed indirectly? In case of projections in particular.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave further improvements for a separate pull request (although, it looks like we have an extra temporary in such a case regardless).

@tmiasko tmiasko force-pushed the deduce-captures-none branch from 5f7a3eb to 5ba1095 Compare October 23, 2025 10:21
Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through it, the code changes look correct but I don't feel like I have the required background to confidently review this from a higher level.

r? nikic (since you seem to have touched similar stuff in #145877)

View changes since this review

@rustbot rustbot assigned nikic and unassigned madsmtm Oct 24, 2025
Extend attribute deduction to determine whether parameters using
indirect pass mode might have their address captured. Similarly to
the deduction of `readonly` attribute this information facilitates
memcpy optimizations.
@tmiasko tmiasko force-pushed the deduce-captures-none branch from 5ba1095 to 2a03a94 Compare October 25, 2025 20:54
@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2025

This PR was rebased onto a different master 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.

@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 25, 2025

r? cjgillot

@rustbot rustbot assigned cjgillot and unassigned nikic Oct 25, 2025
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 26, 2025

📌 Commit 2a03a94 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 26, 2025
@bors
Copy link
Collaborator

bors commented Oct 26, 2025

⌛ Testing commit 2a03a94 with merge f37aa99...

@bors
Copy link
Collaborator

bors commented Oct 26, 2025

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing f37aa99 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 26, 2025
@bors bors merged commit f37aa99 into rust-lang:master Oct 26, 2025
12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Oct 26, 2025
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing f977dfc (parent) -> f37aa99 (this PR)

Test differences

Show 13 test diffs

Stage 1

  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs: pass -> [missing] (J0)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM20: [missing] -> pass (J0)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM21: [missing] -> ignore (ignored when the LLVM version 20.1.2 is older than 21.0.0) (J0)

Stage 2

  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM20: [missing] -> ignore (ignored when the LLVM version (21.1.3) is newer than majorversion 20) (J1)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM21: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM21: [missing] -> ignore (ignored when the LLVM version 20.1.2 is older than 21.0.0) (J2)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM21: [missing] -> ignore (ignored when the LLVM version 20.1.8 is older than 21.0.0) (J3)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs: pass -> [missing] (J4)
  • [codegen] tests/codegen-llvm/deduced-param-attrs.rs#LLVM20: [missing] -> pass (J5)

Additionally, 4 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard f37aa9955f03bb1bc6fe08670cb1ecae534b5815 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc: 2776.9s -> 3566.8s (28.4%)
  2. pr-check-1: 1463.9s -> 1736.9s (18.6%)
  3. aarch64-apple: 6895.9s -> 8122.0s (17.8%)
  4. dist-x86_64-apple: 7093.9s -> 5875.0s (-17.2%)
  5. x86_64-gnu-llvm-20-1: 3067.9s -> 3546.5s (15.6%)
  6. i686-gnu-1: 6886.3s -> 7839.3s (13.8%)
  7. armhf-gnu: 4718.5s -> 5340.5s (13.2%)
  8. x86_64-gnu-stable: 6521.7s -> 7372.5s (13.0%)
  9. aarch64-msvc-2: 4593.5s -> 5174.7s (12.7%)
  10. i686-gnu-nopt-1: 7283.8s -> 8196.2s (12.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f37aa99): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
0.5% [0.1%, 1.1%] 3
Improvements ✅
(primary)
-0.2% [-0.5%, -0.1%] 31
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.0%] 34
All ❌✅ (primary) -0.2% [-0.5%, 0.3%] 32

Max RSS (memory usage)

Results (primary -0.9%, secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
3.4% [3.4%, 3.4%] 1
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-3.0% [-3.0%, -3.0%] 1
All ❌✅ (primary) -0.9% [-3.1%, 1.3%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results (primary 0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.1%] 10
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 10
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 38
All ❌✅ (primary) 0.0% [-0.0%, 0.1%] 14

Bootstrap: 473.751s -> 473.876s (0.03%)
Artifact size: 390.43 MiB -> 390.50 MiB (0.02%)

@tmiasko tmiasko deleted the deduce-captures-none branch October 27, 2025 14:42
@panstromek
Copy link
Contributor

perf triage:

Improvements outweigh regressions.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Oct 27, 2025
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. merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants