Skip to content
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

Use BoundsCheckNoThrow assertion in optAssertionProp_RangeProperties #102089

Merged
merged 1 commit into from
May 11, 2024

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented May 10, 2024

Closes #102088

int Test(Span<int> x, int y) => x[y] + (y % 8);
; Method Bench:Test(System.Span`1[int],int):int:this (FullOpts)
       sub      rsp, 40
       cmp      r8d, dword ptr [rdx+0x08]
       jae      SHORT G_M45212_IG04
       mov      rax, bword ptr [rdx]
       mov      ecx, r8d
-      mov      edx, r8d
-      sar      edx, 31
-      and      edx, 7
-      add      edx, r8d
-      and      edx, -8
-      sub      r8d, edx
+      and      r8d, 7
       add      r8d, dword ptr [rax+4*rcx]
       mov      eax, r8d
       add      rsp, 40
       ret      
G_M45212_IG04:
       call     CORINFO_HELP_RNGCHKFAIL
       int3     
-; Total bytes of code: 52
+; Total bytes of code: 38

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 10, 2024
@EgorBo EgorBo marked this pull request as ready for review May 10, 2024 19:39
@EgorBo
Copy link
Member Author

EgorBo commented May 10, 2024

@AndyAyersMS @jakobbotsch @dotnet/jit-contrib PTAL

@EgorBo EgorBo merged commit bdfbed6 into dotnet:main May 11, 2024
107 checks passed
@EgorBo EgorBo deleted the improve-optAssertionProp_RangeProperties branch May 11, 2024 10:45
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT is missing a common case to track the IsNeverNegative assertion
3 participants