Skip to content

Commit

Permalink
JIT: Use any reaching def for unreachable uses
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch committed Nov 22, 2024
1 parent fe70623 commit f7ccb60
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/coreclr/jit/ssabuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,13 +1737,11 @@ bool IncrementalSsaBuilder::FinalizeDefs()
for (int i = 0; i < m_defs.Height(); i++)
{
UseDefLocation& def = m_defs.BottomRef(i);
if (!m_comp->m_dfsTree->Contains(def.Block))
if (m_comp->m_dfsTree->Contains(def.Block))
{
continue;
BitVecOps::AddElemD(&m_poTraits, m_defBlocks, def.Block->bbPostorderNum);
}

BitVecOps::AddElemD(&m_poTraits, m_defBlocks, def.Block->bbPostorderNum);

unsigned ssaNum = dsc->lvPerSsaData.AllocSsaNum(m_comp->getAllocator(CMK_SSA), def.Block, def.Tree);
def.Tree->SetSsaNum(ssaNum);
LclSsaVarDsc* ssaDsc = dsc->GetPerSsaData(ssaNum);
Expand Down Expand Up @@ -1788,11 +1786,14 @@ bool IncrementalSsaBuilder::InsertUse(const UseDefLocation& use)
{
if (!m_comp->m_dfsTree->Contains(use.Block))
{
JITDUMP(" Use is in unreachable block " FMT_BB "\n", use.Block->bbNum);
return false;
reachingDef = m_defs.Bottom(0);
JITDUMP(" Use is in unreachable block " FMT_BB ", using first def [%06u] in " FMT_BB "\n",
use.Block->bbNum, Compiler::dspTreeID(reachingDef.Tree), reachingDef.Block->bbNum);
}
else
{
reachingDef = FindOrCreateReachingDef(use);
}

reachingDef = FindOrCreateReachingDef(use);
}

JITDUMP(" Reaching def is [%06u] d:%d\n", Compiler::dspTreeID(reachingDef.Tree), reachingDef.Tree->GetSsaNum());
Expand Down

0 comments on commit f7ccb60

Please sign in to comment.