-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Set both nuw
and nsw
in slice size calculation
#136575
Conversation
Some changes occurred in compiler/rustc_codegen_gcc |
Probably won't change that much, but let's see |
This comment has been minimized.
This comment has been minimized.
Set both `nuw` and `nsw` in slice size calculation There's an old note in the code to do this, and now that [LLVM-C has an API for it](https://github.com/llvm/llvm-project/blob/f0b8ff12519270adcfef93410abff76ab073476a/llvm/include/llvm-c/Core.h#L4403-L4408), we might as well. And it's been there since what looks like LLVM 17 llvm/llvm-project@de9b6aa so doesn't even need to be conditional. (There's other places, like `RawVecInner` or `Layout`, that might want to do things like this too, but I'll leave those for a future PR.)
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (c304764): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 6.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 779.293s -> 779.494s (0.03%) |
Allows a bit more optimization without a compile-time perf change, so looks ready to go to me 👍 |
// CHECK-LABEL: @slice_size_plus_2 | ||
#[no_mangle] | ||
pub fn slice_size_plus_2(x: &[u16]) -> usize { | ||
// Before #136575 this didn't get the `nuw` in the add. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☔ The latest upstream changes (presumably #136965) made this pull request unmergeable. Please resolve the merge conflicts. |
There's an old note in the code to do this, and now that LLVM-C has an API for it, we might as well.
@@ -1430,6 +1430,8 @@ unsafe extern "C" { | |||
|
|||
// Extra flags on arithmetic | |||
pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool); | |||
pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool); | |||
pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annot: Rebased to address the conflict, and updated these to pub(crate)
following #136881
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (bdc97d1): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 789.359s -> 790.438s (0.14%) |
There's an old note in the code to do this, and now that LLVM-C has an API for it, we might as well. And it's been there since what looks like LLVM 17 llvm/llvm-project@de9b6aa so doesn't even need to be conditional.
(There's other places, like
RawVecInner
orLayout
, that might want to do things like this too, but I'll leave those for a future PR.)