Lsra JitStressRegs mode SpillAlways fixes (#89720)
authorKunal Pathak <Kunal.Pathak@microsoft.com>
Thu, 10 Aug 2023 11:05:46 +0000 (04:05 -0700)
committerGitHub <noreply@github.com>
Thu, 10 Aug 2023 11:05:46 +0000 (04:05 -0700)
* fix few scenarios for spillAlways()

* Include JitStressRegs=0x800

* Revert "Include JitStressRegs=0x800"

This reverts commit 170233235b3e24530386f48569a3e6f9d1de2b70.

src/coreclr/jit/lsra.cpp

index aa85b85..5c8fe4a 100644 (file)
@@ -4871,6 +4871,7 @@ void LinearScan::allocateRegisters()
 
         if (spillAlways() && lastAllocatedRefPosition != nullptr && !lastAllocatedRefPosition->IsPhysRegRef() &&
             !lastAllocatedRefPosition->getInterval()->isInternal &&
+            (!lastAllocatedRefPosition->RegOptional() || (lastAllocatedRefPosition->registerAssignment != RBM_NONE)) &&
             (RefTypeIsDef(lastAllocatedRefPosition->refType) || lastAllocatedRefPosition->getInterval()->isLocalVar))
         {
             assert(lastAllocatedRefPosition->registerAssignment != RBM_NONE);
@@ -5015,7 +5016,7 @@ void LinearScan::allocateRegisters()
                     {
                         // Available registers should not hold constants
                         assert(isRegAvailable(reg, physRegRecord->registerType));
-                        assert(!isRegConstant(reg, physRegRecord->registerType));
+                        assert(!isRegConstant(reg, physRegRecord->registerType) || spillAlways());
                         assert(nextIntervalRef[reg] == MaxLocation);
                         assert(spillCost[reg] == 0);
                     }