Fix interpreter compiler branch elimination#120768
Conversation
The code emission was eliminating branches at the end of a basic block going to the next basic block. This should only happen in case when both blocks are on the same overlapping clause depth though. It was breaking couple of EH tests where it let execution flow from the end of a try block to an unrelated block.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the interpreter compiler's branch elimination optimization. The compiler was incorrectly removing branches to the next basic block without considering exception handling (EH) clause boundaries, which broke exception handling tests by allowing execution to flow incorrectly from try blocks into unrelated blocks.
Key Changes:
- Added an exception handling clause depth check to the branch elimination condition
- Updated the comment to clarify when branch elimination is safe
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
|
I think it would be nice at some point to have the |
I'll try to figure out something. |
The code emission was eliminating branches at the end of a basic block going to the next basic block. This should only happen in case when both blocks are on the same overlapping clause depth though. It was breaking couple of EH tests where it let execution flow from the end of a try block to an unrelated block.