Skip to content

Conversation

@fuad1502
Copy link
Contributor

controlExpr of GT_CALL node can be contained to enable moving the lower 12-bits of the constant to GT_CALL's instruction (in this case, jalr) offset.

See #114488 for a similar optimization applied to GT_IND and load / store instruction.

For the following C# code:

[MethodImpl(MethodImplOptions.NoInlining)]
private static int MemoryAccess(int[] a, int b)
{
      return a[b];
}

Before patch:

;; ...
lui            a0, 515670
addiw          a0, a0, 786
slli           a0, a0, 13
addi           a0, a0, 2024
slli           a0, a0, 3
jalr           a0           // CORINFO_HELP_RNGCHKFAIL

After patch:

;; ...
lui            a0, -173851
addiw          a0, a0, -1851
slli           a0, a0, 31
srli           a0, a0, 17
jalr           ra, -192(a0)         // CORINFO_HELP_RNGCHKFAIL

Part of #84834, cc @dotnet/samsung

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 16, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 16, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@fuad1502
Copy link
Contributor Author

Regressions reported here are actually improvements. They are reported as regression because we are able to generate 5 or fewer instruction instead of using emitDataConst, which has fewer instructions (auipc + ld), but actually costs more since it uses ld.

Diffs are based on 12,502 contexts (10,177 MinOpts, 2,325 FullOpts).

