Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6792,6 +6792,7 @@ class Compiler
AddCodeDsc* fgGetExcptnTarget(SpecialCodeKind kind, BasicBlock* fromBlock, bool createIfNeeded = false);
bool fgUseThrowHelperBlocks();
void fgCreateThrowHelperBlockCode(AddCodeDsc* add);
void fgSetThrowHelpBlockLiveness(BasicBlock* block);
void fgSequenceLocals(Statement* stmt);

private:
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,10 @@ void Compiler::fgCreateThrowHelperBlock(AddCodeDsc* add)
//
add->acdDstBlk = newBlk;

// Set up liveness
//
fgSetThrowHelpBlockLiveness(newBlk);

#ifdef DEBUG
if (verbose)
{
Expand Down
45 changes: 29 additions & 16 deletions src/coreclr/jit/liveness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1472,22 +1472,7 @@ void Liveness<TLiveness>::DoLiveVarAnalysis()
continue;
}

VarSetOps::ClearD(m_compiler, block->bbLiveOut);
if (keepAliveThis)
{
unsigned thisVarIndex = m_compiler->lvaGetDesc(m_compiler->info.compThisArg)->lvVarIndex;
VarSetOps::AddElemD(m_compiler, block->bbLiveOut, thisVarIndex);
}

if (block->HasPotentialEHSuccs(m_compiler))
{
block->VisitEHSuccs(m_compiler, [=](BasicBlock* succ) {
VarSetOps::UnionD(m_compiler, block->bbLiveOut, succ->bbLiveIn);
return BasicBlockVisit::Continue;
});
}

VarSetOps::Assign(m_compiler, block->bbLiveIn, block->bbLiveOut);
m_compiler->fgSetThrowHelpBlockLiveness(block);
}
}

Expand Down Expand Up @@ -1615,6 +1600,34 @@ void Compiler::fgAddHandlerLiveVars(BasicBlock* block, VARSET_TP& ehHandlerLiveV
});
}

//------------------------------------------------------------------------
// fgSetThrowHelpBlockLiveness: set liveness for throw helper block
//
// Arguments:
// block -- potential throw helper block
//
void Compiler::fgSetThrowHelpBlockLiveness(BasicBlock* block)
{
VarSetOps::ClearD(this, block->bbLiveOut);

const bool keepAliveThis = lvaKeepAliveAndReportThis() && lvaTable[info.compThisArg].lvTracked;
if (keepAliveThis)
{
unsigned thisVarIndex = lvaGetDesc(info.compThisArg)->lvVarIndex;
VarSetOps::AddElemD(this, block->bbLiveOut, thisVarIndex);
}

if (block->HasPotentialEHSuccs(this))
{
block->VisitEHSuccs(this, [=](BasicBlock* succ) {
VarSetOps::UnionD(this, block->bbLiveOut, succ->bbLiveIn);
return BasicBlockVisit::Continue;
});
}

VarSetOps::Assign(this, block->bbLiveIn, block->bbLiveOut);
}

#ifdef DEBUG

void Compiler::fgDispBBLiveness()
Expand Down
Loading