Skip to content
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

[NFC] Finalize blocks with explicit breakability in IRBuilder #7085

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Nov 16, 2024

Since IRBuilder already knows what labels are used by branches, it is
easy for it to pass that information when finalizing blocks. This avoids
finalization having to walk the blocks looking for branches, speeding up
a future version of the binary parser that uses IRBuilder by 10%.

Since IRBuilder already knows what labels are used by branches, it is
easy for it to pass that information when finalizing blocks. This avoids
finalization having to walk the blocks looking for branches, speeding up
a future version of the binary parser that uses IRBuilder by 10%.
@tlively tlively requested a review from kripken November 16, 2024 01:24
// correct types. ReFinalize now to fix any issues.
PassRunner runner(getPassRunner());
runner.add(std::make_unique<ReFinalize>());
runner.run();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment sort of suggests to me that Outlining should not be using IRBuilder...? What does "an odd order" mean?

lgtm otherwise

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outlining visits control flow expressions in a breadth-first order rather than doing a normal postorder traversal. So it visits every top-level expression in a function body, ends the function, then visits the contents of every block it saw while traversing those top-level expressions, etc. Another way to look at it is that Outlining uses IRBuilder to build one control flow structure at a time rather than a whole function at at a time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "odd" traversal should be well documented in passes/stringify-walker.h.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good. Maybe add a link to there?

@tlively tlively merged commit 08b7496 into main Nov 18, 2024
13 checks passed
@tlively tlively deleted the ir-builder-breakability branch November 18, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants