Skip to content

JIT: Last-use copy elision does not handle IR created by physical promotion #87471

@jakobbotsch

Description

@jakobbotsch

For example:

fgMorphTree BB13, STMT00013 (before)
               [000129] DACXG------                           STORE_LCL_VAR int    V06 tmp1         
               [000037] -ACXG------                         └──▌  CALL      int    System.Comparison`1[System.Collections.BigStruct]:Invoke(System.Collections.BigStruct,System.Collections.BigStruct):int:this
               [000006] ----------- this                       ├──▌  LCL_VAR   ref    V01 arg1          (last use)
               [000207] -A--------- arg1                       ├──▌  COMMA     struct
               [000206] UA---------                              ├──▌  STORE_LCL_FLD int    V07 tmp2         [+12]
               [000205] -----------                                └──▌  LCL_VAR   int    V17 tmp12        
               [000107] -----------                              └──▌  LCL_VAR   struct<System.Collections.BigStruct, 32> V07 tmp2          (last use)
               [000210] -A--------- arg2                       └──▌  COMMA     struct
               [000209] UA---------                               ├──▌  STORE_LCL_FLD int    V08 tmp3         [+12]
               [000208] -----------                                 └──▌  LCL_VAR   int    V18 tmp13        
               [000109] -----------                               └──▌  LCL_VAR   struct<System.Collections.BigStruct, 32> V08 tmp3          (last use)
Initializing arg info for 37.CALL:
Args for call [000037] CALL after AddFinalArgsAndDetermineABIInfo:
CallArg[[000006].LCL_VAR ref (By value), 1 reg: rcx, byteAlignment=8, wellKnown[ThisPointer]]
CallArg[[000207].COMMA struct (By ref), 1 reg: rdx, byteAlignment=8, isStruct]
CallArg[[000210].COMMA struct (By ref), 1 reg: r8, byteAlignment=8, isStruct]

Morphing args for 37.CALL:
making an outgoing copy for struct arg

We should set things up such that we do not need to make these copies. Either we can do the writeback stores before the call node or we can teach morph to support the pattern.

Metadata

Metadata

Assignees

Labels

Priority:2Work that is important, but not critical for the releasearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions