diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 0ed95870ea2e0..a3d854e17eff0 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -5006,9 +5006,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl // Iterate if requested, resetting annotations first. if (opts.optRepeatIteration == opts.optRepeatCount) { - // If we're done optimizing, just remove the PHIs - // - fgResetForSsa(/* deepClean */ false); break; } @@ -5852,7 +5849,7 @@ void Compiler::ResetOptAnnotations() { assert(opts.optRepeat); assert(JitConfig.JitOptRepeatCount() > 0); - fgResetForSsa(/* deepClean */ true); + fgResetForSsa(); vnStore = nullptr; m_blockToEHPreds = nullptr; m_dominancePreds = nullptr; diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index ba1a1f34f89a4..d99813fe5290f 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -5725,7 +5725,7 @@ class Compiler PhaseStatus fgSsaBuild(); // Reset any data structures to the state expected by "fgSsaBuild", so it can be run again. - void fgResetForSsa(bool deepClean); + void fgResetForSsa(); unsigned fgSsaPassesCompleted = 0; // Number of times fgSsaBuild has been run. bool fgSsaValid = false; // True if SSA info is valid and can be cross-checked versus IR diff --git a/src/coreclr/jit/ssabuilder.cpp b/src/coreclr/jit/ssabuilder.cpp index 872d1d5fa87ec..b36529cc1a686 100644 --- a/src/coreclr/jit/ssabuilder.cpp +++ b/src/coreclr/jit/ssabuilder.cpp @@ -15,7 +15,7 @@ PhaseStatus Compiler::fgSsaBuild() // If this is not the first invocation, reset data structures for SSA. if (fgSsaPassesCompleted > 0) { - fgResetForSsa(/* deepClean */ true); + fgResetForSsa(); } SsaBuilder builder(this); @@ -29,36 +29,21 @@ PhaseStatus Compiler::fgSsaBuild() return PhaseStatus::MODIFIED_EVERYTHING; } -//------------------------------------------------------------------------ -// fgResetForSsa: remove SSA artifacts -// -// Arguments: -// deepClean - if true, remove all SSA artifacts -// if false, just remove PHIs -// -// Notes: -// deepCleaning is needed in order to rebuild SSA. -// -void Compiler::fgResetForSsa(bool deepClean) +void Compiler::fgResetForSsa() { - JITDUMP("Removing %s\n", deepClean ? "all SSA artifacts" : "PHI functions"); - - if (deepClean) + for (unsigned i = 0; i < lvaCount; ++i) { - for (unsigned i = 0; i < lvaCount; ++i) - { - lvaTable[i].lvPerSsaData.Reset(); - } - lvMemoryPerSsaData.Reset(); - for (MemoryKind memoryKind : allMemoryKinds()) - { - m_memorySsaMap[memoryKind] = nullptr; - } + lvaTable[i].lvPerSsaData.Reset(); + } + lvMemoryPerSsaData.Reset(); + for (MemoryKind memoryKind : allMemoryKinds()) + { + m_memorySsaMap[memoryKind] = nullptr; + } - if (m_outlinedCompositeSsaNums != nullptr) - { - m_outlinedCompositeSsaNums->Reset(); - } + if (m_outlinedCompositeSsaNums != nullptr) + { + m_outlinedCompositeSsaNums->Reset(); } for (BasicBlock* const blk : Blocks()) @@ -78,16 +63,13 @@ void Compiler::fgResetForSsa(bool deepClean) } } - if (deepClean) + for (Statement* const stmt : blk->Statements()) { - for (Statement* const stmt : blk->Statements()) + for (GenTree* const tree : stmt->TreeList()) { - for (GenTree* const tree : stmt->TreeList()) + if (tree->IsAnyLocal()) { - if (tree->IsAnyLocal()) - { - tree->AsLclVarCommon()->SetSsaNum(SsaConfig::RESERVED_SSA_NUM); - } + tree->AsLclVarCommon()->SetSsaNum(SsaConfig::RESERVED_SSA_NUM); } } }