Overall (-37,808 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs
test.mch 6,214,876 -37,808 -0.54%
MinOpts (-31,548 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs
test.mch 4,839,896 -31,548 -0.60%
FullOpts (-6,260 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs
test.mch 1,374,980 -6,260 -0.36%
Example diffs
test.mch
-24 (-7.06%) : 4359.dasm - System.Reflection.Emit.SignatureHelper:IsSimpleType(ubyte):ubyte (Instrumented Tier1)
@@ -49,11 +49,10 @@ G_M17900_IG05:        ; bbWeight=0.54, gcrefRegs=0000 {}, byrefRegs=0000 {}, byr
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
-						;; size=32 bbWeight=0.54 PerfScore 4.08
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
+						;; size=28 bbWeight=0.54 PerfScore 3.80
 G_M17900_IG06:        ; bbWeight=0.59, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             lui            a0, 0xD1FFAB1E
             addiw          a0, a0, 0xD1FFAB1E
@@ -62,11 +61,10 @@ G_M17900_IG06:        ; bbWeight=0.59, gcrefRegs=0000 {}, byrefRegs=0000 {}, byr
             slli           a0, a0, 4
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
-						;; size=44 bbWeight=0.59 PerfScore 4.73
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
+						;; size=40 bbWeight=0.59 PerfScore 4.43
 G_M17900_IG07:        ; bbWeight=0.71, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             addi           a0, zero, 0xD1FFAB1E
 						;; size=4 bbWeight=0.71 PerfScore 0.36
@@ -80,12 +78,11 @@ G_M17900_IG09:        ; bbWeight=0.29, gcVars=0000000000000000 {}, gcrefRegs=000
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             mv             a0, zero
-						;; size=36 bbWeight=0.29 PerfScore 2.31
+						;; size=32 bbWeight=0.29 PerfScore 2.17
 G_M17900_IG10:        ; bbWeight=0.29, epilog, nogc, extend
             ld             ra, 8(sp)
             ld             fp, 0(sp)
@@ -96,34 +93,31 @@ G_M17900_IG11:        ; bbWeight=0.05, gcVars=0000000000000000 {}, gcrefRegs=000
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             j              G_M17900_IG06
-						;; size=36 bbWeight=0.05 PerfScore 0.43
+						;; size=32 bbWeight=0.05 PerfScore 0.41
 G_M17900_IG12:        ; bbWeight=0.12, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             auipc          t6, 0xD1FFAB1E
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             j              G_M17900_IG07
-						;; size=36 bbWeight=0.12 PerfScore 1.08
+						;; size=32 bbWeight=0.12 PerfScore 1.02
 G_M17900_IG13:        ; bbWeight=0, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             auipc          t6, 0xD1FFAB1E
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             j              G_M17900_IG06
-						;; size=36 bbWeight=0 PerfScore 0.00
+						;; size=32 bbWeight=0 PerfScore 0.00
 RWD00  	dq	00007CAB3F8F85FCh
 RWD08  	dq	00007CAB3F8F860Ch
 RWD16  	dq	00007CAB3F8F8608h
@@ -131,7 +125,7 @@ RWD24  	dq	00007CAB3F8F85F8h
 RWD32  	dq	00007CAB3F8F8604h
 
 
-; Total bytes of code 340, prolog size 16, PerfScore 50.39, instruction count 80, allocated bytes for code 340 (MethodHash=db2eba13) for method System.Reflection.Emit.SignatureHelper:IsSimpleType(ubyte):ubyte (Instrumented Tier1)
+; Total bytes of code 316, prolog size 16, PerfScore 49.59, instruction count 74, allocated bytes for code 316 (MethodHash=db2eba13) for method System.Reflection.Emit.SignatureHelper:IsSimpleType(ubyte):ubyte (Instrumented Tier1)
 ; ============================================================
 
 Unwind Info:
@@ -142,7 +136,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 85 (0x00055) Actual length = 340 (0x000154)
+  Function Length   : 79 (0x0004f) Actual length = 316 (0x00013c)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
-8 (-6.45%) : 7730.dasm - System.Int64:CreateTruncating[int](int):long (Instrumented Tier1)
@@ -32,10 +32,9 @@ G_M54562_IG02:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             ld             a0, 0xD1FFAB1E(t6)
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             lui            a0, 0xD1FFAB1E
             addiw          a0, a0, 0xD1FFAB1E
             slli           a0, a0, 13
@@ -43,12 +42,11 @@ G_M54562_IG02:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             slli           a0, a0, 3
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 12
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 4
-            jalr           a1		// CORINFO_HELP_COUNTPROFILE32
+            slli           a1, a1, 29
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_COUNTPROFILE32
             mv             a0, s1
-						;; size=84 bbWeight=1 PerfScore 16.50
+						;; size=76 bbWeight=1 PerfScore 15.50
 G_M54562_IG03:        ; bbWeight=1, epilog, nogc, extend
             ld             s1, 24(sp)
             ld             ra, 16(sp)
@@ -58,7 +56,7 @@ G_M54562_IG03:        ; bbWeight=1, epilog, nogc, extend
 RWD00  	dq	00007CAB40A3D864h
 
 
-; Total bytes of code 124, prolog size 20, PerfScore 39.00, instruction count 30, allocated bytes for code 124 (MethodHash=86012add) for method System.Int64:CreateTruncating[int](int):long (Instrumented Tier1)
+; Total bytes of code 116, prolog size 20, PerfScore 38.00, instruction count 28, allocated bytes for code 116 (MethodHash=86012add) for method System.Int64:CreateTruncating[int](int):long (Instrumented Tier1)
 ; ============================================================
 
 Unwind Info:
@@ -69,7 +67,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 31 (0x0001f) Actual length = 124 (0x00007c)
+  Function Length   : 29 (0x0001d) Actual length = 116 (0x000074)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
-8 (-6.45%) : 7109.dasm - System.Collections.Immutable.ImmutableHashSet`1[System.__Canon]:GetHashBucketEqualityComparer(System.Collections.Generic.IEqualityComparer`1[System.__Canon]):System.Collections.Generic.IEqualityComparer`1[System.Collections.Immutable.ImmutableHashSet`1+HashBucket[System.__Canon]] (Tier1)
@@ -45,15 +45,14 @@ G_M54717_IG03:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             mv             a0, a1
             lui            a1, 0xD1FFAB1E
             addiw          a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 13
-            addi           a1, a1, 0xD1FFAB1E
-            slli           a1, a1, 3
-            jalr           a1		// CORINFO_HELP_GET_GCSTATIC_BASE
+            slli           a1, a1, 31
+            srli           a1, a1, 17
+            jalr           ra, 0xD1FFAB1E(a1)		// CORINFO_HELP_GET_GCSTATIC_BASE
             ; byrRegs +[a0]
             ld             a0, 0xD1FFAB1E(a0)
             ; gcrRegs +[a0]
             ; byrRegs -[a0]
-						;; size=32 bbWeight=1 PerfScore 8.00
+						;; size=28 bbWeight=1 PerfScore 7.50
 G_M54717_IG04:        ; bbWeight=1, epilog, nogc, extend
             ld             ra, 24(sp)
             ld             fp, 16(sp)
@@ -65,17 +64,16 @@ G_M54717_IG05:        ; bbWeight=0.20, gcVars=0000000000000000 {}, gcrefRegs=000
             ld             a1, 0xD1FFAB1E(t6)
             lui            a2, 0xD1FFAB1E
             addiw          a2, a2, 0xD1FFAB1E
-            slli           a2, a2, 15
-            addi           a2, a2, 0xD1FFAB1E
-            slli           a2, a2, 1
-            jalr           a2		// CORINFO_HELP_RUNTIMEHANDLE_CLASS
+            slli           a2, a2, 29
+            srli           a2, a2, 17
+            jalr           ra, 0xD1FFAB1E(a2)		// CORINFO_HELP_RUNTIMEHANDLE_CLASS
             mv             a1, a0
             j              G_M54717_IG03
-						;; size=40 bbWeight=0.20 PerfScore 1.90
+						;; size=36 bbWeight=0.20 PerfScore 1.80
 RWD00  	dq	00007CAB3DFD4968h
 
 
-; Total bytes of code 124, prolog size 20, PerfScore 39.90, instruction count 30, allocated bytes for code 124 (MethodHash=c2952a42) for method System.Collections.Immutable.ImmutableHashSet`1[System.__Canon]:GetHashBucketEqualityComparer(System.Collections.Generic.IEqualityComparer`1[System.__Canon]):System.Collections.Generic.IEqualityComparer`1[System.Collections.Immutable.ImmutableHashSet`1+HashBucket[System.__Canon]] (Tier1)
+; Total bytes of code 116, prolog size 20, PerfScore 39.30, instruction count 28, allocated bytes for code 116 (MethodHash=c2952a42) for method System.Collections.Immutable.ImmutableHashSet`1[System.__Canon]:GetHashBucketEqualityComparer(System.Collections.Generic.IEqualityComparer`1[System.__Canon]):System.Collections.Generic.IEqualityComparer`1[System.Collections.Immutable.ImmutableHashSet`1+HashBucket[System.__Canon]] (Tier1)
 ; ============================================================
 
 Unwind Info:
