Skip to content

Commit

Permalink
JIT: Always use edge weights to assign block weight in `Compiler::fgS…
Browse files Browse the repository at this point in the history
…plitEdge` (dotnet#107941)
  • Loading branch information
amanasifkhalid authored Sep 17, 2024
1 parent 06ebfc2 commit 594f2a6
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4938,23 +4938,13 @@ BasicBlock* Compiler::fgSplitEdge(BasicBlock* curr, BasicBlock* succ)

// Set weight for newBlock
//
if (curr->KindIs(BBJ_ALWAYS))
{
newBlock->inheritWeight(curr);
}
else
FlowEdge* const currNewEdge = fgGetPredForBlock(newBlock, curr);
newBlock->bbWeight = currNewEdge->getLikelyWeight();
newBlock->CopyFlags(curr, BBF_PROF_WEIGHT);

if (newBlock->bbWeight == BB_ZERO_WEIGHT)
{
if (curr->hasProfileWeight())
{
FlowEdge* const currNewEdge = fgGetPredForBlock(newBlock, curr);
newBlock->setBBProfileWeight(currNewEdge->getLikelyWeight());
}
else
{
// Todo: use likelihood even w/o profile?
//
newBlock->inheritWeightPercentage(curr, 50);
}
newBlock->bbSetRunRarely();
}

// The bbLiveIn and bbLiveOut are both equal to the bbLiveIn of 'succ'
Expand Down

0 comments on commit 594f2a6

Please sign in to comment.