Skip to content
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
11 changes: 10 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14189,6 +14189,7 @@ void Compiler::fgMergeBlockReturn(BasicBlock* block)
fgAddRefPred(genReturnBB, block);
fgReturnCount--;
}

if (genReturnLocal != BAD_VAR_NUM)
{
// replace the GT_RETURN node to be a STORE_LCL_VAR that stores the return value into genReturnLocal.
Expand Down Expand Up @@ -14243,7 +14244,15 @@ void Compiler::fgMergeBlockReturn(BasicBlock* block)
noway_assert(ret->TypeGet() == TYP_VOID);
noway_assert(ret->gtGetOp1() == nullptr);

fgRemoveStmt(block, lastStmt);
if (opts.compDbgCode && lastStmt->GetDebugInfo().IsValid())
{
// We can't remove the return as it might remove a sequence point. Convert it to a NOP.
ret->gtBashToNOP();
}
else
{
fgRemoveStmt(block, lastStmt);
}
}

JITDUMP("\nUpdate " FMT_BB " to jump to common return block.\n", block->bbNum);
Expand Down