Skip to content

Conversation

@indietyp
Copy link
Member

Add Changed enum to MIR transform passes for tracking modifications

🌟 What is the purpose of this PR?

This PR adds a Changed enum to MIR transform passes to track whether a pass modified the code. This enables more efficient pass pipelines by allowing subsequent passes to be skipped when no changes were made.

🔍 What does this change?

  • Adds a new Changed enum (Yes, No, Unknown) that transform passes return to indicate modifications
  • Updates all transform pass implementations to return the appropriate Changed value
  • Modifies test harnesses to capture and display the Changed value in snapshots
  • Updates documentation to describe the new feature in the testing guide
  • Improves benchmarks to track and propagate change status through pass pipelines

🛡 What tests cover this?

  • All existing transform pass tests have been updated to include the Changed value in snapshots
  • The test harness now verifies the correct Changed value is returned

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:

  • require changes to docs which are made as part of this PR

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

The changes in this PR:

  • do not affect the execution graph

@cursor
Copy link

cursor bot commented Dec 22, 2025

PR Summary

Enables pass-level change tracking across MIR by returning Changed from transforms and surfacing it in tests and benchmarks.

  • Add Changed enum with helpers (conservative, optimistic, From<bool>) and change TransformPass::run to return it
  • Update passes (cfg_simplify, sroa, inst_simplify, dse, dbe, cp, ssa_repair) to detect and return Changed; early-exit with No where applicable
  • Adjust compiletest suites and unit test harnesses to capture and snapshot Changed (new separator in .snap files)
  • Update benchmarks to propagate/max Changed across pipeline stages
  • Documentation: testing skill and MIR builder guide updated; reference paths switched to references/*

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

@github-actions github-actions bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels Dec 22, 2025
Copy link
Member Author

indietyp commented Dec 22, 2025

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 89.79592% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.15%. Comparing base (049e36c) to head (65c3381).

Files with missing lines Patch % Lines
libs/@local/hashql/mir/src/pass/mod.rs 23.07% 10 Missing ⚠️
Additional details and impacted files
@@                             Coverage Diff                             @@
##           bm/be-255-hashql-add-copy-propagation-pass    #8210   +/-   ##
===========================================================================
  Coverage                                       59.14%   59.15%           
===========================================================================
  Files                                            1197     1197           
  Lines                                          113673   113726   +53     
  Branches                                         5056     5060    +4     
===========================================================================
+ Hits                                            67234    67275   +41     
- Misses                                          45663    45675   +12     
  Partials                                          776      776           
Flag Coverage Δ
rust.hashql-compiletest 46.65% <ø> (ø)
rust.hashql-mir 88.23% <89.79%> (-0.07%) ⬇️

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 22, 2025

CodSpeed Performance Report

Merging #8210 will improve performance by ×2.7

Comparing bm/be-258-hashql-implement-transformationpass-changed-detection (65c3381) with bm/be-255-hashql-add-copy-propagation-pass (049e36c)

Summary

⚡ 7 improvements
✅ 10 untouched

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
complex 25.3 µs 11.8 µs ×2.1
diamond 20.7 µs 7.8 µs ×2.7
complex 18.9 µs 8 µs ×2.4
diamond 15.5 µs 7.3 µs ×2.1
diamond 49.8 µs 38.2 µs +30.54%
linear 11.9 µs 7 µs +70.67%
complex 67.9 µs 55.5 µs +22.49%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

2 participants