-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT: Prove some cases where strength reducing to GC pointers is ok (#…
…104679) For loops iterating over arrays we often have bounds that allow us to prove that an add recurrence formed by strength reduction will stay within that array. In these cases we know that forming the byrefs eagerly is ok. For example, when strength reduction is enabled, this changes the codegen of ```csharp private struct S { public int A, B, C; } [MethodImpl(MethodImplOptions.NoInlining)] private static float Sum(S[] ss) { int sum = 0; for (int i = 0; i < ss.Length; i++) { S v = ss[i]; sum += v.A; sum += v.B; sum += v.C; } return sum; } ``` in the following way: ```diff G_M63518_IG03: - mov r11d, 16 + add rcx, 16 ;; size=4 bbWeight=0.25 PerfScore 0.06 G_M63518_IG04: - lea r8, bword ptr [rcx+r11] + mov r8, rcx mov r10d, dword ptr [r8] mov r9d, dword ptr [r8+0x04] mov r8d, dword ptr [r8+0x08] add eax, r10d add eax, r9d add eax, r8d - add r11, 12 + add rcx, 12 dec edx jne SHORT G_M63518_IG04 ;; size=31 bbWeight=4 PerfScore 34.00 ```
- Loading branch information
1 parent
b885a58
commit 2199c77
Showing
5 changed files
with
257 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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