Skip to content

Commit ad325b0

Browse files
authored
Fix GC poll insertion for BBJ_CALLFINALLY basic blocks. (#39564)
Fixes #39472.
1 parent 595402c commit ad325b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/coreclr/src/jit/flowgraph.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,6 +3650,7 @@ PhaseStatus Compiler::fgInsertGCPolls()
36503650
case BBJ_SWITCH:
36513651
case BBJ_NONE:
36523652
case BBJ_THROW:
3653+
case BBJ_CALLFINALLY:
36533654
break;
36543655
default:
36553656
assert(!"Unexpected block kind");
@@ -4058,9 +4059,11 @@ BasicBlock* Compiler::fgCreateGCPoll(GCPollType pollType, BasicBlock* block)
40584059
createdPollBlocks = false;
40594060

40604061
Statement* newStmt = nullptr;
4061-
if (block->bbJumpKind == BBJ_ALWAYS)
4062+
if ((block->bbJumpKind == BBJ_ALWAYS) || (block->bbJumpKind == BBJ_CALLFINALLY) ||
4063+
(block->bbJumpKind == BBJ_NONE))
40624064
{
4063-
// for BBJ_ALWAYS I don't need to insert it before the condition. Just append it.
4065+
// For BBJ_ALWAYS, BBJ_CALLFINALLY, and BBJ_NONE and we don't need to insert it before the condition.
4066+
// Just append it.
40644067
newStmt = fgNewStmtAtEnd(block, call);
40654068
}
40664069
else
@@ -4265,6 +4268,7 @@ BasicBlock* Compiler::fgCreateGCPoll(GCPollType pollType, BasicBlock* block)
42654268
__fallthrough;
42664269

42674270
case BBJ_ALWAYS:
4271+
case BBJ_CALLFINALLY:
42684272
fgReplacePred(bottom->bbJumpDest, top, bottom);
42694273
break;
42704274
case BBJ_SWITCH:

0 commit comments

Comments
 (0)