Skip to content

Commit

Permalink
JIT: Don't move EH region entries when aligning backward jumps (#110918)
Browse files Browse the repository at this point in the history
Follow-up to #110277. Fixes #110756. Don't consider 4-opt cut points that would move the entry block of a try/handler region below other blocks in the region. Previously, either future moves would put the entry block back at the top of the region, or we would get unlucky in the rare case and hit asserts.
  • Loading branch information
amanasifkhalid authored Dec 24, 2024
1 parent bdf1143 commit f3d43ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5456,6 +5456,12 @@ bool Compiler::ThreeOptLayout::RunGreedyThreeOptPass(unsigned startPos, unsigned
continue;
}

// Don't consider any cut points that would move try/handler entries
if (compiler->bbIsTryBeg(s3BlockPrev) || compiler->bbIsHandlerBeg(s3BlockPrev))
{
continue;
}

// Compute the cost delta of this partition
const weight_t currCost = currCostBase + GetCost(s3BlockPrev, s3Block);
const weight_t newCost =
Expand Down

0 comments on commit f3d43ef

Please sign in to comment.