-
Notifications
You must be signed in to change notification settings - Fork 210
MIR restructuring and fixes #1192
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
81c5317 to
0a36c6a
Compare
7c7fb3e to
2cfd0e3
Compare
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
Pull request overview
This PR restructures the MIR (Mid-level Intermediate Representation) system with several key improvements:
- Introduces the BodyBuilder pattern (from v1 MIR) to replace bug-prone block-aware lowering logic
- Moves all expression lowering into MIR (previously split between HIR and MIR)
- Adds new MIR transformations including
canonicalize_zero_sizedfor ZST handling andinsert_temp_bindsfor value binding - Moves EVM-specific logic from MIR into codegen
- Improves MIR printing with a new formatting module
- Makes parser stricter about method call syntax and generic argument disambiguation
The majority of line changes are snapshot tests reflecting the new MIR structure.
Reviewed changes
Copilot reviewed 148 out of 149 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| library/std/src/abi/sol.fe | Introduces temporary locals to fix evaluation order issues in write_word and finish methods |
| crates/mir/src/ir.rs | Restructures core MIR types with new Rvalue enum, TerminatingCall, and LocalId-based system |
| crates/mir/src/ir/body_builder.rs | Adds new BodyBuilder helper for constructing MIR bodies with current block tracking |
| crates/mir/src/transform.rs | New module with insert_temp_binds and canonicalize_zero_sized transformation passes |
| crates/mir/src/lower/mod.rs | Major refactoring of expression lowering to use BodyBuilder pattern |
| crates/mir/src/lower/expr.rs | Complete rewrite of expression lowering without "next block" return pattern |
| crates/mir/src/lower/aggregates.rs | Simplified aggregate lowering using InitAggregate instruction |
| crates/mir/src/fmt.rs | New MIR pretty-printing module for debugging and testing |
| crates/parser/src/parser/expr.rs | Makes parser stricter about method call syntax (opening paren on same line) |
| crates/parser/src/parser/path.rs | Improves disambiguation between generic args and comparison operators |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cburgdorf
left a comment
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.
Great work!
needs_block_aware_loweringlogic, and returning the "next block"canonicalize_zero_sizedrewrites zero-sized type operations to unit, and removes dead storesfe checkinto mir crate, added some mir snapshot testsThings I ran into and fixed along the way:
Sorry about the mega commit; there was a lot of wip churn in the mir structure/lowering and codegen that I squashed together. Half of the line changes are snapshots; it's not as bad as it looks :)