-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[RyuJit/ARM] Fix lsra BuildShiftRotate #17103
Conversation
ef1a2ec
to
4d6f13b
Compare
@dotnet-bot test Windows_NT arm Cross Checked r2r Build and Test |
PR that added the previous implementation for arm #10145 (with the error). |
@dotnet-bot test Windows_NT x86_arm_altjit Checked r2r |
This pr shows the failure. |
PTAL @dotnet/jit-contrib |
@dotnet-bot test Windows_NT arm Cross Checked r2r Build and Test |
Actually, it's not fidelity with the execution order of the nodes that matters. The "execution order" (which is basically meaningless for lclVar uses) may not be the same as the operand order in the node. What matters is that the order of uses modeled by LSRA must be the same as the order of uses used by the code generator. Both LSRA and codegen should be handling the uses according to their canonical order. It would be costly for LSRA to use the operand iterator, as it frequently needs to special handle specific operands. One could add an assertion pass after As an aside, it used to be that both LSRA and codegen would pay attention to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR causes regression in Windows_NT.arm.Debug\JIT\CodeGenBringUpTests\Rotate (wrong result) with JitStress=2. I am investigating. |
Ok, there was a special handling for
|
@sandreenko - I'm not sure I understand what's failing and what's not, but there's a problem with the code in However, I believe that all the uses of At some point I would like to see us clean up the handling of multi-reg nodes in the GenTree hierarchy. |
PR was updated, so I returned the special handling for arm32 |
@dotnet-bot test Windows_NT arm Cross Checked r2r Build and Test |
Thank you, I was trying to compare master output with my branch results and hit this assert in the master version in debug. |
Also this PR fixes DevDiv_544980 |
src/jit/lsraarm.cpp
Outdated
//------------------------------------------------------------------------ | ||
// BuildShiftLongCarry: Set the node info for GT_LSH_HI or GT_RSH_LO. | ||
// | ||
// Note: these operands have interfering uses and need the special handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more correct to say that they have uses that interfere with the def (uses are always considered to interfere with each other).
Also, please put the note below the arguments as per the function header guidelines.
Otherwise, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, fixed.
Fix uses order for shift and rotate uses on arm arch.
Before it added
shiftBy
beforesource
ad when they point to the same local variable we hit assert:codegenlinear.cpp (749) - Assertion failed 'varDsc->lvRegNum == tree->gtRegNum'
for such example:
0001
will spill the variable first, then0002
will reload it and do not spill (because live interval is not marked asspill_after
because we build them in the exection order).then
0003
will find that the variable is not spilled yet (it is location is not 'STACK' and will try to spill it, but check that it is alive only in the currect register).The right order is to reload after
0001
(GTF_SPILLED
) spill after0002
(GTF_SPILL
) and reload at0003
(GTF_SPILLED
).Fix DevDiv_545497 and DevDiv_544980.
Note: It looks very fragile that lsra builds its own uses order instead if using the execution order.