Skip to content

Commit

Permalink
JIT: Null out SSA def nodes upon removal in RBO (#108530)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid authored Oct 4, 2024
1 parent 4bf7a2b commit fce7c7d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/coreclr/jit/redundantbranchopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,16 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
if (!usedCopy)
{
fgRemoveStmt(block, candidateStmt);

// Make sure the removed store node isn't referenced by an SSA definition
assert(candidateStmt->GetRootNode()->OperIs(GT_STORE_LCL_VAR));
GenTreeLclVarCommon* const rootNode = candidateStmt->GetRootNode()->AsLclVarCommon();
LclVarDsc* const varDsc = lvaGetDesc(rootNode);
LclSsaVarDsc* const defDsc = varDsc->GetPerSsaData(rootNode->GetSsaNum());
assert(defDsc->GetDefNode() == rootNode);
defDsc->SetDefNode(nullptr);

DEBUG_DESTROY_NODE(rootNode);
}
else
{
Expand Down

0 comments on commit fce7c7d

Please sign in to comment.