summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-03-12 09:02:44 -0700
committerGitHub <noreply@github.com>2018-03-12 09:02:44 -0700
commit70c8b4f5334ae63e4b91a696f97f0bdf9fa73c3a (patch)
treea80eeb3193534e78ade15dcc79269fa410b1c133
parentcc967cab9cb27021a5d13692f217ef7efb43de31 (diff)
parent0c5f3d4b76e0ac8e70d555080ba7e49d08121536 (diff)
downloadcoreclr-70c8b4f5334ae63e4b91a696f97f0bdf9fa73c3a.tar.gz
coreclr-70c8b4f5334ae63e4b91a696f97f0bdf9fa73c3a.tar.bz2
coreclr-70c8b4f5334ae63e4b91a696f97f0bdf9fa73c3a.zip
Merge pull request #16877 from CarolEidt/Fix16578
Fix LSRA enregisterLocalVars
-rw-r--r--src/jit/lsra.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 5687db92c1..6727599e48 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -708,7 +708,12 @@ LinearScan::LinearScan(Compiler* theCompiler)
#endif // 0
#endif // DEBUG
- enregisterLocalVars = ((compiler->opts.compFlags & CLFLG_REGVAR) != 0) && compiler->lvaTrackedCount > 0;
+ // Assume that we will enregister local variables if it's not disabled. We'll reset it if we
+ // have no tracked locals when we start allocating. Note that new tracked lclVars may be added
+ // after the first liveness analysis - either by optimizations or by Lowering, and the tracked
+ // set won't be recomputed until after Lowering (and this constructor is called prior to Lowering),
+ // so we don't want to check that yet.
+ enregisterLocalVars = ((compiler->opts.compFlags & CLFLG_REGVAR) != 0);
#ifdef _TARGET_ARM64_
availableIntRegs = (RBM_ALLINT & ~(RBM_PR | RBM_FP | RBM_LR) & ~compiler->codeGen->regSet.rsMaskResvd);
#else
@@ -1308,6 +1313,15 @@ BasicBlock* LinearScan::getNextBlock()
void LinearScan::doLinearScan()
{
+ // Check to see whether we have any local variables to enregister.
+ // We initialize this in the constructor based on opt settings,
+ // but we don't want to spend time on the lclVar parts of LinearScan
+ // if we have no tracked locals.
+ if (enregisterLocalVars && (compiler->lvaTrackedCount == 0))
+ {
+ enregisterLocalVars = false;
+ }
+
unsigned lsraBlockEpoch = compiler->GetCurBasicBlockEpoch();
splitBBNumToTargetBBNumMap = nullptr;