From 8f9a29448f83b701656a0a33604b3d935542b135 Mon Sep 17 00:00:00 2001 From: "Aman Khalid (from Dev Box)" Date: Tue, 17 Sep 2024 13:55:04 -0400 Subject: [PATCH] Always use edge weights in fgSplitEdge --- src/coreclr/jit/fgbasic.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 39531ea99aa22..00b9de5c2fb42 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -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'