From: Carol Eidt Date: Thu, 13 Dec 2018 23:46:40 +0000 (-0800) Subject: Update var life for multireg local X-Git-Tag: submit/tizen/20210909.063632~11030^2~3067^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56db94b099a801101ccd9a46e299a6e18bfeebb3;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Update var life for multireg local When a multi-reg var is defined by a call, but doesn't currently reside in a register, we must still update liveness. Fix dotnet/coreclr#21500 Commit migrated from https://github.com/dotnet/coreclr/commit/61bdd1c239ce0f0c575b3ecc62e2c29ce9e27ede --- diff --git a/src/coreclr/src/jit/codegenarmarch.cpp b/src/coreclr/src/jit/codegenarmarch.cpp index 9b61328..494234b 100644 --- a/src/coreclr/src/jit/codegenarmarch.cpp +++ b/src/coreclr/src/jit/codegenarmarch.cpp @@ -1296,6 +1296,7 @@ void CodeGen::genMultiRegCallStoreToLocal(GenTree* treeNode) offset += genTypeSize(type); } + genUpdateLife(treeNode); varDsc->lvRegNum = REG_STK; } } diff --git a/src/coreclr/src/jit/codegenlinear.cpp b/src/coreclr/src/jit/codegenlinear.cpp index f474b88..3d4fe1a 100644 --- a/src/coreclr/src/jit/codegenlinear.cpp +++ b/src/coreclr/src/jit/codegenlinear.cpp @@ -512,15 +512,30 @@ void CodeGen::genCodeForBBlist() // it up to date for vars that are not register candidates // (it would be nice to have a xor set function) - VARSET_TP extraLiveVars(VarSetOps::Diff(compiler, block->bbLiveOut, compiler->compCurLife)); - VarSetOps::UnionD(compiler, extraLiveVars, VarSetOps::Diff(compiler, compiler->compCurLife, block->bbLiveOut)); - VarSetOps::Iter extraLiveVarIter(compiler, extraLiveVars); - unsigned extraLiveVarIndex = 0; - while (extraLiveVarIter.NextElem(&extraLiveVarIndex)) - { - unsigned varNum = compiler->lvaTrackedToVarNum[extraLiveVarIndex]; + VARSET_TP mismatchLiveVars(VarSetOps::Diff(compiler, block->bbLiveOut, compiler->compCurLife)); + VarSetOps::UnionD(compiler, mismatchLiveVars, + VarSetOps::Diff(compiler, compiler->compCurLife, block->bbLiveOut)); + VarSetOps::Iter mismatchLiveVarIter(compiler, mismatchLiveVars); + unsigned mismatchLiveVarIndex = 0; + bool foundMismatchedRegVar = false; + while (mismatchLiveVarIter.NextElem(&mismatchLiveVarIndex)) + { + unsigned varNum = compiler->lvaTrackedToVarNum[mismatchLiveVarIndex]; LclVarDsc* varDsc = compiler->lvaTable + varNum; - assert(!varDsc->lvIsRegCandidate()); + if (varDsc->lvIsRegCandidate()) + { + if (!foundMismatchedRegVar) + { + JITDUMP("Mismatched live reg vars after BB%02u:", block->bbNum); + foundMismatchedRegVar = true; + } + JITDUMP(" V%02u", varNum); + } + } + if (foundMismatchedRegVar) + { + assert(!"Found mismatched live reg var(s) after block"); + JITDUMP("\n"); } #endif