Skip to content

Propagate from borrowed locals in CopyProp #143624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Jul 8, 2025

r? cjgillot

@rustbot rustbot added 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 Jul 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@tmiasko
Copy link
Contributor Author

tmiasko commented Jul 8, 2025

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 8, 2025
Propagate from borrowed locals in CopyProp

r? cjgillot
@rust-bors
Copy link

rust-bors bot commented Jul 8, 2025

⌛ Trying commit dd34b79 with merge 1e4b0b7

To cancel the try build, run the command @bors2 try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 8, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 8, 2025

☀️ Try build successful (CI)
Build commit: 1e4b0b7 (1e4b0b7e6afa40bec58198f6cdb7d7bbfdf3efd0, parent: 688ea65df6a47866d0f72a00f1e18b47a7edf83b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1e4b0b7): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 18
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.0%] 26
All ❌✅ (primary) -0.1% [-0.3%, 0.4%] 19

Max RSS (memory usage)

Results (primary 1.9%, secondary 2.2%)

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

mean range count
Regressions ❌
(primary)
5.5% [5.5%, 5.5%] 1
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-1.7% [-1.7%, -1.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [-1.7%, 5.5%] 2

Cycles

Results (primary 2.4%, secondary -3.9%)

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

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-5.7%, -2.8%] 3
All ❌✅ (primary) 2.4% [2.4%, 2.4%] 1

Binary size

Results (primary 0.1%, secondary -0.1%)

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

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 1.3%] 11
Regressions ❌
(secondary)
0.1% [0.0%, 0.3%] 6
Improvements ✅
(primary)
-0.1% [-0.4%, -0.0%] 20
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.0%] 8
All ❌✅ (primary) 0.1% [-0.4%, 1.3%] 31

Bootstrap: 465.817s -> 464.2s (-0.35%)
Artifact size: 372.34 MiB -> 372.35 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 8, 2025
// the class is borrowed.
// We can propagate from a borrowed local into other locals that aren't borrowed, since we know
// that all uses of the other locals are dominated by the definition. This bitset is keyed by
// *class head* and contains whether any member of the class is borrowed.
let mut borrowed_classes = ssa.borrowed_locals().clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this separate bitset?

// We must not unify two locals that are borrowed. But this is fine if one is borrowed and
// the other is not. This bitset is keyed by *class head* and contains whether any member of
// the class is borrowed.
// We can propagate from a borrowed local into other locals that aren't borrowed, since we know
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate why we must not propagate if the lhs is borrowed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants