Skip to content

🐛 Diagnose unsupported QC control flow - #2448

Merged
burgholzer merged 4 commits into
mainfrom
codex/2287-reject-generic-cf
Sep 7, 2026
Merged

🐛 Diagnose unsupported QC control flow#2448
burgholzer merged 4 commits into
mainfrom
codex/2287-reject-generic-cf

Conversation

@simon1hofmann

@simon1hofmann simon1hofmann commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Description

QC-to-QCO could accept unstructured branches even though its qubit state mapping requires structured control flow. The conversion now diagnoses operations with block successors, including cf.br, cf.cond_br, and cf.switch, before state mapping and directs callers to SCF operations.

Addresses the unstructured-control-flow finding in #2287. This PR is independent of the other audit fixes and starts from main at 5f6a8cfa2. No new dependencies.

Validation: all 175 QC-to-QCO tests passed on the combined validation branch containing the four audit fixes, including the new branch regression and existing SCF coverage. uvx nox -s lint and uvx nox -s cpp-lint passed; the latter checks every line of each changed C++ file.

GPT-6 via Codex assisted the implementation, tests, and PR text.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • Changelog entries are not required for this unreleased v4 functionality.
  • Migration instructions are not required for this unreleased v4 functionality.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

Reject block-successor operations before QC-to-QCO state mapping.
The conversion requires structured control flow.

Assisted-by: GPT-6 via Codex
@simon1hofmann simon1hofmann added bug Something isn't working MLIR Anything related to MLIR labels Sep 7, 2026
@simon1hofmann simon1hofmann self-assigned this Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

simon1hofmann and others added 2 commits September 7, 2026 18:31
Keep the early rejection of operations with block successors. Remove the unreachable branch conversion pattern and its unused include, and name the preflight check for its supported-input contract.

Assisted-by: GPT-6 via Codex

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cleaned this up slightly. LGTM now 👍🏻

@burgholzer
burgholzer enabled auto-merge (squash) September 7, 2026 21:02
@burgholzer
burgholzer merged commit 008a0d8 into main Sep 7, 2026
25 of 26 checks passed
@burgholzer
burgholzer deleted the codex/2287-reject-generic-cf branch September 7, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants