add llvm writable attribute conditionally#155207
add llvm writable attribute conditionally#155207rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_hir/src/attrs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing |
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? @RalfJung |
|
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
This generally looks good, thanks! I just hope this larger ArgAttribute won't cause us problems. Cc @nikic for the LLVM parts, in case you want to take a 2nd look.
I am not sure if there's anything special to look out for in the new attribute infrastructure; @jdonszelmann would be great if you could take a brief look at that part.
@rustbot author
| // The subset of llvm::Attribute needed for arguments, packed into a bitfield. | ||
| #[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable_Generic)] | ||
| pub struct ArgAttribute(u8); | ||
| pub struct ArgAttribute(u16); |
There was a problem hiding this comment.
Ah, this is unfortunate. We should benchmark this to ensure the larger bitfield isn't a problem.
|
Reminder, once the PR becomes ready for a review, use |
|
@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.
add llvm writable attribute conditionally
|
💔 Test for 37fa495 failed: CI. Failed job:
|
|
^ The PR needs to be rebased |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
add llvm writable attribute conditionally
|
This looks great, thanks! Please squash the commits. Let's hope the larger ArgAttribute does not cause a perf issue -- I kicked of a benchmark run to check this. |
|
@bors squash msg="add llvm writable attribute conditionally" |
This comment has been minimized.
This comment has been minimized.
|
🔨 11 commits were squashed into da2bbfb. |
|
Nice, I've not seen this in action before. :) |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (84b05e7): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.1%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.3%, secondary 1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 490.756s -> 493.416s (0.54%) |
|
That looks good! This is just a secondary benchmark that has been rather noisy recently already, nothing to worry about IMO. @bors r+ |
This comment has been minimized.
This comment has been minimized.
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 0204aca (parent) -> 1b8f2e4 (this PR) Test differencesShow 930 test diffsStage 1
Stage 2
Additionally, 928 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 1b8f2e46e14b08208a53585570edd9206374aae8 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (1b8f2e4): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 2.1%, secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 8.7%, secondary 6.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 490.004s -> 504.175s (2.89%) |
View all comments
This PR tries to address rust-lang/unsafe-code-guidelines#584 (comment). It is part of a bachelor thesis supervised by @JoJoDeveloping and @RalfJung, for more information, see: Project_Description.pdf.
If the new
-Zllvm-writableflag is set, the llvm writable attribute is inserted for all mutable borrows. This can be conditionally turned off on a per-function basis using the#[rustc_no_writable]attribute. The new Undefined Behaviour introduced by this can detected by Miri, which is implemented here: rust-lang/miri#4947.Two library functions already received the
#[rustc_no_writable]attribute, as they are known to cause problems under the Tree Borrows aliasing model with implicit writes enabled.