@@ -297,6 +297,10 @@ void Compiler::fgComputeEnterBlocksSet()
297
297
298
298
fgEnterBlks = BlockSetOps::MakeEmpty (this );
299
299
300
+ #if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
301
+ fgAlwaysBlks = BlockSetOps::MakeEmpty (this );
302
+ #endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
303
+
300
304
/* Now set the entry basic block */
301
305
BlockSetOps::AddElemD (this , fgEnterBlks, fgFirstBB->bbNum );
302
306
assert (fgFirstBB->bbNum == 1 );
@@ -315,19 +319,15 @@ void Compiler::fgComputeEnterBlocksSet()
315
319
}
316
320
317
321
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
318
- // TODO-ARM-Cleanup: The ARM code here to prevent creating retless calls by adding the BBJ_ALWAYS
319
- // to the enter blocks is a bit of a compromise, because sometimes the blocks are already reachable,
320
- // and it messes up DFS ordering to have them marked as enter block. We should prevent the
321
- // creation of retless calls some other way.
322
+ // For ARM code, prevent creating retless calls by adding the BBJ_ALWAYS to the "fgAlwaysBlks" list.
322
323
for (BasicBlock* const block : Blocks ())
323
324
{
324
325
if (block->bbJumpKind == BBJ_CALLFINALLY)
325
326
{
326
327
assert (block->isBBCallAlwaysPair ());
327
-
328
- // Don't remove the BBJ_ALWAYS block that is only here for the unwinder. It might be dead
329
- // if the finally is no-return, so mark it as an entry point.
330
- BlockSetOps::AddElemD (this , fgEnterBlks, block->bbNext ->bbNum );
328
+
329
+ // Don't remove the BBJ_ALWAYS block that is only here for the unwinder.
330
+ BlockSetOps::AddElemD (this , fgAlwaysBlks, block->bbNext ->bbNum );
331
331
}
332
332
}
333
333
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
@@ -401,6 +401,13 @@ bool Compiler::fgRemoveUnreachableBlocks()
401
401
{
402
402
goto SKIP_BLOCK;
403
403
}
404
+
405
+ #if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
406
+ if (!BlockSetOps::IsEmptyIntersection (this , fgAlwaysBlks, block->bbReach ))
407
+ {
408
+ goto SKIP_BLOCK;
409
+ }
410
+ #endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
404
411
}
405
412
406
413
// Remove all the code for the block
@@ -637,7 +644,6 @@ void Compiler::fgDfsInvPostOrder()
637
644
assert (fgEnterBlksSetValid);
638
645
639
646
BlockSetOps::UnionD (this , startNodes, fgEnterBlks);
640
-
641
647
assert (BlockSetOps::IsMember (this , startNodes, fgFirstBB->bbNum ));
642
648
643
649
// Call the flowgraph DFS traversal helper.
0 commit comments