Have the alignment intrinsics return ptr::Alignment directly#152641
Have the alignment intrinsics return ptr::Alignment directly#152641scottmcm wants to merge 2 commits intorust-lang:mainfrom
ptr::Alignment directly#152641Conversation
This comment has been minimized.
This comment has been minimized.
864bde0 to
aa59f29
Compare
This comment has been minimized.
This comment has been minimized.
aa59f29 to
5c5e512
Compare
This comment has been minimized.
This comment has been minimized.
5c5e512 to
c071e30
Compare
This comment has been minimized.
This comment has been minimized.
c071e30 to
22ff442
Compare
|
I don't think anything in here should be more expensive, but in case... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Have the alignment intrinsics return `ptr::Alignment` directly
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (7121e2d): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 @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.9%, secondary 2.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 11.9%, secondary -1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.3%, secondary -0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 485.129s -> 482.811s (-0.48%) |
|
Some changes occurred in compiler/rustc_codegen_gcc Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt This PR modifies cc @jieyouxu Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter |
Add a mir-opt test for alignment check generation [zero changes outside tests] I wrote this as part of rust-lang/rust#152641 which it looks like I'm going to just close, so submitting the new test separately since we didn't have any mir-opt testing of this pass that I could find (at least `x test tests/mir-opt` didn't fail when I broke them) so figured it's something that should exist.
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
Add a mir-opt test for alignment check generation [zero changes outside tests] I wrote this as part of rust-lang/rust#152641 which it looks like I'm going to just close, so submitting the new test separately since we didn't have any mir-opt testing of this pass that I could find (at least `x test tests/mir-opt` didn't fail when I broke them) so figured it's something that should exist.
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
…gillot Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead This is relevant to things like `Box<[u8; 1024]>` where the drop looks at the `size_of_val` (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the `Sized` type. (Equivalent to rust-lang/rust#152681, but flipped in the rebase so it can land before rust-lang/rust#152641 instead of depending on it.)
22ff442 to
ad4a3fc
Compare
This comment has been minimized.
This comment has been minimized.
ad4a3fc to
0a9149f
Compare
|
@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.
Have the alignment intrinsics return `ptr::Alignment` directly
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (a606286): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking 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. Next, please: If you can, justify the regressions found in this try perf run in writing along with @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 -0.0%, secondary -3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 11.9%, secondary -3.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.2%, secondary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 497.359s -> 498.748s (0.28%) |
0a9149f to
8718f45
Compare
This comment has been minimized.
This comment has been minimized.
8718f45 to
223c257
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |

View all comments
Follow-up to #152605
Notably, a common case of
align_of_valis to put it inLayoutfor allocator calls, so might as well have it just be anAlignmentalready to avoid the extra transmute.No changes to
rustc_const_evalbecause that's already writing aScalarinto a place, which does what we need sinceptr::Alignmentisrepr(transparent)to arepr(usize).