File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -5366,17 +5366,25 @@ PhaseStatus Compiler::fgHeadTailMerge(bool early)
53665366 }
53675367 };
53685368
5369- ArrayStack<BasicBlock*> retBlocks (getAllocator (CMK_ArrayStack));
5369+ ArrayStack<BasicBlock*> retOrThrowBlocks (getAllocator (CMK_ArrayStack));
53705370
53715371 // Visit each block
53725372 //
53735373 for (BasicBlock* const block : Blocks ())
53745374 {
53755375 iterateTailMerge (block);
5376+ if (block->isEmpty ())
5377+ {
5378+ continue ;
5379+ }
53765380
5377- if (block->KindIs (BBJ_RETURN) && !block->isEmpty () && (block != genReturnBB))
5381+ if (block->KindIs (BBJ_THROW))
5382+ {
5383+ retOrThrowBlocks.Push (block);
5384+ }
5385+ else if (block->KindIs (BBJ_RETURN) && (block != genReturnBB))
53785386 {
5379- // Avoid spitting a return away from a possible tail call
5387+ // Avoid splitting a return away from a possible tail call
53805388 //
53815389 if (!block->hasSingleStmt ())
53825390 {
@@ -5389,14 +5397,14 @@ PhaseStatus Compiler::fgHeadTailMerge(bool early)
53895397 }
53905398 }
53915399
5392- retBlocks .Push (block);
5400+ retOrThrowBlocks .Push (block);
53935401 }
53945402 }
53955403
53965404 predInfo.Reset ();
5397- for (int i = 0 ; i < retBlocks .Height (); i++)
5405+ for (int i = 0 ; i < retOrThrowBlocks .Height (); i++)
53985406 {
5399- predInfo.Push (PredInfo (retBlocks .Bottom (i), retBlocks .Bottom (i)->lastStmt ()));
5407+ predInfo.Push (PredInfo (retOrThrowBlocks .Bottom (i), retOrThrowBlocks .Bottom (i)->lastStmt ()));
54005408 }
54015409
54025410 tailMergePreds (nullptr );
You can’t perform that action at this time.
0 commit comments