Skip to content

Conversation

@li-mingbao
Copy link
Contributor

Description

This PR adds the qco.if operation to the QCO dialect. This operation is similar to the scf.if operation but it takes an additional list of qubits as input that are passed down to the branches as block arguments. This is used in order to support linar typing for qubit values.

Example:

 %q2 = qco.if %condition qubits(%q0 : !qco.qubit) -> !qco.qubit {
    ^bb0(%arg0: !qco.qubit):
      %q1 = qco.h %arg0 : !qco.qubit -> !qco.qubit
      qco.yield %q1
    } else {
    ^bb0(%arg0: !qco.qubit):
      qco.yield %arg0
    }

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.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • 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.

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 64.70588% with 42 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mlir/lib/Dialect/QCO/IR/Scf/IfOp.cpp 54.8% 42 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mergify mergify bot added the conflict label Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant