Fix assert when extending lifetimes (dotnet/coreclr#27839)
authorCarol Eidt <carol.eidt@microsoft.com>
Wed, 13 Nov 2019 16:00:28 +0000 (08:00 -0800)
committerGitHub <noreply@github.com>
Wed, 13 Nov 2019 16:00:28 +0000 (08:00 -0800)
This assert was added in the prework for EH write-thru. In the case where we're extending lifetimes for stress, we should ignore the locations of these. Note that they aren't reported to codegen anyway.

Fix dotnet/coreclr#27804

Commit migrated from https://github.com/dotnet/coreclr/commit/1fd33a734290138da009fbd0682f1f4399172b8f

src/coreclr/src/jit/lsra.cpp

index 17ec59b..e0cb77e 100644 (file)
@@ -4748,7 +4748,14 @@ void LinearScan::processBlockStartLocations(BasicBlock* currentBlock)
         // This should still be in its initialized empty state.
         for (unsigned varIndex = 0; varIndex < compiler->lvaTrackedCount; varIndex++)
         {
-            assert(inVarToRegMap[varIndex] == REG_STK);
+            // In the case where we're extending lifetimes for stress, we are intentionally modeling variables
+            // as live when they really aren't to create extra register pressure & constraints.
+            // However, this means that non-EH-vars will be live into EH regions. We can and should ignore the
+            // locations of these. Note that they aren't reported to codegen anyway.
+            if (!getLsraExtendLifeTimes() || VarSetOps::IsMember(compiler, currentBlock->bbLiveIn, varIndex))
+            {
+                assert(inVarToRegMap[varIndex] == REG_STK);
+            }
         }
 #endif // DEBUG
         predVarToRegMap = inVarToRegMap;