Passes

Passes that belong to a single dialect are documented on that dialect’s page: QC, QCO, and QTensor. The remaining passes are documented here.

Shared Passes

The following passes are not tied to a single dialect.

-normalize-global-phases

Normalize scoped QC and QCO global phases

Combines direct qc.gphase and qco.gphase operations into at most one operation per basic block, placed immediately before the block terminator. Nested regions are normalized independently.

A normalized phase is moved out of inv, negating its angle, and out of pow only when the exponent is a finite compile-time integer. A phase in a ctrl body becomes a relative phase on the control register: p for one control or a smaller controlled p for multiple controls. Phase angles defined inside a modifier are moved only when their complete local SSA dependency slice is pure and independent of modifier block arguments.

Function, CFG, structured-control-flow, and unknown region boundaries are otherwise preserved. The pass is linear in the number of visited operations and does not scan an enclosing module from individual rewrite patterns.

-unroll-modifiers

Unroll multi-operation modifiers into single-operation ones

Splits ctrl and inv modifiers whose body holds more than one unitary operation into a sequence of modifiers that each hold a single operation. For inv, the order of the operations is reversed. Classical operations of the body are moved in front of the new modifiers.

A pow modifier is only unrolled if its exponent is a compile-time known integer and its operations act on disjoint qubits. Otherwise, pow(r) { a; b } is generally not equivalent to pow(r) { a }; pow(r) { b }: the operations do not commute if they share a qubit, and for a non-integer exponent, the principal branch of the matrix power does not distribute over them. Modifiers nested in a pow body are unrolled either way.

If a modifier cannot be unrolled, the modifier is left untouched. Such modifiers are skipped silently; the pass never fails.

QIR Passes

The following passes operate on modules that have already been lowered to the LLVM dialect by the QIR conversions. They prepare such a module for emission as QIR.

-qir-cleanup

Remove redundant QIR runtime bookkeeping.

Removes redundant QIR runtime qubit-array allocation/release pairs that do not contribute to observable behavior, and keeps QIR modules compact.

-set-qir-attributes-and-metadata

Sets the required attributes to the entry point function and adds the required module flags, compliant with QIR 2.1

Options

-use-adaptive : Specifies the profile.