Skip to content

multi-block inliner#200

Merged
sbillig merged 15 commits intofe-lang:mainfrom
sbillig:inliner2
Mar 12, 2026
Merged

multi-block inliner#200
sbillig merged 15 commits intofe-lang:mainfrom
sbillig:inliner2

Conversation

@sbillig
Copy link
Collaborator

@sbillig sbillig commented Feb 23, 2026

No description provided.

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.

Reviewed commit: b1bd3de969

ℹ️ 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
Copy link
Collaborator Author

sbillig commented Feb 28, 2026

@codex review

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.

Reviewed commit: da0d657cd9

ℹ️ 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".

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 introduces a CFG-aware “full” inliner alongside the existing trivial (single-block) inliner, adds inline-related function attributes, and wires the new inliner behavior into optimization pipeline presets with expanded test coverage and updated snapshots.

Changes:

  • Add NOINLINE / ALWAYSINLINE / INLINEHINT function attributes and a FuncStore::restore helper to support safe remove/restore patterns during inlining.
  • Implement a new module-level inliner driver that combines trivial inlining with constrained multi-block (“full”) inlining, including operand rewriting and cost/budget decisions.
  • Add extensive full-inliner tests + fixtures and update snapshot outputs/pipeline preset behavior.

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/ir/src/module.rs Adds new inline-related FuncAttrs flags and FuncStore::restore() used by the full inliner.
crates/codegen/src/optim/inliner/mod.rs New inliner orchestrator combining trivial + full inlining with budgets/ordering and stats.
crates/codegen/src/optim/inliner/full.rs Implements full (multi-block) callsite inlining with CFG edits, phi handling, and validation.
crates/codegen/src/optim/inliner/cost.rs Adds inline decision logic (attrs, SCC recursion, budgets, score model).
crates/codegen/src/optim/inliner/rewrite.rs Operand rewriting utilities for cloned instructions and phi forward-ref fixups.
crates/codegen/src/optim/inliner/trivial.rs Refactors trivial inliner to be a subcomponent (plans/materialization/application helpers).
crates/codegen/src/optim/pipeline.rs Updates balanced/aggressive presets to enable constrained full inlining; adds preset tests.
crates/codegen/tests/inliner.rs Adds “full inliner” fixture suite + targeted unit tests (verification, budgets, attrs, ordering).
crates/codegen/test_files/inliner_full/* New full-inliner fixtures and snapshots.
crates/codegen/test_files/**.snap Snapshot updates reflecting new inlining/pipeline behavior.
Comments suppressed due to low confidence (2)

crates/codegen/tests/inliner.rs:16

  • The #[dir_test(...)] attribute is missing a comma after glob: "*.sntn", which will make this test file fail to compile. Add the trailing comma between the glob and loader entries (same pattern as other dir_test uses).
#[dir_test(
    dir: "$CARGO_MANIFEST_DIR/test_files/inliner/",
    glob: "*.sntn"
    loader: common::parse_module,
)]

crates/codegen/src/optim/inliner/trivial.rs:3

  • The new module doc comment says the trivial inliner does “no CFG surgery”, but this module can splice a single-block terminator (see InlinePlanSummary::SpliceSingleBlockTerminator and summary_changes_cfg), which can change CFG reachability. Please update the wording to match the actual behavior (e.g., “no multi-block CFG cloning” or explicitly mention terminator splicing).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbillig
Copy link
Collaborator Author

sbillig commented Feb 28, 2026

@codex review

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

Copilot reviewed 29 out of 31 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Reviewed commit: 54a19d51b2

ℹ️ 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 force-pushed the inliner2 branch 2 times, most recently from 43a7463 to a0a8ded Compare March 11, 2026 06:03
@sbillig sbillig merged commit c6c0062 into fe-lang:main Mar 12, 2026
10 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