Skip to content

Conversation

@indietyp
Copy link
Member

@indietyp indietyp commented Jan 3, 2026

🌟 What is the purpose of this PR?

This PR refactors the MIR optimization pipeline by extracting the canonicalization logic from PreInline into a reusable Canonicalization pass. This improves code organization and enables the same optimization sequence to be used in multiple contexts.

🔍 What does this change?

  • Extracts the canonicalization logic from PreInline into a new Canonicalization pass
  • Makes PreInline a thin wrapper around Canonicalization with pre-inlining specific configuration
  • Improves the Changed enum's implementation with optimized bitwise operations
  • Adds a new overlay method to GlobalTransformState to combine results from multiple passes
  • Adds a Miri test command for the changed_bitor functionality

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Added a Miri test for the changed_bitor functionality
  • Existing MIR optimization tests cover the refactored functionality

@vercel vercel bot temporarily deployed to Preview – petrinaut January 3, 2026 17:09 Inactive
@cursor
Copy link

cursor bot commented Jan 3, 2026

PR Summary

Introduces a reusable MIR canonicalization driver and refactors pre-inlining to use it, plus small infrastructure and perf tweaks.

  • Adds transform/canonicalization.rs implementing Canonicalization with configurable max_iterations and fixpoint orchestration of AR/IS/FS-CP/DSE/CFG
  • Rewrites PreInline as a thin wrapper around Canonicalization (configured with max_iterations: 8)
  • Exposes Canonicalization and CanonicalizationConfig in transform/mod.rs
  • Optimizes Changed by adding from_u8_unchecked, inlining BitOr/BitOrAssign, and using unchecked unreachable for better vectorization
  • Adds GlobalTransformState::overlay to merge per-pass results and uses it in Canonicalization::run
  • package.json: adds test:miri script for changed_bitor

Written by Cursor Bugbot for commit 0a15246. This will update automatically on new commits. Configure here.

@github-actions github-actions bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team labels Jan 3, 2026
Copy link
Member Author

indietyp commented Jan 3, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@indietyp indietyp force-pushed the bm/be-269-hashql-move-out-most-of-preinline-into-a-canonicalization branch from 76ea4a0 to b3793a2 Compare January 3, 2026 17:11
@vercel vercel bot temporarily deployed to Preview – petrinaut January 3, 2026 17:11 Inactive
@augmentcode
Copy link

augmentcode bot commented Jan 3, 2026

🤖 Augment PR Summary

Summary: Refactors the HashQL MIR optimization pipeline by extracting the canonicalization fixpoint logic into a reusable pass.

Changes:

  • Introduces a new Canonicalization global transform pass with a configurable iteration limit.
  • Reworks PreInline into a thin wrapper around Canonicalization (pre-inlining tuned config).
  • Optimizes Changed bitwise OR by using an unchecked discriminant conversion for better codegen/vectorization.
  • Adds GlobalTransformState::overlay to merge per-pass/per-iteration change tracking into a single state.
  • Wires the new module export and adds a test:miri script for the changed_bitor test.

Technical Notes: Canonicalization runs a pre-pass (CP+CFG) and then iterates AR → IS → (FS/CP) → DSE → CFG until fixpoint or max_iterations.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 3, 2026

CodSpeed Performance Report

Merging #8239 will not alter performance

Comparing bm/be-269-hashql-move-out-most-of-preinline-into-a-canonicalization (0a15246) with bm/be-268-hashql-rename-preinlining-to-preinline (6603ad7)

Summary

✅ 17 untouched

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

❌ Patch coverage is 94.85714% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.96%. Comparing base (6603ad7) to head (0a15246).

Files with missing lines Patch % Lines
.../hashql/mir/src/pass/transform/canonicalization.rs 95.54% 5 Missing and 2 partials ⚠️
libs/@local/hashql/mir/src/pass/mod.rs 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                                 Coverage Diff                                  @@
##           bm/be-268-hashql-rename-preinlining-to-preinline    #8239      +/-   ##
====================================================================================
+ Coverage                                             64.94%   64.96%   +0.01%     
====================================================================================
  Files                                                   735      736       +1     
  Lines                                                 62982    63019      +37     
  Branches                                               3677     3680       +3     
====================================================================================
+ Hits                                                  40906    40939      +33     
- Misses                                                21597    21600       +3     
- Partials                                                479      480       +1     
Flag Coverage Δ
rust.hashql-compiletest 46.65% <ø> (ø)
rust.hashql-mir 89.68% <94.85%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graphite-app graphite-app bot requested review from a team and removed request for a team January 3, 2026 17:18
@vercel vercel bot temporarily deployed to Preview – petrinaut January 3, 2026 17:41 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

2 participants