Skip to content

Conversation

@sbillig
Copy link
Collaborator

@sbillig sbillig commented Dec 20, 2025

  • all expression lowering now happens in mir
  • copied the BodyBuilder pattern from v1 MIR, to replace the bug-prone needs_block_aware_lowering logic, and returning the "next block"
  • moved evm-specific things from mir into codegen
  • canonicalize_zero_sized rewrites zero-sized type operations to unit, and removes dead stores
  • moved/improved mir printing from fe check into mir crate, added some mir snapshot tests

Things I ran into and fixed along the way:

  • parser stricter about method call syntax (opening paren must be on same line)
  • parser stricter about < as generic arg list vs comparison
  • fixed type checking of comparisons involving unknown int types
  • fixed resolution of trait methods in mir

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 :)

@sbillig sbillig force-pushed the mir-builder branch 5 times, most recently from 81c5317 to 0a36c6a Compare December 22, 2025 18:46
@sbillig sbillig force-pushed the mir-builder branch 3 times, most recently from 7c7fb3e to 2cfd0e3 Compare December 22, 2025 20:42
@sbillig sbillig marked this pull request as ready for review December 22, 2025 23:16
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

@sbillig sbillig changed the title mir cleanup MIR restructuring and fixes Dec 24, 2025
@sbillig sbillig requested review from cburgdorf and Copilot December 24, 2025 18:29
Copy link

Copilot AI left a 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_sized for ZST handling and insert_temp_binds for 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.

Copy link
Collaborator

@cburgdorf cburgdorf left a comment

Choose a reason for hiding this comment

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

Great work!

@cburgdorf cburgdorf merged commit f15a2ec into argotorg:master Dec 25, 2025
11 checks passed
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