-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-92782: unify the style of CFG traversal algorithms in the compiler #92784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The test failure seems to imply that in a subprocess we can end up calling mark_reachable multiple times on the same code. Is this expected? |
I can't reproduce that test failure on my machine, so I'm reverting that particular change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look correct to me, though I have a slightly-off-topic question:
When traversing via b = b->b_next
, how is it ensured that exception handlers stay in that linked list? Can empty exception handlers exist? If so, can they get removed by eliminate_empty_basic_blocks
and then leave connected basicblocks dangling?
I think you're right that eliminate_empty_basic_blocks should fix targets of block_push instructions in the same way that it does for jumps. I think we're getting away with this at the moment the first block of the handler always has a PUSH_EXC_INFO instruction, so it's never empty. |
I believe I found out why making mark_reachable use b_visited failed. It is currently possible to get a conditional jump to the next block. So I've updated the assertion and put that change back in this PR. We'll see what the buildbots think. |
@markshannon I think this is ready to be merged. Last chance to |
No objections. LGTM. |
This makes the traversals more consistent: