summaryrefslogtreecommitdiff
path: root/src/jit/lsra.cpp
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2019-04-15 15:38:44 -0700
committerSergey Andreenko <seandree@microsoft.com>2019-04-15 17:34:02 -0700
commit4905d63d9d03cc1b8b46f6830b50489ee93ce33f (patch)
tree4231a8720aaab4d9d89a578b60d96c5b02770bec /src/jit/lsra.cpp
parentb97f0681a4ebfb79ee0b931602cda645bad2125e (diff)
downloadcoreclr-4905d63d9d03cc1b8b46f6830b50489ee93ce33f.tar.gz
coreclr-4905d63d9d03cc1b8b46f6830b50489ee93ce33f.tar.bz2
coreclr-4905d63d9d03cc1b8b46f6830b50489ee93ce33f.zip
Fix lsraBlockEpoch check.
Diffstat (limited to 'src/jit/lsra.cpp')
-rw-r--r--src/jit/lsra.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 8a5323ced2..e672582c03 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -740,7 +740,7 @@ BasicBlock* LinearScan::getNextCandidateFromWorkList()
}
//------------------------------------------------------------------------
-// setBlockSequence:Determine the block order for register allocation.
+// setBlockSequence: Determine the block order for register allocation.
//
// Arguments:
// None
@@ -756,9 +756,16 @@ BasicBlock* LinearScan::getNextCandidateFromWorkList()
void LinearScan::setBlockSequence()
{
- // Reset the "visited" flag on each block.
+ assert(!blockSequencingDone); // The method should be called only once.
+
compiler->EnsureBasicBlockEpoch();
+#ifdef DEBUG
+ blockEpoch = compiler->GetCurBasicBlockEpoch();
+#endif // DEBUG
+
+ // Initialize the "visited" blocks set.
bbVisitedSet = BlockSetOps::MakeEmpty(compiler);
+
BlockSet readySet(BlockSetOps::MakeEmpty(compiler));
BlockSet predSet(BlockSetOps::MakeEmpty(compiler));
@@ -1094,10 +1101,14 @@ BasicBlock* LinearScan::startBlockSequence()
{
setBlockSequence();
}
+ else
+ {
+ clearVisitedBlocks();
+ }
+
BasicBlock* curBB = compiler->fgFirstBB;
curBBSeqNum = 0;
curBBNum = curBB->bbNum;
- clearVisitedBlocks();
assert(blockSequence[0] == compiler->fgFirstBB);
markBlockVisited(curBB);
return curBB;
@@ -1172,8 +1183,6 @@ void LinearScan::doLinearScan()
enregisterLocalVars = false;
}
- unsigned lsraBlockEpoch = compiler->GetCurBasicBlockEpoch();
-
splitBBNumToTargetBBNumMap = nullptr;
// This is complicated by the fact that physical registers have refs associated
@@ -1189,7 +1198,6 @@ void LinearScan::doLinearScan()
DBEXEC(VERBOSE, lsraDumpIntervals("after buildIntervals"));
- clearVisitedBlocks();
initVarRegMaps();
allocateRegisters();
allocationPassComplete = true;
@@ -1197,6 +1205,9 @@ void LinearScan::doLinearScan()
resolveRegisters();
compiler->EndPhase(PHASE_LINEAR_SCAN_RESOLVE);
+ assert(blockSequencingDone); // Should do at least one traversal.
+ assert(blockEpoch == compiler->GetCurBasicBlockEpoch());
+
#if TRACK_LSRA_STATS
if ((JitConfig.DisplayLsraStats() != 0)
#ifdef DEBUG
@@ -1211,7 +1222,6 @@ void LinearScan::doLinearScan()
DBEXEC(VERBOSE, TupleStyleDump(LSRA_DUMP_POST));
compiler->compLSRADone = true;
- noway_assert(lsraBlockEpoch = compiler->GetCurBasicBlockEpoch());
}
//------------------------------------------------------------------------