Skip to content

Commit

Permalink
JIT: Remove remaining BBJ_COND fallthrough fixups (#99271)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid authored Mar 5, 2024
1 parent e203a15 commit 88bb3a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
18 changes: 2 additions & 16 deletions src/coreclr/jit/fgehopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2103,28 +2103,14 @@ void Compiler::fgTailMergeThrowsFallThroughHelper(BasicBlock* predBlock,
assert(predBlock->KindIs(BBJ_COND));
assert(predBlock->FalseTargetIs(nonCanonicalBlock));

BasicBlock* const newBlock = fgNewBBafter(BBJ_ALWAYS, predBlock, true);

JITDUMP("*** " FMT_BB " now falling through to empty " FMT_BB " and then to " FMT_BB "\n", predBlock->bbNum,
newBlock->bbNum, canonicalBlock->bbNum);
JITDUMP("*** " FMT_BB " false target is now " FMT_BB "\n", predBlock->bbNum, canonicalBlock->bbNum);

// Remove the old flow
fgRemoveRefPred(predEdge);

// Wire up the new flow
FlowEdge* const falseEdge = fgAddRefPred(newBlock, predBlock, predEdge);
FlowEdge* const falseEdge = fgAddRefPred(canonicalBlock, predBlock, predEdge);
predBlock->SetFalseEdge(falseEdge);

FlowEdge* const newEdge = fgAddRefPred(canonicalBlock, newBlock, predEdge);
newBlock->SetTargetEdge(newEdge);

// If nonCanonicalBlock has only one pred, all its flow transfers.
// If it has multiple preds, then we need edge counts or likelihoods
// to figure things out.
//
// For now just do a minimal update.
//
newBlock->inheritWeight(nonCanonicalBlock);
}

//------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4994,22 +4994,6 @@ bool Compiler::fgUpdateFlowGraph(bool doTailDuplication /* = false */, bool isPh
{
ehUpdateLastBlocks(bNext, bDest);
}

// Add fall through fixup block, if needed.
//
if (bDest->KindIs(BBJ_COND) && !bDest->NextIs(bDest->GetFalseTarget()))
{
BasicBlock* const bDestFalseTarget = bDest->GetFalseTarget();
BasicBlock* const bFixup = fgNewBBafter(BBJ_ALWAYS, bDest, true);
bFixup->inheritWeight(bDestFalseTarget);

fgRemoveRefPred(bDest->GetFalseEdge());
FlowEdge* const falseEdge = fgAddRefPred(bFixup, bDest);
bDest->SetFalseEdge(falseEdge);

FlowEdge* const newEdge = fgAddRefPred(bDestFalseTarget, bFixup);
bFixup->SetTargetEdge(newEdge);
}
}
}

Expand Down

0 comments on commit 88bb3a7

Please sign in to comment.