@@ -86,7 +84,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 31 (0x0001f) Actual length = 124 (0x00007c)
+  Function Length   : 29 (0x0001d) Actual length = 116 (0x000074)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
+24 (+30.00%) : 288.dasm - System.Runtime.InteropServices.Marshal:SetLastSystemError(int) (Tier1)
@@ -22,34 +22,36 @@ G_M31437_IG01:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref,
             mv             fp, sp
 						;; size=16 bbWeight=1 PerfScore 9.00
 G_M31437_IG02:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
-            auipc          t6, 0xD1FFAB1E
-            ld             a1, 0xD1FFAB1E(t6)
-						;; size=8 bbWeight=1 PerfScore 2.00
-G_M31437_IG03:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
-            jalr           a1		// <unknown method>
+            lui            a1, 0xD1FFAB1E
+            addiw          a1, a1, 0xD1FFAB1E
+            slli           a1, a1, 12
+            addi           a1, a1, 0xD1FFAB1E
+            slli           a1, a1, 4
+            jalr           ra, 0xD1FFAB1E(a1)		// <unknown method>
             auipc          t6, 0xD1FFAB1E
             ld             a0, 0xD1FFAB1E(t6)
             lw             a0, 0xD1FFAB1E(a0)
             sext.w         t6, a0
-            bnez           t6, G_M31437_IG05
-						;; size=24 bbWeight=1 PerfScore 11.00
-G_M31437_IG04:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref, epilog, nogc
+            bnez           t6, G_M31437_IG04
+						;; size=44 bbWeight=1 PerfScore 13.50
+G_M31437_IG03:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref, epilog, nogc
             ld             ra, 8(sp)
             ld             fp, 0(sp)
             addi           sp, sp, 16
             ret						;; size=16 bbWeight=1 PerfScore 7.50
