From 03d6801a0dad8d00a920783d80962870f66d38aa Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Mon, 23 Sep 2019 11:09:41 -0700 Subject: [PATCH] Copy live sets when splitting blocks (dotnet/coreclr#26809) With dotnet/coreclr#26456 we may generate labels for split blocks (even though there's no associated code). Therefore we need to ensure that the live sets are correct. Also, cleanup some miscellaneous dumping code. Fix dotnet/coreclr#26795 Commit migrated from https://github.com/dotnet/coreclr/commit/7ff9851cdee43f9ae5bec5f1c28f52609526542e --- src/coreclr/src/jit/codegenlinear.cpp | 2 +- src/coreclr/src/jit/compiler.cpp | 4 ++-- src/coreclr/src/jit/importer.cpp | 8 ++++---- src/coreclr/src/jit/lclvars.cpp | 4 ++++ src/coreclr/src/jit/lsra.cpp | 7 ++++++- src/coreclr/src/jit/lsrabuild.cpp | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/jit/codegenlinear.cpp b/src/coreclr/src/jit/codegenlinear.cpp index a21d591..65766f7 100644 --- a/src/coreclr/src/jit/codegenlinear.cpp +++ b/src/coreclr/src/jit/codegenlinear.cpp @@ -600,8 +600,8 @@ void CodeGen::genCodeForBBlist() } if (foundMismatchedRegVar) { - assert(!"Found mismatched live reg var(s) after block"); JITDUMP("\n"); + assert(!"Found mismatched live reg var(s) after block"); } #endif diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index 89df2e0..d3042dc 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -4249,7 +4249,7 @@ void Compiler::compFunctionTraceStart() { printf(" "); } - printf("{ Start Jitting %s (MethodHash=%08x)\n", info.compFullName, + printf("{ Start Jitting Method %d %s (MethodHash=%08x)\n", Compiler::jitTotalMethodCompiled, info.compFullName, info.compMethodHash()); /* } editor brace matching workaround for this printf */ } #endif // DEBUG @@ -4273,7 +4273,7 @@ void Compiler::compFunctionTraceEnd(void* methodCodePtr, ULONG methodCodeSize, b printf(" "); } /* { editor brace-matching workaround for following printf */ - printf("} Jitted Entry %03x at" FMT_ADDR "method %s size %08x%s%s\n", Compiler::jitTotalMethodCompiled, + printf("} Jitted Method %03x at" FMT_ADDR "method %s size %08x%s%s\n", Compiler::jitTotalMethodCompiled, DBG_ADDR(methodCodePtr), info.compFullName, methodCodeSize, isNYI ? " NYI" : (compIsForImportOnly() ? " import only" : ""), opts.altJit ? " altjit" : ""); } diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index 17a6782..1db5063 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -19529,7 +19529,7 @@ void Compiler::impMarkInlineCandidate(GenTree* callNode, if (call->IsVirtualStub()) { JITDUMP("Restoring stub addr %p from guarded devirt candidate info\n", - call->gtGuardedDevirtualizationCandidateInfo->stubAddr); + dspPtr(call->gtGuardedDevirtualizationCandidateInfo->stubAddr)); call->gtStubCallStubAddr = call->gtGuardedDevirtualizationCandidateInfo->stubAddr; } } @@ -20126,11 +20126,11 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, if (uniqueImplementingClass == NO_CLASS_HANDLE) { - JITDUMP("No unique implementor of interface %p (%s), sorry\n", objClass, objClassName); + JITDUMP("No unique implementor of interface %p (%s), sorry\n", dspPtr(objClass), objClassName); return; } - JITDUMP("Only known implementor of interface %p (%s) is %p (%s)!\n", objClass, objClassName, + JITDUMP("Only known implementor of interface %p (%s) is %p (%s)!\n", dspPtr(objClass), objClassName, uniqueImplementingClass, eeGetClassName(uniqueImplementingClass)); bool guessUniqueInterface = true; @@ -20713,7 +20713,7 @@ void Compiler::addGuardedDevirtualizationCandidate(GenTreeCall* call, // Save off the stub address since it shares a union with the candidate info. if (call->IsVirtualStub()) { - JITDUMP("Saving stub addr %p in candidate info\n", call->gtStubCallStubAddr); + JITDUMP("Saving stub addr %p in candidate info\n", dspPtr(call->gtStubCallStubAddr)); pInfo->stubAddr = call->gtStubCallStubAddr; } else diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 52591fb..3c171cb 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -6848,6 +6848,10 @@ void Compiler::lvaDumpEntry(unsigned lclNum, FrameLayoutState curState, size_t r { printf(" exact"); } + if (varDsc->lvLiveInOutOfHndlr) + { + printf(" EH-live"); + } #ifndef _TARGET_64BIT_ if (varDsc->lvStructDoubleAlign) printf(" double-align"); diff --git a/src/coreclr/src/jit/lsra.cpp b/src/coreclr/src/jit/lsra.cpp index 0eef8b5..6f3916e 100644 --- a/src/coreclr/src/jit/lsra.cpp +++ b/src/coreclr/src/jit/lsra.cpp @@ -5852,7 +5852,7 @@ void LinearScan::allocateRegisters() } #ifdef JIT32_GCENCODER - // For the JIT32_GCENCODER, when lvaKeepAliveAndReportThis is true, we must either keep this "this" pointer + // For the JIT32_GCENCODER, when lvaKeepAliveAndReportThis is true, we must either keep the "this" pointer // in the same register for the entire method, or keep it on the stack. Rather than imposing this constraint // as we allocate, we will force all refs to the stack if it is split or spilled. if (enregisterLocalVars && compiler->lvaKeepAliveAndReportThis()) @@ -8174,6 +8174,11 @@ void LinearScan::resolveEdges() } SplitEdgeInfo info = {predBBNum, succBBNum}; getSplitBBNumToTargetBBNumMap()->Set(block->bbNum, info); + + // Set both the live-in and live-out to the live-in of the successor (by construction liveness + // doesn't change in a split block). + VarSetOps::Assign(compiler, block->bbLiveIn, succBlock->bbLiveIn); + VarSetOps::Assign(compiler, block->bbLiveOut, succBlock->bbLiveIn); } } } diff --git a/src/coreclr/src/jit/lsrabuild.cpp b/src/coreclr/src/jit/lsrabuild.cpp index d70267d..f5ff0f8 100644 --- a/src/coreclr/src/jit/lsrabuild.cpp +++ b/src/coreclr/src/jit/lsrabuild.cpp @@ -2079,7 +2079,7 @@ void LinearScan::buildIntervals() { JITDUMP("\n\nSetting " FMT_BB " as the predecessor for determining incoming variable registers of " FMT_BB "\n", - block->bbNum, predBlock->bbNum); + predBlock->bbNum, block->bbNum); assert(predBlock->bbNum <= bbNumMaxBeforeResolution); blockInfo[block->bbNum].predBBNum = predBlock->bbNum; } -- 2.7.4