From ad325b014124b1adb9306abf95fdac85e3f7f2f4 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Fri, 17 Jul 2020 22:07:35 -0700 Subject: [PATCH] Fix GC poll insertion for `BBJ_CALLFINALLY` basic blocks. (#39564) Fixes #39472. --- src/coreclr/src/jit/flowgraph.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index e870a8f..65c9af9 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -3650,6 +3650,7 @@ PhaseStatus Compiler::fgInsertGCPolls() case BBJ_SWITCH: case BBJ_NONE: case BBJ_THROW: + case BBJ_CALLFINALLY: break; default: assert(!"Unexpected block kind"); @@ -4058,9 +4059,11 @@ BasicBlock* Compiler::fgCreateGCPoll(GCPollType pollType, BasicBlock* block) createdPollBlocks = false; Statement* newStmt = nullptr; - if (block->bbJumpKind == BBJ_ALWAYS) + if ((block->bbJumpKind == BBJ_ALWAYS) || (block->bbJumpKind == BBJ_CALLFINALLY) || + (block->bbJumpKind == BBJ_NONE)) { - // for BBJ_ALWAYS I don't need to insert it before the condition. Just append it. + // For BBJ_ALWAYS, BBJ_CALLFINALLY, and BBJ_NONE and we don't need to insert it before the condition. + // Just append it. newStmt = fgNewStmtAtEnd(block, call); } else @@ -4265,6 +4268,7 @@ BasicBlock* Compiler::fgCreateGCPoll(GCPollType pollType, BasicBlock* block) __fallthrough; case BBJ_ALWAYS: + case BBJ_CALLFINALLY: fgReplacePred(bottom->bbJumpDest, top, bottom); break; case BBJ_SWITCH: -- 2.7.4