-G_M31437_IG05:        ; bbWeight=0, gcVars=0000000000000000 {}, gcrefRegs=0000 {}, byrefRegs=0000 {}, gcvars, byref
-            auipc          t6, 0xD1FFAB1E
-            ld             a0, 0xD1FFAB1E(t6)
-            jalr           a0		// CORINFO_HELP_POLL_GC
-            j              G_M31437_IG04
-						;; size=16 bbWeight=0 PerfScore 0.00
-RWD00  	dq	0000732474C39134h
-RWD08  	dq	00007324720A4BECh
-RWD16  	dq	0000732471E1EC46h
+G_M31437_IG04:        ; bbWeight=0, gcVars=0000000000000000 {}, gcrefRegs=0000 {}, byrefRegs=0000 {}, gcvars, byref
+            lui            a0, 0xD1FFAB1E
+            addiw          a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 14
+            addi           a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 2
+            jalr           ra, 0xD1FFAB1E(a0)		// CORINFO_HELP_POLL_GC
+            j              G_M31437_IG03
+						;; size=28 bbWeight=0 PerfScore 0.00
+RWD00  	dq	00007324720A4BECh
 
 
-; Total bytes of code 80, prolog size 16, PerfScore 29.50, instruction count 17, allocated bytes for code 80 (MethodHash=73478532) for method System.Runtime.InteropServices.Marshal:SetLastSystemError(int) (Tier1)
+; Total bytes of code 104, prolog size 16, PerfScore 30.00, instruction count 25, allocated bytes for code 104 (MethodHash=73478532) for method System.Runtime.InteropServices.Marshal:SetLastSystemError(int) (Tier1)
 ; ============================================================
 
 Unwind Info:
@@ -60,7 +62,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 20 (0x00014) Actual length = 80 (0x000050)
+  Function Length   : 26 (0x0001a) Actual length = 104 (0x000068)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
+24 (+30.00%) : 137.dasm - System.Runtime.InteropServices.Marshal:GetLastSystemError():int (Instrumented Tier1)
@@ -25,32 +25,34 @@ G_M14595_IG02:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
             ld             a0, 0xD1FFAB1E(t6)
             lw             a0, 0xD1FFAB1E(a0)
             sext.w         t6, a0
-            bnez           t6, G_M14595_IG06
+            bnez           t6, G_M14595_IG05
 						;; size=20 bbWeight=1 PerfScore 8.00
 G_M14595_IG03:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
-            auipc          t6, 0xD1FFAB1E
-            ld             a0, 0xD1FFAB1E(t6)
-						;; size=8 bbWeight=1 PerfScore 2.00
-G_M14595_IG04:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
-            jalr           a0		// <unknown method>
-						;; size=4 bbWeight=1 PerfScore 3.00
-G_M14595_IG05:        ; bbWeight=1, epilog, nogc, extend
+            lui            a0, 0xD1FFAB1E
+            addiw          a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 12
+            addi           a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 4
+            jalr           ra, 0xD1FFAB1E(a0)		// <unknown method>
+						;; size=24 bbWeight=1 PerfScore 5.50
+G_M14595_IG04:        ; bbWeight=1, epilog, nogc, extend
             ld             ra, 8(sp)
             ld             fp, 0(sp)
             addi           sp, sp, 16
             ret						;; size=16 bbWeight=1 PerfScore 7.50
-G_M14595_IG06:        ; bbWeight=0, gcVars=0000000000000000 {}, gcrefRegs=0000 {}, byrefRegs=0000 {}, gcvars, byref
-            auipc          t6, 0xD1FFAB1E
-            ld             a0, 0xD1FFAB1E(t6)
-            jalr           a0		// CORINFO_HELP_POLL_GC
+G_M14595_IG05:        ; bbWeight=0, gcVars=0000000000000000 {}, gcrefRegs=0000 {}, byrefRegs=0000 {}, gcvars, byref
+            lui            a0, 0xD1FFAB1E
+            addiw          a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 14
+            addi           a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 2
+            jalr           ra, 0xD1FFAB1E(a0)		// CORINFO_HELP_POLL_GC
             j              G_M14595_IG03
