Repository navigation
Conversation
Signed-off-by: Raul Estrada <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
uurl
force-pushed
the
perf/llvm-reference-validity-attrs
branch
from
August 20, 2026 12:51
341a28b to
af66e44
Compare
Collaborator
|
Closing this PR because it is explicitly stacked on #1089, which in turn is stacked on the unsound pointer-kind proof source in #1062.
The replacement architecture will first preserve exact source types per operation, construct pointers through one checked policy, and derive validity attributes separately. #1098 remains open. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1098
This PR is stacked on top of #1089; its actual delta is one commit touching
7 files. Once #1089 lands, I’ll rebase this PR onto
mainso the review diffcontains only the reference-validity attribute changes.
Summary
Part of #413.
This change extends the Rust-reference parameter attribute pipeline introduced
by #1089 with conservatively proven LLVM
nonnull,align, anddereferenceableattributes.The policy is intentionally decided at the MIR import boundary, where the
original rustc
Ty, layout, and trait information are still available.Downstream lowering only transports and remaps those facts, and
llvm-exportserializes them mechanically.
Semantics
&TT: Sizednonnull,align NwhenN > 1&mut TT: Sizednonnull,align NwhenN > 1&TT: Sized + Freeze, size > 0dereferenceable(size)&mut TT: Sized + Unpin, size > 0dereferenceable(size)align 1is omitted.Zero-sized pointees never produce
dereferenceable(0), so an over-aligned ZSTmay carry:
without
dereferenceable.Design
The semantic decision remains centralized in
mir-importer.For each source-level argument:
mir-importerchecks the original Rust reference type, rustc layout, andrelevant
Freeze/Unpinconditions.MirFuncOpstores the proven facts by source argument index.mir-lowerremaps source arguments to physical LLVM pointer parametersafter ABI flattening.
llvm-exportvalidates the mechanical representation and serializes theresulting LLVM attributes.
Neither
mir-lowernorllvm-exportderives Rust semantics from pointermutability, address space, LLVM pointer shape, or
DisjointSlice.Conservative cases
This PR deliberately does not emit validity attributes for unsized references.
This preserves the slice alias behavior introduced by #1089 while keeping
validity attributes restricted to sized pointees in this follow-up.
In particular:
&UnsafeCell<u32>receivesnonnull align 4, but notdereferenceable(4)&mut PhantomPinneddoes not receivedereferenceabledereferenceable(0)DisjointSliceremains uninterpreted by the exporterValidation
Focused coverage includes:
UnsafeCellshared referencesUnpinmutable referencesValidation performed:
The final stacked delta against #1089 is one commit touching 7 files.
Out of scope
dereferenceable_or_nullDisjointSlice