Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GC poll insertion for BBJ_CALLFINALLY basic blocks. #39564

Merged
merged 1 commit into from
Jul 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/coreclr/src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down