Skip to content

Add scf.execute_region guard in conversion passes - #3238

Merged
hsajjad14 merged 12 commits into
mainfrom
hsajjad14/ScfRegionBearingControlOpsError
Oct 1, 2026
Merged

hsajjad14 merged 12 commits into
mainfrom
hsajjad14/ScfRegionBearingControlOpsError

Conversation

@hsajjad14

@hsajjad14 hsajjad14 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Context:

In convert-to-reference-semantics pass scf.execute_region is causing a crash because it is not implemented. When the region ops were walked, scf.yield continues pointing at a deleted gate's result which causes a crash.
(crash log is in shortcut story)

Description of the Change:
Added a guard ensureNoScfExecuteRegionOps in convert-to-reference-semantics and convert-to-value-semantics pass which checks if the Op is a scf::ExecuteRegionOp and bails out before walking the region and crashing.

Added tests:
mlir/test/Quantum/SemanticsConversion/TestScf.mlir
mlir/test/QRef/SemanticConversion/TestScf.mlir

Benefits:
Needed to migrate control-Lowering pass to reference semantics.

Possible Drawbacks:

Related GitHub Issues:

[sc-130940]

@hsajjad14 hsajjad14 self-assigned this Sep 17, 2026
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.63%. Comparing base (f38a8e6) to head (036aafb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3238   +/-   ##
=======================================
  Coverage   95.63%   95.63%           
=======================================
  Files         177      177           
  Lines       21138    21138           
  Branches     2124     2124           
=======================================
  Hits        20216    20216           
  Misses        727      727           
  Partials      195      195           

☔ View full report in Codecov by Harness.
📢 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.

@kipawaa kipawaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! Just one small request before I approve :)

Comment thread doc/releases/changelog-dev.md Resolved
Comment thread doc/releases/changelog-dev.md Resolved

@kipawaa kipawaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks @hsajjad14!

@hsajjad14
hsajjad14 merged commit de24b5e into main Oct 1, 2026
38 checks passed
@hsajjad14
hsajjad14 deleted the hsajjad14/ScfRegionBearingControlOpsError branch October 1, 2026 16:09
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.

3 participants