summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2017-09-06 15:51:22 -0700
committerPat Gavlin <pagavlin@microsoft.com>2017-09-06 15:51:22 -0700
commita6a61438b3451151b79c6d0a1188218d4fe121bb (patch)
treed00a8c0f1c5c0afbed6921eced256a33150c153a
parentb426e68b8f0a894216dc1e24526c4f11210c9249 (diff)
downloadcoreclr-a6a61438b3451151b79c6d0a1188218d4fe121bb.tar.gz
coreclr-a6a61438b3451151b79c6d0a1188218d4fe121bb.tar.bz2
coreclr-a6a61438b3451151b79c6d0a1188218d4fe121bb.zip
Fix VSO 487701 and 487702.
Both of these issues stem from attempting to unassign a copied interval from the copied-to register and then reassigning the interval to the same. This corrupts some of the bookkeeping necessary to track whether or not the interval in the register needs to be spilled, and the RA ends up attempting to spill the interval being allocated even though it is not assigned a register.
-rw-r--r--src/jit/lsra.cpp10
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_487701/DevDiv_487701.ilproj1
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_487702/DevDiv_487702.ilproj1
3 files changed, 7 insertions, 5 deletions
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 181ac35379..1a0966f6d5 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -5472,7 +5472,7 @@ regNumber LinearScan::tryAllocateFreeReg(Interval* currentInterval, RefPosition*
}
RegRecord* availablePhysRegInterval = nullptr;
- Interval* intervalToUnassign = nullptr;
+ bool unassignInterval = false;
// Each register will receive a score which is the sum of the scoring criteria below.
// These were selected on the assumption that they will have an impact on the "goodness"
@@ -5550,7 +5550,7 @@ regNumber LinearScan::tryAllocateFreeReg(Interval* currentInterval, RefPosition*
if (physRegRecord->assignedInterval == currentInterval)
{
availablePhysRegInterval = physRegRecord;
- intervalToUnassign = nullptr;
+ unassignInterval = false;
break;
}
@@ -5710,7 +5710,7 @@ regNumber LinearScan::tryAllocateFreeReg(Interval* currentInterval, RefPosition*
{
bestLocation = nextPhysRefLocation;
availablePhysRegInterval = physRegRecord;
- intervalToUnassign = physRegRecord->assignedInterval;
+ unassignInterval = true;
bestScore = score;
}
@@ -5723,9 +5723,9 @@ regNumber LinearScan::tryAllocateFreeReg(Interval* currentInterval, RefPosition*
if (availablePhysRegInterval != nullptr)
{
- if (isAssigned(availablePhysRegInterval ARM_ARG(currentInterval->registerType)))
+ if (unassignInterval && isAssigned(availablePhysRegInterval ARM_ARG(currentInterval->registerType)))
{
- intervalToUnassign = availablePhysRegInterval->assignedInterval;
+ Interval* const intervalToUnassign = availablePhysRegInterval->assignedInterval;
unassignPhysReg(availablePhysRegInterval ARM_ARG(currentInterval->registerType));
if ((bestScore & VALUE_AVAILABLE) != 0 && intervalToUnassign != nullptr)
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_487701/DevDiv_487701.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_487701/DevDiv_487701.ilproj
index 60e87dc421..03822f1b92 100644
--- a/tests/src/JIT/Regression/JitBlue/DevDiv_487701/DevDiv_487701.ilproj
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_487701/DevDiv_487701.ilproj
@@ -10,6 +10,7 @@
<OutputType>Exe</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_487702/DevDiv_487702.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_487702/DevDiv_487702.ilproj
index c3448fbf0f..6515e82f0d 100644
--- a/tests/src/JIT/Regression/JitBlue/DevDiv_487702/DevDiv_487702.ilproj
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_487702/DevDiv_487702.ilproj
@@ -10,6 +10,7 @@
<OutputType>Exe</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>