Various fixes for consecutive registers found with jitstressregs (#84824)
authorKunal Pathak <Kunal.Pathak@microsoft.com>
Thu, 20 Apr 2023 00:05:59 +0000 (17:05 -0700)
committerGitHub <noreply@github.com>
Thu, 20 Apr 2023 00:05:59 +0000 (17:05 -0700)
commit42acf9ee1960db339066f84965d95d7df9506a4a
treef6befde329c80bff3dbe827fab74927166f147bf
parent6149ca07d2202c2d0d518e10568c0d0dd3473576
Various fixes for consecutive registers found with jitstressregs (#84824)

* restore the upper vector at the use of GT_FIELD_LIST

* Introduce isLiveAtConsecutiveRegistersLoc and fix #84747

This method will track if the defs/uses are live at the same location as
where the consecutive registers were allocated. If yes, it will skip the
constraint imposition on it during JitStressRegs

* Handle tracking of previously assigned register for copyReg

When we have copyReg that was just restored or previously assigned
to a different register, also track it as live at the location so
it doesn't get allocated again for different refposition at the same
location.

* fix the release build errors

* Mark consecutive refpositions registers as busy

* Update the comments

* Stop stresslimiting registerAssignment and instead limit the free registers

Under JitStressRegs, there are multiple ways in which consecutive registers demand
cannot be met. So skip restricting the registers for `registerAssignment` of a refPosition
(which are allowable candidates that can be assigned to the given refposition). Instead
limit the free registers to alternate under stress mode, so we can verify the code if it
can handle situation where it needs to pick from a mix of free/busy registers.

* Introduce updateRegsFreeBusyState() for common trackign

* Update comment

* misc. changes

* review feedback
src/coreclr/jit/lsra.cpp
src/coreclr/jit/lsra.h
src/coreclr/jit/lsraarm64.cpp
src/coreclr/jit/lsrabuild.cpp