You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: perf regression from improved local struct copy prop #75229
We now run asserion gen "early" for some block expansions, so we miss out on some assertions for some kinds of expansions.
In particular in the baseline jit we did:
fgMorphTree BB02, STMT00005 (before)
[000026] IA--------- * ASG struct (init)
[000025] n------N--- +--* BLK struct<8>
[000023] ----------- | \--* ADDR byref
[000022] -------N--- | \--* LCL_VAR ref V03 loc2
[000024] ----------- \--* CNS_INT int 0
MorphInitBlock:
MorphBlock for dst tree, before:
[000025] n----+-N--- * BLK struct<8>
[000023] -----+----- \--* ADDR byref
[000022] D----+-N--- \--* LCL_VAR ref V03 loc2
MorphBlock after:
[000025] n----+-N--- * BLK struct<8>
[000023] -----+----- \--* ADDR byref
[000022] D----+-N--- \--* LCL_VAR ref V03 loc2
PrepareDst for [000025] have found a local var V03.
fgMorphOneAsgBlock (after):
[000026] -A--------- * ASG ref
[000022] D----+-N--- +--* LCL_VAR ref V03 loc2
[000024] -----+----- \--* CNS_INT ref null
MorphInitBlock (after):
[000026] -A--------- * ASG ref
[000022] D----+-N--- +--* LCL_VAR ref V03 loc2
[000024] -----+----- \--* CNS_INT ref null
GenTreeNode creates assertion:
[000026] -A--------- * ASG ref
In BB02 New Local Constant Assertion: V03 == null, index = #01
fgMorphTree BB02, STMT00005 (after)
[000026] -A---+----- * ASG ref
[000022] D----+-N--- +--* LCL_VAR ref V03 loc2
[000024] -----+----- \--* CNS_INT ref null
fgMorphTree BB02, STMT00006 (before)
[000029] --CXG------ * CALL help void HELPER.CORINFO_HELP_ARRADDR_ST
[000020] ----------- arg0 +--* LCL_VAR ref V01 loc0
[000028] ----------- arg1 +--* CAST long <- int
[000021] ----------- | \--* LCL_VAR int V02 loc1
[000027] ----------- arg2 \--* LCL_VAR ref V03 loc2
Initializing arg info for 29.CALL:
Args for call [000029] CALL after AddFinalArgsAndDetermineABIInfo:
CallArg[[000020].LCL_VAR ref (By value), 1 reg: rcx, byteAlignment=8]
CallArg[[000028].CAST long (By value), 1 reg: rdx, byteAlignment=8]
CallArg[[000027].LCL_VAR ref (By value), 1 reg: r8, byteAlignment=8]
Morphing args for 29.CALL:
Assertion prop in BB02:
Constant Assertion: V03 == null, index = #01
[000027] ----------- * CNS_INT ref null
Sorting the arguments:
Deferred argument ('rdx'):
[000028] -----+----- * CAST long <- int
[000021] -----+----- \--* LCL_VAR int V02 loc1
Moved to late list
Deferred argument ('rcx'):
[000020] -----+----- * LCL_VAR ref V01 loc0
Moved to late list
Deferred argument ('r8'):
[000027] -----+----- * CNS_INT ref null
Moved to late list
Register placement order: rdx rcx r8
Args for [000029].CALL after fgMorphArgs:
CallArg[[000020].LCL_VAR ref (By value), 1 reg: rcx, byteAlignment=8, isLate, processed]
CallArg[[000028].CAST long (By value), 1 reg: rdx, byteAlignment=8, isLate, processed]
CallArg[[000027].CNS_INT ref (By value), 1 reg: r8, byteAlignment=8, isLate, processed]
OutgoingArgsStackSize is 32
fgMorphIndexAddr (before remorph):
[000049] ---X------- * COMMA byref
[000042] ---X------- +--* BOUNDS_CHECK_Rng void
In the current jit we don't get this assertion. This optimization happens later during assertion prop, but by then it is too late to hoist invariants. So, we end up with the following inner loop codegen where a load is not hoisted.
Seems like we perhaps should re-run assertion gen if we do field-by field or "one asg block" expansion.
Also seems odd that we don't try and detect this optimization in preorder -- we could avoid going through call morphing just to undo the call later on in morph. Anyways...
Activity
AndyAyersMS commentedon Sep 9, 2022
We now run asserion gen "early" for some block expansions, so we miss out on some assertions for some kinds of expansions.
In particular in the baseline jit we did:
In the current jit we don't get this assertion. This optimization happens later during assertion prop, but by then it is too late to hoist invariants. So, we end up with the following inner loop codegen where a load is not hoisted.
Seems like we perhaps should re-run assertion gen if we do field-by field or "one asg block" expansion.
Also seems odd that we don't try and detect this optimization in preorder -- we could avoid going through call morphing just to undo the call later on in morph. Anyways...
JIT: propagate some block assertions after expansion
JIT: propagate some block assertions after expansion (#75321)
AndyAyersMS commentedon Sep 14, 2022