diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 418f5bb478c09..96a9859e9eae8 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -7061,11 +7061,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b emit_set_deopt_il_offset (cfg, GPTRDIFF_TO_INT (ip - cfg->cil_start)); } else { if ((tblock = cfg->cil_offset_to_bb [ip - cfg->cil_start]) && (tblock != cfg->cbb)) { - link_bblock (cfg, cfg->cbb, tblock); if (sp != stack_start) { + link_bblock (cfg, cfg->cbb, tblock); handle_stack_args (cfg, stack_start, GPTRDIFF_TO_INT (sp - stack_start)); sp = stack_start; CHECK_UNVERIFIABLE (cfg); + } else { + if (!(cfg->cbb->last_ins && cfg->cbb->last_ins->opcode == OP_NOT_REACHED)) + link_bblock (cfg, cfg->cbb, tblock); } cfg->cbb->next_bb = tblock; cfg->cbb = tblock;