Followup to #5321
@atgeller is already working on this.
Since Sep 1, 2026.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
The PR #5321 introduces a "verifier pass" which is general not the correct direction for the compiler. The pass runs a spot check on the IR and crashes the compiler if it detects violations.
The rules:
- Passes are meant to analyze, transform, or both the IR. They are not meant to check and crash.
- The IR should be in a "sane" state between every pass in the compiler.
- Compiler passes should compose. Only in extreme cases would a pass crash the compiler.
The check itself does not guard against "incorrect" IR but against a usage pattern by the programmer that was decided wasn't going to be supported. There is a distinction there.
At any rate, this pass needs to be removed. The desired check needs to be promoted to a "syntax error" in the bridges as they perform semantics checking on the input or pushed all the way to the backend codegen translations where there is no prospect of the compiler morphing the IR.
Pushing it to the backend would allow DQE and erasure of measurements and DCE to come to play and those may eliminate this "error" entirely. Unfortunately, it may also be true the compiler introduces an ancilla qubit into the IR which could generate a false positive. It may therefore be best to add this as a semantics check to the C++ and Python bridge and raise a fatal semantics error using clang's (or python's) error reporting system.
Another approach is to abandon this plan and consider moving allocations, deallocations, and measurements out of the atomic region by transformation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.