Skip to content

Commit ff604c2

Browse files
authored
JIT: Set PGO data inconsistent when flow disappears in cast expansion (#112147)
Cast expansion can expand into a `BBJ_THROW` block. If that happens and that block has flow into it, the PGO data becomes inconsistent.
1 parent debf227 commit ff604c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/coreclr/jit/helperexpansion.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,14 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
27292729
}
27302730
}
27312731

2732+
if (fallbackBb->KindIs(BBJ_THROW) && (fallbackBb->bbWeight != BB_ZERO_WEIGHT))
2733+
{
2734+
// This flow is disappearing.
2735+
JITDUMP("fgLateCastExpansionForCall: fallback " FMT_BB " throws and has flow into it. Data %s inconsistent.\n",
2736+
fallbackBb->bbNum, fgPgoConsistent ? "is now" : "was already");
2737+
fgPgoConsistent = false;
2738+
}
2739+
27322740
// Bonus step: merge prevBb with nullcheckBb as they are likely to be mergeable
27332741
if (fgCanCompactBlock(firstBb))
27342742
{

0 commit comments

Comments
 (0)