Skip to content

Set !captures metadata for store of &Freeze#157480

Open
nikic wants to merge 1 commit into
rust-lang:mainfrom
nikic:captures-metadata
Open

Set !captures metadata for store of &Freeze#157480
nikic wants to merge 1 commit into
rust-lang:mainfrom
nikic:captures-metadata

Conversation

@nikic
Copy link
Copy Markdown
Contributor

@nikic nikic commented Jun 5, 2026

When a &Freeze reference is stored (with retag), emit !captures !{!"address", !"read_provenance"} metadata to indicate that it's UB to write through the stored pointer.

Related to #146844.

r? @ghost

@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 Jun 5, 2026
@nikic
Copy link
Copy Markdown
Contributor Author

nikic commented Jun 5, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 5, 2026
Set !captures metadata for store of &Freeze
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 5, 2026

☀️ Try build successful (CI)
Build commit: 7070de9 (7070de944f17ba2b07a846c21112969a8504656e, parent: 3179a47d67719a92b4d3c3689aca391c40ff1a04)

@rust-timer

This comment has been minimized.

When a `&Freeze` reference is stored (with retag), emit
`!captures !{!"address", !"read_provenance"}` metadata to indicate
that it's UB to write through the stored pointer.
@nikic nikic force-pushed the captures-metadata branch from 41ee7f1 to 8c80871 Compare June 5, 2026 14:01
@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (7070de9): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking 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 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.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.6%, secondary 4.7%)

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

mean range count
Regressions ❌
(primary)
3.1% [3.1%, 3.1%] 1
Regressions ❌
(secondary)
4.7% [2.4%, 7.1%] 4
Improvements ✅
(primary)
-2.0% [-2.0%, -2.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [-2.0%, 3.1%] 2

Cycles

Results (secondary -0.5%)

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

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 515.747s -> 515.721s (-0.01%)
Artifact size: 400.75 MiB -> 400.65 MiB (-0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2026
@nikic nikic marked this pull request as ready for review June 5, 2026 15:33
@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 Jun 5, 2026
@nikic
Copy link
Copy Markdown
Contributor Author

nikic commented Jun 5, 2026

r? @RalfJung

This was originally intended to fix #146844, but that got fixed by improvements to MIR opts already (GVN presumably). It can still help in other cases where GVN won't work (e.g. address taken, or not MIR inlined), though there doesn't seem to be any interest impact visible in perf.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 5, 2026

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

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.

5 participants