diff --git a/src/coreclr/jit/fgopt.cpp b/src/coreclr/jit/fgopt.cpp index 39e1dae21e3519..d8171d6868dc10 100644 --- a/src/coreclr/jit/fgopt.cpp +++ b/src/coreclr/jit/fgopt.cpp @@ -1494,14 +1494,18 @@ void Compiler::fgPostImportationCleanup() // We'll need a state variable to control the branching. // - // It will be zero when the OSR method is entered and set to one + // It will be initialized to zero when the OSR method is entered and set to one // once flow reaches the osrEntry. // - unsigned const entryStateVar = lvaGrabTemp(false DEBUGARG("OSR entry state var")); - lvaTable[entryStateVar].lvType = TYP_INT; - lvaTable[entryStateVar].lvMustInit = true; + unsigned const entryStateVar = lvaGrabTemp(false DEBUGARG("OSR entry state var")); + lvaTable[entryStateVar].lvType = TYP_INT; - // Set the state variable when we reach the entry. + // Zero the entry state at method entry. + // + GenTree* const initEntryState = gtNewTempAssign(entryStateVar, gtNewZeroConNode(TYP_INT)); + fgNewStmtAtBeg(fgFirstBB, initEntryState); + + // Set the state variable once control flow reaches the OSR entry. // GenTree* const setEntryState = gtNewTempAssign(entryStateVar, gtNewOneConNode(TYP_INT)); fgNewStmtAtBeg(osrEntry, setEntryState); @@ -3413,6 +3417,11 @@ bool Compiler::fgOptimizeUncondBranchToSimpleCond(BasicBlock* block, BasicBlock* return false; } + if (fgBBisScratch(block)) + { + return false; + } + unsigned lclNum = BAD_VAR_NUM; // First check if the successor tests a local and then branches on the result diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 4e2aed28be2763..43b9040b7c3363 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -726,8 +726,6 @@ class CEEJitInfo : public CEEInfo delete [] ((BYTE*) m_pPatchpointInfoFromJit); m_pPatchpointInfoFromJit = NULL; - m_pPatchpointInfoFromRuntime = NULL; - m_ilOffset = 0; #endif #ifdef FEATURE_EH_FUNCLETS