-						;; size=16 bbWeight=0 PerfScore 0.00
+						;; size=28 bbWeight=0 PerfScore 0.00
 RWD00  	dq	00007324720A4BECh
-RWD08  	dq	0000732474C3911Eh
-RWD16  	dq	0000732471E1EC46h
 
 
-; Total bytes of code 80, prolog size 16, PerfScore 29.50, instruction count 17, allocated bytes for code 80 (MethodHash=d5ccc6fc) for method System.Runtime.InteropServices.Marshal:GetLastSystemError():int (Instrumented Tier1)
+; Total bytes of code 104, prolog size 16, PerfScore 30.00, instruction count 25, allocated bytes for code 104 (MethodHash=d5ccc6fc) for method System.Runtime.InteropServices.Marshal:GetLastSystemError():int (Instrumented Tier1)
 ; ============================================================
 
 Unwind Info:
@@ -61,7 +63,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 20 (0x00014) Actual length = 80 (0x000050)
+  Function Length   : 26 (0x0001a) Actual length = 104 (0x000068)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
+12 (+25.00%) : 316.dasm - ByteMark:StartStopwatch():long (Instrumented Tier0)
@@ -18,20 +18,21 @@ G_M33759_IG01:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref,
             mv             fp, sp
 						;; size=16 bbWeight=1 PerfScore 9.00
 G_M33759_IG02:        ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
-            auipc          t6, 0xD1FFAB1E
-            ld             a0, 0xD1FFAB1E(t6)
-            jalr           a0		// <unknown method>
+            lui            a0, 0xD1FFAB1E
+            addiw          a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 12
+            addi           a0, a0, 0xD1FFAB1E
+            slli           a0, a0, 4
+            jalr           ra, 0xD1FFAB1E(a0)		// <unknown method>
             slliw          a0, a0, 0
-						;; size=16 bbWeight=1 PerfScore 5.50
+						;; size=28 bbWeight=1 PerfScore 6.00
 G_M33759_IG03:        ; bbWeight=1, epilog, nogc, extend
             ld             ra, 8(sp)
             ld             fp, 0(sp)
             addi           sp, sp, 16
             ret						;; size=16 bbWeight=1 PerfScore 7.50
-RWD00  	dq	0000732471F6AB8Ah
 
-
-; Total bytes of code 48, prolog size 16, PerfScore 22.00, instruction count 11, allocated bytes for code 48 (MethodHash=08437c20) for method ByteMark:StartStopwatch():long (Instrumented Tier0)
+; Total bytes of code 60, prolog size 16, PerfScore 22.50, instruction count 15, allocated bytes for code 60 (MethodHash=08437c20) for method ByteMark:StartStopwatch():long (Instrumented Tier0)
 ; ============================================================
 
 Unwind Info:
@@ -42,7 +43,7 @@ Unwind Info:
   E bit             : 0
   X bit             : 0
   Vers              : 0
-  Function Length   : 12 (0x0000c) Actual length = 48 (0x000030)
+  Function Length   : 15 (0x0000f) Actual length = 60 (0x00003c)
   ---- Epilog scopes ----
   ---- Scope 0
   Epilog Start Offset        : 3523193630 (0xd1ffab1e) Actual offset = 3523193630 (0xd1ffab1e) Offset from main function begin = 3523193630 (0xd1ffab1e)
Details

Size improvements/regressions per collection

Collection Contexts with diffs Improvements Regressions Same size Improvements (bytes) Regressions (bytes)
test.mch 6,035 3,800 1,478 757 -68,224 +30,416

PerfScore improvements/regressions per collection

Collection Contexts with diffs Improvements Regressions Same PerfScore Improvements (PerfScore) Regressions (PerfScore) PerfScore Overall in FullOpts
test.mch 6,035 4,341 117 1,577 -0.76% +0.37% -0.2168%

Context information

