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
***************In optOptimizeCSEs()
Blocks/Trees at start of optOptimizeCSE phase
-----------------------------------------------------------------------------------------------------------------------------------------BBnumBBid ref try hnd preds weight lp [IL range] [jump] [EH region] [flags]
-----------------------------------------------------------------------------------------------------------------------------------------BB01 [0000] 11 [000..017) (return) i label target
-----------------------------------------------------------------------------------------------------------------------------------------------------BB01 [000..017) (return), preds={} succs={}
*****BB01STMT00001 (IL0x003...0x005)
N003 ( 5, 6) [000005] -A--G-------*ASG int $42N001 ( 3, 4) [000004] ----G--N----+--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] $100N002 ( 1, 1) [000003] ------------ \--*CNS_INT int 42 $42*****BB01STMT00002 (IL0x00A...0x016)
N009 ( 11, 12) [000013] ----G-------*RETURN int $141N008 ( 10, 11) [000012] ----G------- \--*ADD int <l:$47, c:$1c1>
N006 ( 8, 9) [000016] ----G-------+--*NEG int <l:$45, c:$182>
N005 ( 7, 8) [000015] ----G-------| \--*NEG int <l:$44, c:$181>
N004 ( 6, 7) [000010] ----G-------| \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------|+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------|| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------| \--*CNS_INT int 21 $44N007 ( 1, 1) [000006] ------------ \--*CNS_INT int 43 $46-------------------------------------------------------------------------------------------------------------------***************In optOptimizeValnumCSEs()
CSE candidate #01, key=$45 in BB01, [cost=8, size=9]:N006 ( 8, 9) CSE #01 (use)[000016] ----G-------*NEG int <l:$45, c:$182>
N005 ( 7, 8) [000015] ----G------- \--*NEG int <l:$44, c:$181>
N004 ( 6, 7) CSE #01 (use)[000010] ----G------- \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------ \--*CNS_INT int 21 $44Blocks that generate CSEdef/uses
BB01 cseGen =0000000000000003PerformingDataFlowforValnumCSE'sStartMergeBB01:: cseOut =0000000000000007EndMergeBB01:: cseIn =0000000000000000:: cseGen =0000000000000003=> cseOut =0000000000000003!= preMerge =0000000000000007, =>trueAfter performing DataFlowforValnumCSE'sBB01 cseIn =0000000000000000, cseGen =0000000000000003, cseOut =0000000000000003Labeling the CSEswithUse/Def information
BB01 [000010] Def of CSE #01 [weight=1 ]
BB01 [000016] Use of CSE #01 [weight=1 ]
************Trees at start of optValnumCSE_Heuristic()
------------BB01 [000..017) (return), preds={} succs={}
*****BB01STMT00001 (IL0x003...0x005)
N003 ( 5, 6) [000005] -A--G-------*ASG int $42N001 ( 3, 4) [000004] ----G--N----+--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] $100N002 ( 1, 1) [000003] ------------ \--*CNS_INT int 42 $42*****BB01STMT00002 (IL0x00A...0x016)
N009 ( 11, 12) [000013] ----G-------*RETURN int $141N008 ( 10, 11) [000012] ----G------- \--*ADD int <l:$47, c:$1c1>
N006 ( 8, 9) CSE #01 (use)[000016] ----G-------+--*NEG int <l:$45, c:$182>
N005 ( 7, 8) [000015] ----G-------| \--*NEG int <l:$44, c:$181>
N004 ( 6, 7) CSE #01 (def)[000010] ----G-------| \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------|+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------|| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------| \--*CNS_INT int 21 $44N007 ( 1, 1) [000006] ------------ \--*CNS_INT int 43 $46-------------------------------------------------------------------------------------------------------------------AggressiveCSEPromotion cutoff is 200.000000ModerateCSEPromotion cutoff is 100.000000
enregCount is 1Framesize estimate is 0x0000We have a small frame
SortedCSEcandidates:
CSE #01, {$45 , $4 } useCnt=1: [def=100.000000, use=100.000000, cost=6 ]
::N004 ( 6, 7) CSE #01 (def)[000010] ----G-------*ADD int <l:$45, c:$1c0>
ConsideringCSE #01 {$45 , $4 } [def=100.000000, use=100.000000, cost=6 ]
CSEExpression:N004 ( 6, 7) CSE #01 (def)[000010] ----G-------*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------ \--*CNS_INT int 21 $44AggressiveCSEPromotion (300.000000>=200.000000)
cseRefCnt=300.000000, aggressiveRefCnt=200.000000, moderateRefCnt=100.000000
defCnt=100.000000, useCnt=100.000000, cost=6, size=7
def_cost=1, use_cost=1, extra_no_cost=12, extra_yes_cost=0CSE cost savings check (612.000000>=200.000000) passes
PromotingCSE:
lvaGrabTemp returning 2 (V02 rat0) (a long lifetime temp) called forCSE- aggressive.
CSE #01 is single-def, so associated CSE temp V02 will be in SSANew refCnts forV02: refCnt =2, refCntWtd =2New refCnts forV02: refCnt =3, refCntWtd =3CSE #01defat [000010] replaced in BB01withdefofV02
optValnumCSE morphed tree:
N011 ( 10, 11) [000013] -A--G-------*RETURN int $141N010 ( 9, 10) [000012] -A--G------- \--*ADD int <l:$47, c:$1c1>
N008 ( 7, 8) [000020] -A--G-------+--*COMMA int <l:$45, c:$1c0>
N006 ( 6, 7) [000018] -A--G---R---|+--*ASG int $VN.VoidN005 ( 1, 1) [000017] D------N----||+--*LCL_VAR int V02 cse0 d:1 <l:$45, c:$1c0>
N004 ( 6, 7) [000010] ----G-------|| \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------||+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------||| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------|| \--*CNS_INT int 21 $44N007 ( 1, 1) [000019] ------------| \--*LCL_VAR int V02 cse0 u:1 <l:$45, c:$1c0>
N009 ( 1, 1) [000006] ------------ \--*CNS_INT int 43 $46Working on the replacement of the CSE #01 use at [000016] in BB01ThisCSE use has side effects and/or nested CSE defs. ThesideEffectList:
N006 ( 6, 7) [000018] -A--G---R---*ASG int $VN.VoidN005 ( 1, 1) [000017] D------N----+--*LCL_VAR int V02 cse0 d:1 <l:$45, c:$1c0>
N004 ( 6, 7) [000010] ----G------- \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------ \--*CNS_INT int 21 $44
gtFindLink failed: stm=STMT00002, exp=[000016]
stm =STMT00002 (IL0x00A...0x016)
N011 ( 10, 11) [000013] -A--G-------*RETURN int $141N010 ( 9, 10) [000012] -A--G------- \--*ADD int <l:$47, c:$1c1>
N008 ( 7, 8) [000020] -A--G-------+--*COMMA int <l:$45, c:$1c0>
N006 ( 6, 7) [000018] -A--G---R---|+--*ASG int $VN.VoidN005 ( 1, 1) [000017] D------N----||+--*LCL_VAR int V02 cse0 d:1 <l:$45, c:$1c0>
N004 ( 6, 7) [000010] ----G-------|| \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------||+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------||| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------|| \--*CNS_INT int 21 $44N007 ( 1, 1) [000019] ------------| \--*LCL_VAR int V02 cse0 u:1 <l:$45, c:$1c0>
N009 ( 1, 1) [000006] ------------ \--*CNS_INT int 43 $46
exp =N006 ( 8, 9) [000016] -A--G-------*NEG int <l:$45, c:$182>
N005 ( 7, 8) [000015] -A--G------- \--*NEG int <l:$44, c:$181>
N008 ( 7, 8) [000020] -A--G------- \--*COMMA int <l:$45, c:$1c0>
N006 ( 6, 7) [000018] -A--G---R---+--*ASG int $VN.VoidN005 ( 1, 1) [000017] D------N----|+--*LCL_VAR int V02 cse0 d:1 <l:$45, c:$1c0>
N004 ( 6, 7) [000010] ----G-------| \--*ADD int <l:$45, c:$1c0>
N002 ( 4, 5) [000014] ----G-------|+--*NEG int <l:$43, c:$180>
N001 ( 3, 4) [000009] ----G-------|| \--*CLS_VAR int Hnd=0xbfd83170Fseq[_counter] <l:$42, c:$140>
N003 ( 1, 1) [000008] ------------| \--*CNS_INT int 21 $44N007 ( 1, 1) [000019] ------------ \--*LCL_VAR int V02 cse0 u:1 <l:$45, c:$1c0>
Assert failure(PID6956 [0x00001b2c], Thread:19572 [0x4c74]):Assertion failed 'link' in 'RyuJitReproduction.Program:Problem():int' during 'OptimizeValnumCSEs' (IL size 23)File:C:\Users\Accretion\source\dotnet\runtime\src\coreclr\jit\optcse.cpp Line:3290Image:C:\Users\Accretion\source\dotnet\runtime\artifacts\bin\coreclr\Windows.x64.Checked\CoreRun.exe
Looking into it, I think the root cause is that morph doesn't account for possible CSEs when folding NET(NEG). Will submit a fix for this shortly. One more special case for CSE in morph, but what can one do.
A bit of a separate question is should we even try do CSE on such trees...
The text was updated successfully, but these errors were encountered:
While working on #49535, I have uncovered (via an SPMI replay) what appears to be a preexisting issue in how CSE is performed.
The following reproduction hits a
noway_assert
inoptcse.cpp:3290
:The trees
Looking into it, I think the root cause is that morph doesn't account for possible CSEs when folding
NET(NEG)
. Will submit a fix for this shortly. One more special case for CSE in morph, but what can one do.A bit of a separate question is should we even try do CSE on such trees...
The text was updated successfully, but these errors were encountered: