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

JIT: Update type when return temp is freshly created #111948

Merged
merged 18 commits into from
Feb 1, 2025

Conversation

hez2010
Copy link
Contributor

@hez2010 hez2010 commented Jan 29, 2025

Together with #110827 and things we have done for #108913 so far, this unblocks us to fully de-abstract array enumerators even without PGO.

Contributes to #108913.

class ArrayTest
{
    static readonly int[] s_ro_array;
    static int[] newArr() => new int[512];
    static ArrayTest()
    {
        s_ro_array = newArr();
    }
    static IEnumerable<int> get_static_readonly_array() => s_ro_array;
    public int foreach_static_readonly_array_via_interface_property()
    {
        var e = get_static_readonly_array();
        int sum = 0;
        foreach (int i in e) sum += i;
        return sum;
    }
}

Before:

; Assembly listing for method ArrayTest:foreach_static_readonly_array_via_interface_property():int:this (FullOpts)

G_M22676_IG01:  ;; offset=0x0000
       push     rbp
       push     rdi
       push     rsi
       push     rbx
       sub      rsp, 56
       lea      rbp, [rsp+0x50]
       mov      qword ptr [rbp-0x30], rsp
                                                ;; size=17 bbWeight=1 PerfScore 5.75
G_M22676_IG02:  ;; offset=0x0011
       xor      ebx, ebx
       mov      rcx, 0x1A291800DF0      ; const ptr
       mov      rsi, gword ptr [rcx]
       mov      rcx, 0x7FFD07CD9AF8      ; System.SZGenericArrayEnumerator`1[int]
       call     CORINFO_HELP_NEWSFAST
       mov      rdi, rax
       mov      rcx, 0x200FFFFFFFF
       mov      qword ptr [rdi+0x08], rcx
       lea      rcx, bword ptr [rdi+0x10]
       mov      rdx, rsi
       call     CORINFO_HELP_ASSIGN_REF
       mov      gword ptr [rbp-0x20], rdi
                                                ;; size=63 bbWeight=1 PerfScore 8.00
G_M22676_IG03:  ;; offset=0x0050
       mov      rcx, rdi
       mov      r11, 0x7FFD06C80370      ; code for System.Collections.IEnumerator:MoveNext():ubyte:this
       call     [r11]System.Collections.IEnumerator:MoveNext():ubyte:this
       test     eax, eax
       je       SHORT G_M22676_IG05
                                                ;; size=20 bbWeight=8 PerfScore 38.00
G_M22676_IG04:  ;; offset=0x0064
       mov      rcx, rdi
       mov      r11, 0x7FFD06C80378      ; code for System.Collections.Generic.IEnumerator`1[int]:get_Current():int:this
       call     [r11]System.Collections.Generic.IEnumerator`1[int]:get_Current():int:this
       add      ebx, eax
       jmp      SHORT G_M22676_IG03
                                                ;; size=20 bbWeight=4 PerfScore 23.00
G_M22676_IG05:  ;; offset=0x0078
       mov      rcx, rdi
       mov      r11, 0x7FFD06C80380      ; code for System.IDisposable:Dispose():this
       call     [r11]System.IDisposable:Dispose():this
       mov      eax, ebx
                                                ;; size=18 bbWeight=1 PerfScore 3.75
G_M22676_IG06:  ;; offset=0x008A
       add      rsp, 56
       pop      rbx
       pop      rsi
       pop      rdi
       pop      rbp
       ret
                                                ;; size=9 bbWeight=1 PerfScore 3.25
G_M22676_IG07:  ;; offset=0x0093
       push     rbp
       push     rdi
       push     rsi
       push     rbx
       sub      rsp, 40
       mov      rbp, qword ptr [rcx+0x20]
       mov      qword ptr [rsp+0x20], rbp
       lea      rbp, [rbp+0x50]
                                                ;; size=21 bbWeight=0 PerfScore 0.00
G_M22676_IG08:  ;; offset=0x00A8
       mov      rcx, gword ptr [rbp-0x20]
       mov      r11, 0x7FFD06C80380      ; code for System.IDisposable:Dispose():this
       call     [r11]System.IDisposable:Dispose():this
       nop
                                                ;; size=18 bbWeight=0 PerfScore 0.00
G_M22676_IG09:  ;; offset=0x00BA
       add      rsp, 40
       pop      rbx
       pop      rsi
       pop      rdi
       pop      rbp
       ret
                                                ;; size=9 bbWeight=0 PerfScore 0.00

After:

; Assembly listing for method ArrayTest:foreach_static_readonly_array_via_interface_property():int:this (FullOpts)

G_M22676_IG01:  ;; offset=0x0000
       push     rbp
       mov      rbp, rsp
                                                ;; size=4 bbWeight=1 PerfScore 1.25
G_M22676_IG02:  ;; offset=0x0004
       xor      eax, eax
       mov      rcx, 0x205D7000DF0      ; const ptr
       mov      rcx, gword ptr [rcx]
       mov      edx, 0xFFFFFFFF
       jmp      SHORT G_M22676_IG04
       align    [6 bytes for IG03]
                                                ;; size=28 bbWeight=1 PerfScore 4.75
G_M22676_IG03:  ;; offset=0x0020
       mov      edx, edx
       add      eax, dword ptr [rcx+4*rdx+0x10]
                                                ;; size=6 bbWeight=16 PerfScore 52.00
G_M22676_IG04:  ;; offset=0x0026
       inc      edx
       cmp      edx, 512
       jb       SHORT G_M22676_IG03
                                                ;; size=10 bbWeight=8 PerfScore 12.00
G_M22676_IG05:  ;; offset=0x0030
       pop      rbp
       ret
                                                ;; size=2 bbWeight=1 PerfScore 1.50

@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 Jan 29, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 29, 2025
Copy link
Contributor

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

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

Benchmark result:

Method Job Mean Ratio Allocated
foreach_static_readonly_array Main 104.15 ns 1.00 -
foreach_static_readonly_array_in_loop Main 103.18 ns 0.99 -
foreach_static_readonly_array_via_local Main 102.56 ns 0.98 -
foreach_static_readonly_array_via_interface Main 223.04 ns 2.14 -
foreach_static_readonly_array_via_interface_property Main 1,593.66 ns 15.30 32 B
foreach_static_readonly_array_via_interface_property_in_loop Main 1,693.10 ns 16.26 32 B
foreach_static_array Main 104.16 ns 1.00 -
foreach_static_array_via_local Main 104.03 ns 1.00 -
foreach_static_array_via_interface Main 222.26 ns 2.13 -
foreach_static_array_via_interface_property Main 1,695.46 ns 16.28 32 B
foreach_static_array_via_interface_property_in_loop Main 1,683.28 ns 16.16 32 B
foreach_member_array Main 105.42 ns 1.01 -
foreach_member_array_via_local Main 103.96 ns 1.00 -
foreach_member_array_via_interface Main 221.90 ns 2.13 -
foreach_member_array_via_interface_property Main 1,669.04 ns 16.03 32 B
foreach_member_array_via_interface_property_in_loop Main 1,674.84 ns 16.08 32 B
foreach_opaque_array_via_interface Main 1,673.81 ns 16.07 32 B
foreach_opaque_array_via_interface_in_loop Main 1,675.47 ns 16.09 32 B
sum_static_array_via_local Main 29.66 ns 0.28 -
foreach_static_readonly_array PR 102.92 ns 1.00 -
foreach_static_readonly_array_in_loop PR 102.83 ns 1.00 -
foreach_static_readonly_array_via_local PR 102.52 ns 1.00 -
foreach_static_readonly_array_via_interface PR 221.10 ns 2.15 -
foreach_static_readonly_array_via_interface_property PR 221.28 ns 2.15 -
foreach_static_readonly_array_via_interface_property_in_loop PR 219.25 ns 2.13 32 B
foreach_static_array PR 103.74 ns 1.01 -
foreach_static_array_via_local PR 104.26 ns 1.01 -
foreach_static_array_via_interface PR 222.43 ns 2.16 -
foreach_static_array_via_interface_property PR 222.20 ns 2.16 -
foreach_static_array_via_interface_property_in_loop PR 222.47 ns 2.16 32 B
foreach_member_array PR 104.37 ns 1.01 -
foreach_member_array_via_local PR 104.69 ns 1.02 -
foreach_member_array_via_interface PR 222.59 ns 2.16 -
foreach_member_array_via_interface_property PR 222.05 ns 2.16 -
foreach_member_array_via_interface_property_in_loop PR 221.64 ns 2.15 32 B
foreach_opaque_array_via_interface PR 1,285.20 ns 12.49 32 B
foreach_opaque_array_via_interface_in_loop PR 1,285.92 ns 12.49 32 B
sum_static_array_via_local PR 31.11 ns 0.30 -

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

@MihuBot

@hez2010 hez2010 changed the title JIT: Teach the inliner about NI_System_SZArrayHelper_GetEnumerator JIT: Update type when return temp is freshly created Jan 29, 2025
@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

@MihuBot

@jakobbotsch
Copy link
Member

jakobbotsch commented Jan 29, 2025

Together with #110827, this allows us to fully de-abstract array enumerators even without PGO.

Just noting that this PR is handling the case where the type is obtained via inlining; the actual deabstraction when the type is known was done as part of #108913. This unlocks that optimization for more cases.

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

The test seems only fail on Linux-musl-arm, and I'm not able to reproduce it in my local environment (x64). From the test log I'm not sure whether it's introduced by this PR because I don't get how could it be related, or it's an existing bug that gets exposed by this PR.
I will try updating the branch for a test rerun.
Does this ring any bell?

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

The test seems only fail on Linux-musl-arm, and I'm not able to reproduce it in my local environment (x64). From the test log I'm not sure whether it's introduced by this PR because I don't get how could it be related, or it's an existing bug that gets exposed by this PR. I will try updating the branch for a test rerun. Does this ring any bell?

After updating to the latest branch, the failed tests passed this time.
Seems that it's indeed unrelated to this change.

src/coreclr/jit/lclvars.cpp Outdated Show resolved Hide resolved
src/coreclr/jit/fgopt.cpp Show resolved Hide resolved
@AndyAyersMS
Copy link
Member

Also we should run jitstress and maybe some pgo stress on this, so it gets exposed to different inlining patterns.

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 29, 2025

CI is passing. (The remaining osx-arm64 two are likely to timeout like all other recent PRs).

Not too much interesting results from Diffs due to a lot of missing contexts. TP impact is not observable.

Diffs from MihuBot: https://gist.github.com/MihuBot/1674fcd3253ccef9fa1b24e541a0ab1d

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 30, 2025

Seems that the issue only happening on dynamic for COM objects. Deployed a workaround for this. (Or maybe we can ignore this one because it's too niche?)
PTAL.

@hez2010 hez2010 force-pushed the deabstract-enumerator branch from 90c769a to 7844b8f Compare January 30, 2025 13:46
@hez2010
Copy link
Contributor Author

hez2010 commented Jan 30, 2025

Okay. After a few hours of investigation, I scoped the issue to DynamicMetaObject and got this result with some logging points inserted by me.
When we are trying to inline System.Dynamic.DynamicMetaObject:Create into System.Dynamic.DynamicMetaObjectBinder:Bind, we set the spilled return temp V67 to exact, the logs are:

Setting return spill temp V67 to exact, when inline System.Dynamic.DynamicMetaObject:Create into System.Dynamic.DynamicMetaObjectBinder:Bind
--------
> Caller's block containing inline root STMT00250:
STMT00249 ( INL45 @ 0x015[E-] ... ??? ) <- INLRT @ 0x0AA[E-]
               [000873] DA-XG------                         *  STORE_LCL_VAR ref    V66 tmp57
               [000870] n--XG------                         \--*  IND       ref
               [000869] ---XG------                            \--*  INDEX_ADDR byref ref[]
               [000867] -----------                               +--*  LCL_VAR   ref    V01 arg1
               [000868] -----------                               \--*  LCL_VAR   int    V65 tmp56

STMT00250 ( INL45 @ ??? ... ??? ) <- INLRT @ 0x0AA[E-]
               [000876] I-C-G------                         *  CALL      ref    System.Dynamic.DynamicMetaObject:Create(System.Object,System.Linq.Expressions.Expression):System.Dynamic.DynamicMetaObject (exactContextHandle=0x00007FFAC8283729)
               [000874] ----------- arg0                    +--*  LCL_VAR   ref    V66 tmp57
               [000889] --CXG------ arg1                    \--*  CALLV stub ref    System.Collections.Generic.IList`1[System.__Canon]:get_Item(int):System.__Canon:this
               [000888] n--XG------ this                       +--*  IND       ref
               [000887] ---X-------                            |  \--*  FIELD_ADDR byref  System.Collections.ObjectModel.ReadOnlyCollection`1[System.__Canon]:list
               [000051] -----------                            |     \--*  LCL_VAR   ref    V02 arg2
               [000871] ----------- arg1                       \--*  LCL_VAR   int    V65 tmp56

STMT00251 ( INL45 @ ??? ... ??? ) <- INLRT @ 0x0AA[E-]
               [000879] --CXG------                         *  CALL help void   CORINFO_HELP_ARRADDR_ST
               [000863] ----------- arg0                    +--*  LCL_VAR   ref    V63 tmp54
               [000878] ----------- arg1                    +--*  CAST      long <- int
               [000866] -----------                         |  \--*  SUB       int
               [000864] -----------                         |     +--*  LCL_VAR   int    V65 tmp56
               [000865] -----------                         |     \--*  CNS_INT   int    1
               [000877] --C-------- arg2                    \--*  RET_EXPR  ref   (for [000876]) -> [000945]

STMT00252 ( INL45 @ 0x029[E-] ... ??? ) <- INLRT @ 0x0AA[E-]
               [000883] DA---------                         *  STORE_LCL_VAR int    V65 tmp56
               [000882] -----------                         \--*  ADD       int
               [000880] -----------                            +--*  LCL_VAR   int    V65 tmp56
               [000881] -----------                            \--*  CNS_INT   int    1
--------
> Inlinee blocks:
STMT00254 ( 0x000[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000893] I-C-G------                         *  CALL      void   System.ArgumentNullException:ThrowIfNull(System.Object,System.String) (exactContextHandle=0x00007FFAC73E7249)
               [000891] ----------- arg0                    +--*  LCL_VAR   ref    V68 tmp59
               [000892] ----------- arg1                    \--*  CNS_STR   ref   <string constant>

STMT00255 ( 0x00B[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000896] DAC-G------                         *  STORE_LCL_VAR ref    V69 tmp60
               [000895] --C-G------                         \--*  CALL help ref    CORINFO_HELP_ISINSTANCEOFINTERFACE
               [000894] H------N--- arg0                       +--*  CNS_INT(h) long   0x7ffac8287b50 class System.Dynamic.IDynamicMetaObjectProvider
               [000874] ----------- arg1                       \--*  LCL_VAR   ref    V66 tmp57

STMT00256 ( 0x012[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000900] -----------                         *  JTRUE     void
               [000899] -----------                         \--*  EQ        int
               [000897] -----------                            +--*  LCL_VAR   ref    V69 tmp60
               [000898] -----------                            \--*  CNS_INT   ref    null

STMT00270 ( 0x015[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000951] ---X-------                         *  JTRUE     void
               [000950] ---X-------                         \--*  NE        int
               [000949] H----------                            +--*  CNS_INT(h) long   0x7ffac8507b30 class Microsoft.CSharp.RuntimeBinder.ComInterop.IDispatchComObject
               [000948] #--X-------                            \--*  IND       long
               [000947] -----------                               \--*  LCL_VAR   ref    V69 tmp60

STMT00271 ( ??? ... ??? )
               [000953] DA---------                         *  STORE_LCL_VAR ref    V73 tmp64
               [000952] -----------                         \--*  LCL_VAR   ref    V69 tmp60

STMT00272 ( 0x015[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000954] I-C-G------                         *  CALL nullcheck ref    Microsoft.CSharp.RuntimeBinder.ComInterop.IDispatchComObject:System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression):System.Dynamic.DynamicMetaObject:this (exactContextHandle=0x00007FFAC8507B31)
               [000957] ----------- this                    +--*  LCL_VAR   ref    V73 tmp64
               [000956] ----------- arg1                    \--*  LCL_VAR   ref    V68 tmp59

STMT00273 ( ??? ... ??? )
               [000959] DAC--------                         *  STORE_LCL_VAR ref    V72 tmp63
               [000958] --C--------                         \--*  RET_EXPR  ref   (for [000954])

STMT00274 ( 0x015[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000960] DAC-G------                         *  STORE_LCL_VAR ref    V72 tmp63
               [000915] --C-G------                         \--*  CALLV stub ref    System.Dynamic.IDynamicMetaObjectProvider:GetMetaObject(System.Linq.Expressions.Expression):System.Dynamic.DynamicMetaObject:this
               [000913] ----------- this                       +--*  LCL_VAR   ref    V69 tmp60
               [000914] ----------- arg1                       \--*  LCL_VAR   ref    V68 tmp59

STMT00261 ( 0x015[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000917] DAC--------                         *  STORE_LCL_VAR ref    V71 tmp62
               [000946] -----------                         \--*  LCL_VAR   ref    V72 tmp63

STMT00262 ( 0x01D[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000921] -----------                         *  JTRUE     void
               [000920] -----------                         \--*  EQ        int
               [000918] -----------                            +--*  LCL_VAR   ref    V71 tmp62
               [000919] -----------                            \--*  CNS_INT   ref    null

STMT00264 ( 0x020[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000927] I-C-G------                         *  CALL nullcheck int    System.Dynamic.DynamicMetaObject:get_HasValue():ubyte:this (exactContextHandle=0x00007FFAC8283729)
               [000926] ----------- this                    \--*  LCL_VAR   ref    V71 tmp62

STMT00265 ( 0x020[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000931] --C--------                         *  JTRUE     void
               [000930] --C--------                         \--*  EQ        int
               [000928] --C--------                            +--*  RET_EXPR  int   (for [000927])
               [000929] -----------                            \--*  CNS_INT   int    0

STMT00266 ( 0x028[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000936] --C-G------                         *  JTRUE     void
               [000935] --C-G------                         \--*  EQ        int
               [000933] --C-G------                            +--*  CALL nullcheck ref    System.Dynamic.DynamicMetaObject:get_Value():System.Object:this
               [000932] ----------- this                       |  \--*  LCL_VAR   ref    V71 tmp62
               [000934] -----------                            \--*  CNS_INT   ref    null

STMT00267 ( 0x030[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000938] I-C-G------                         *  CALL nullcheck ref    System.Dynamic.DynamicMetaObject:get_Expression():System.Linq.Expressions.Expression:this (exactContextHandle=0x00007FFAC8283729)
               [000937] ----------- this                    \--*  LCL_VAR   ref    V71 tmp62

STMT00268 ( 0x030[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000942] --C--------                         *  JTRUE     void
               [000941] --C--------                         \--*  EQ        int
               [000939] --C--------                            +--*  RET_EXPR  ref   (for [000938])
               [000940] -----------                            \--*  LCL_VAR   ref    V68 tmp59

STMT00263 ( 0x039[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000925] --CXG------                         *  CALL help void   CORINFO_HELP_THROW
               [000924] --CXG------ arg0                    \--*  CALL      ref    System.Linq.Expressions.Error:InvalidMetaObjectCreated(System.Object):System.InvalidOperationException
               [000923] --CX------- arg0                       \--*  INTRINSIC ref    objGetType
               [000922] -----------                               \--*  LCL_VAR   ref    V69 tmp60

STMT00269 ( 0x045[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000944] DA---------                         *  STORE_LCL_VAR ref    V67 tmp58
               [000943] -----------                         \--*  LCL_VAR   ref    V71 tmp62

STMT00257 ( 0x047[E-] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000907] DA---------                         *  STORE_LCL_VAR ref    V70 tmp61
               [000906] -----------                         \--*  ALLOCOBJ  ref
               [000905] H----------                            \--*  CNS_INT(h) long   0x7ffac8283728 class System.Dynamic.DynamicMetaObject

STMT00258 ( ??? ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000909] I-C-G------                         *  CALL      void   System.Dynamic.DynamicMetaObject:.ctor(System.Linq.Expressions.Expression,System.Dynamic.BindingRestrictions,System.Object):this (exactContextHandle=0x00007FFAC8283729)
               [000908] ----------- this                    +--*  LCL_VAR   ref    V70 tmp61
               [000901] ----------- arg1                    +--*  LCL_VAR   ref    V68 tmp59
               [000903] #---------- arg2                    +--*  IND       ref
               [000902] H----------                         |  \--*  CNS_INT(h) long   0x18aa4400f18 const ptr Fseq[Empty]
               [000904] ----------- arg3                    \--*  LCL_VAR   ref    V66 tmp57

STMT00259 ( 0x053[--] ... ??? ) <- INL45 @ ??? <- INLRT @ 0x0AA[E-]
               [000911] DA---------                         *  STORE_LCL_VAR ref    V67 tmp58
               [000910] -----------                         \--*  LCL_VAR   ref    V70 tmp61

So here V67 can either be DynamicMetaObject or an object obtained from System.Dynamic.IDynamicMetaObjectProvider:GetMetaObject. They have the same type but the former is exact, while the later is from a virtual call so it's not exact.
I think this is why we are getting the test failure, and we don't get test failures without GDV because we don't even try inlining System.Dynamic.DynamicMetaObject:Create into System.Dynamic.DynamicMetaObjectBinder:Bind.

cc: @jakobbotsch

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 30, 2025

So I think the issue is in the importer:

if (info.compRetType == TYP_REF)
{
bool isExact = false;
bool isNonNull = false;
CORINFO_CLASS_HANDLE returnClsHnd = gtGetClassHandle(op2, &isExact, &isNonNull);
if (inlRetExpr->gtSubstExpr == nullptr)
{
// This is the first return, so best known type is the type
// of this return value.
impInlineInfo->retExprClassHnd = returnClsHnd;
impInlineInfo->retExprClassHndIsExact = isExact;
}
else if (impInlineInfo->retExprClassHnd != returnClsHnd)
{
// This return site type differs from earlier seen sites,
// so reset the info and we'll fall back to using the method's
// declared return type for the return spill temp.
impInlineInfo->retExprClassHnd = nullptr;
impInlineInfo->retExprClassHndIsExact = false;
}
}

We didn't check the difference of the type exactness here. If we see multiple sites have different exactness, we should reset it.
What do you think?

@jakobbotsch
Copy link
Member

Yes, that looks like the actual problem to me as well.

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 30, 2025

Tests should pass this time. PTAL.

@jakobbotsch
Copy link
Member

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, runtime-coreclr pgostress

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 30, 2025

Test failure seems unrelated.

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 31, 2025

Failures due to #112021.

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good.

@AndyAyersMS
Copy link
Member

Not clear why build analysis is red here. I think this change is good. but let's wait for the current CI problem to get resolved and merge up and run the tests once more.

@hez2010
Copy link
Contributor Author

hez2010 commented Jan 31, 2025

It seems that the infra issue is causing every PR to fail the CI. Looking at the logs it seems that the tests are passing, but the test environment is lacking some python dependencies so that the result was failed to upload correctly.

@AndyAyersMS
Copy link
Member

Yep. We are expecting the CI issues to be fixed fairly soon, and I will trigger new tests when that happens.

@AndyAyersMS
Copy link
Member

Should be fixed...

@AndyAyersMS
Copy link
Member

/azp run runtime-coreclr pgostress

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@hez2010
Copy link
Contributor Author

hez2010 commented Feb 1, 2025

Test failures are unrelated.

@AndyAyersMS AndyAyersMS merged commit 44167e0 into dotnet:main Feb 1, 2025
127 of 129 checks passed
@AndyAyersMS
Copy link
Member

Thanks again @hez2010 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

3 participants