Collection Diffed contexts MinOpts FullOpts Missed, base Missed, diff
test.mch 12,502 10,177 2,325 0 (0.00%) 0 (0.00%)

jit-analyze output

@risc-vv
Copy link

risc-vv commented Apr 16, 2025

RISC-V Release-CLR-VF2: 9698 / 9747 (99.50%)

=======================
      passed: 9698
      failed: 28
     skipped: 70
      killed: 21
------------------------
  TOTAL libs: 9817
 TOTAL tests: 9817
   REAL time: 2h 3min 1s 306ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: 44f2959220f945fa84e02d5a71cdf602ea80edf2
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-CLR-QEMU: 9699 / 9747 (99.51%)

=======================
      passed: 9699
      failed: 28
     skipped: 70
      killed: 20
------------------------
  TOTAL libs: 9817
 TOTAL tests: 9817
   REAL time: 3h 22min 34s 0ms
=======================

Release-CLR-QEMU.md, Release-CLR-QEMU.xml, testclr_output.tar.gz

Build information and commands

GIT: 44f2959220f945fa84e02d5a71cdf602ea80edf2
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-QEMU: 674503 / 689922 (97.77%)

=======================
      passed: 674503
      failed: 1665
     skipped: 1530
      killed: 13754
------------------------
  TOTAL libs: 259
 TOTAL tests: 691452
   REAL time: 2h 28min 16s 941ms
=======================

Release-FX-QEMU.md, Release-FX-QEMU.xml, testfx_output.tar.gz

Build information and commands

GIT: 44f2959220f945fa84e02d5a71cdf602ea80edf2
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

Co-authored-by: Tomasz Sowiński <tomeksowi@gmail.com>
@risc-vv
Copy link

risc-vv commented Apr 17, 2025

221aaa0 is being scheduled for building and testing

GIT: 221aaa0f7838a5a26e09fdf74eac880a8ac038b6
REPO: dotnet/runtime
BRANCH: main

@am11 am11 added the arch-riscv Related to the RISC-V architecture label Apr 17, 2025
Copy link
Contributor

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the merge conflicts

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
@risc-vv
Copy link

risc-vv commented Apr 18, 2025

44fa220 is being scheduled for building and testing

GIT: 44fa220ef9bdf99cf08ef47aba6a40f7c5b99d5b
REPO: dotnet/runtime
BRANCH: main

@risc-vv
Copy link

risc-vv commented Apr 18, 2025

RISC-V Release-CLR-VF2: 9702 / 9750 (99.51%)

=======================
      passed: 9702
      failed: 28
     skipped: 70
      killed: 20
------------------------
  TOTAL libs: 9820
 TOTAL tests: 9820
   REAL time: 1h 58min 52s 143ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: b3c8bccd1b1f029b2460833c172d8d331055a1a9
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-CLR-QEMU: 9701 / 9750 (99.50%)

=======================
      passed: 9701
      failed: 29
     skipped: 70
      killed: 20
------------------------
  TOTAL libs: 9820
 TOTAL tests: 9820
   REAL time: 3h 21min 56s 541ms
=======================

Release-CLR-QEMU.md, Release-CLR-QEMU.xml, testclr_output.tar.gz

Build information and commands

GIT: b3c8bccd1b1f029b2460833c172d8d331055a1a9
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-QEMU: 655908 / 677590 (96.80%)

=======================
      passed: 655908
      failed: 1620
     skipped: 1692
      killed: 20062
------------------------
  TOTAL libs: 259
 TOTAL tests: 679282
   REAL time: 2h 25min 44s 1ms
=======================

Release-FX-QEMU.md, Release-FX-QEMU.xml, testfx_output.tar.gz

Build information and commands

GIT: b3c8bccd1b1f029b2460833c172d8d331055a1a9
CI: 2d916d20de463f9bba05ae71b3d1f37d439a8cb1
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

@BruceForstall
Copy link
Contributor

/ba-g unrelated tests

@BruceForstall BruceForstall merged commit 1e3c798 into dotnet:main Apr 18, 2025
108 of 113 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-riscv Related to the RISC-V architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants