From 40038d788d251408fe4284e1ee6907b204703b82 Mon Sep 17 00:00:00 2001 From: "Aman Khalid (from Dev Box)" Date: Wed, 4 Sep 2024 10:01:32 -0400 Subject: [PATCH] Fix implicit fallthrough assumption --- src/coreclr/jit/fgopt.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/coreclr/jit/fgopt.cpp b/src/coreclr/jit/fgopt.cpp index 22b1e7127a36e6..5a71d474b6f365 100644 --- a/src/coreclr/jit/fgopt.cpp +++ b/src/coreclr/jit/fgopt.cpp @@ -3126,7 +3126,7 @@ bool Compiler::fgExpandRarelyRunBlocks() break; case BBJ_COND: - if (block->isRunRarely() && bPrev->GetTrueTarget()->isRunRarely()) + if (bPrev->GetTrueTarget()->isRunRarely() && bPrev->GetFalseTarget()->isRunRarely()) { INDEBUG(reason = "Both sides of a conditional jump are rarely run"); setRarelyRun = true; @@ -3230,21 +3230,13 @@ bool Compiler::fgExpandRarelyRunBlocks() } } - /* COMPACT blocks if possible */ - if (fgCanCompactBlock(bPrev)) - { - fgCompactBlock(bPrev); - - block = bPrev; - continue; - } // // if bPrev->bbWeight is not based upon profile data we can adjust // the weights of bPrev and block // - else if (bPrev->isBBCallFinallyPair() && // we must have a BBJ_CALLFINALLY and BBJ_CALLFINALLYRET pair - (bPrev->bbWeight != block->bbWeight) && // the weights are currently different - !bPrev->hasProfileWeight()) // and the BBJ_CALLFINALLY block is not using profiled weights + if (bPrev->isBBCallFinallyPair() && // we must have a BBJ_CALLFINALLY and BBJ_CALLFINALLYRET pair + (bPrev->bbWeight != block->bbWeight) && // the weights are currently different + !bPrev->hasProfileWeight()) // and the BBJ_CALLFINALLY block is not using profiled weights { if (block->isRunRarely()) {