Skip to content

Recurisve intrinsics aren't expanded in T0 anymore #104871

@MichalPetryka

Description

@MichalPetryka

Description

Recursive intrinsics aren't expanded in T0 anymore, leaving a call to them instead. They do seem to expand in their bodies though as they don't stackoverflow.
Putting some dumps in the code indicates that mustExpand is false for them now.

; Assembly listing for method DisasmoPlayground.Disasms.EqualsDisasm:IsRef():ubyte (Tier0)
; Emitting BLENDED_CODE for X64 with AVX512 - Windows
; Tier0 code
; rbp based frame
; partially interruptible
; Final local variable assignments
;
;  V00 OutArgs      [V00    ] (  1,  1   )  struct (32) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
;
; Lcl frame size = 32

G_M33356_IG01:  ;; offset=0x0000
       push     rbp
       sub      rsp, 32
       lea      rbp, [rsp+0x20]
						;; size=10 bbWeight=1 PerfScore 1.75
G_M33356_IG02:  ;; offset=0x000A
       call     [System.Runtime.CompilerServices.RuntimeHelpers:IsReferenceOrContainsReferences[ubyte]():ubyte]
       nop      
						;; size=7 bbWeight=1 PerfScore 3.25
G_M33356_IG03:  ;; offset=0x0011
       add      rsp, 32
       pop      rbp
       ret      
						;; size=6 bbWeight=1 PerfScore 1.75

; Total bytes of code 23, prolog size 10, PerfScore 6.75, instruction count 8, allocated bytes for code 23 (MethodHash=f8a77db3) for method DisasmoPlayground.Disasms.EqualsDisasm:IsRef():ubyte (Tier0)
; ============================================================

[Boolean IsRef()]: False

; Assembly listing for method DisasmoPlayground.Disasms.EqualsDisasm:IsRef():ubyte (Tier1)
; Emitting BLENDED_CODE for X64 with AVX512 - Windows
; Tier1 code
; optimized code
; rsp based frame
; partially interruptible
; No PGO data
; Final local variable assignments
;
;# V00 OutArgs      [V00    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
;
; Lcl frame size = 0

G_M33356_IG01:  ;; offset=0x0000
						;; size=0 bbWeight=1 PerfScore 0.00
G_M33356_IG02:  ;; offset=0x0000
       xor      eax, eax
						;; size=2 bbWeight=1 PerfScore 0.25
G_M33356_IG03:  ;; offset=0x0002
       ret      
						;; size=1 bbWeight=1 PerfScore 1.00

; Total bytes of code 3, prolog size 0, PerfScore 1.25, instruction count 2, allocated bytes for code 3 (MethodHash=f8a77db3) for method DisasmoPlayground.Disasms.EqualsDisasm:IsRef():ubyte (Tier1)
; ============================================================

[Boolean IsRef()]: False

Reproduction Steps

Disasm a method calling any mustExpand intrinsic (any recursive one) like IsReferenceOrContainsReferences.

Expected behavior

It's expanded in T0.

Actual behavior

It's not expanded but seems to be expanded inside of itself as it doesn't stackoverflow.

Regression?

Yes, I assume #99818 caused this cc @EgorBo

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions