Skip to content

Commit

Permalink
JIT: minor enhancement to jump threading (#69022)
Browse files Browse the repository at this point in the history
Allow jump threading of branches with exceptions, provided the branch and the
dominating branch are in the same EH region.
  • Loading branch information
AndyAyersMS committed May 9, 2022
1 parent 1723373 commit 390620f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/coreclr/jit/redundantbranchopts.cpp
Expand Up @@ -421,10 +421,11 @@ bool Compiler::optJumpThread(BasicBlock* const block, BasicBlock* const domBlock
assert(tree->OperIs(GT_JTRUE));
if ((tree->gtFlags & GTF_SIDE_EFFECT) == GTF_EXCEPT)
{
// However, be conservative if block is in a try as we might not
// have a full picture of EH flow.
// However, be conservative if the blocks are not in the
// same EH region, as we might not be able to fully
// describe control flow between them.
//
if (!block->hasTryIndex())
if (BasicBlock::sameEHRegion(block, domBlock))
{
// We will ignore the side effect on this tree.
//
Expand Down

0 comments on commit 390620f

Please sign in to comment.