Skip to content

Use Result comparison as source of dynamism in RCA#3355

Open
swernli wants to merge 1 commit into
mainfrom
swernli/result-comparison-source-of-dynamism
Open

Use Result comparison as source of dynamism in RCA#3355
swernli wants to merge 1 commit into
mainfrom
swernli/result-comparison-source-of-dynamism

Conversation

@swernli

@swernli swernli commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

This change adjusts how Result values are treated in Runtime Capability Analysis, shifting them from being treated as dynamic variable values by default to treating them as dynamic constant values. This matches the behavior for Qubit variables, as both are identifiers in QIR. Instead of counting on the Result value returned from measurement intrinsics as the source of dynamism, RCA instead tracks when a Result value is used in a comparison and marks the resulting Bool value as a dynamic variable. This more directly maps to how dynamism enters a program, and sets the stage for emitting constant Result arrays into the QIR in the same fashion as Qubit arrays. This builds off of the work in #3349 as we now track the difference between dynamic constants and dyanmic variables across function call boundaries, allowing RCA to properly detect comparison of dynamic constant results throughout the program.

This change adjusts how `Result` values are treated in Runtime Capability Analysis, shifting them from being treated as dynamic variable values by default to treating them as dynamic constant values. This matches the behavior for `Qubit` variables, as both are identifiers in QIR. Instead of counting on the `Result` value returned from measurement intrinsics as the source of dynamism, RCA instead tracks when a `Result` value is used in a comparison and marks the resulting `Bool` value as a dynamic variable. This more directly maps to how dynamism enters a program, and sets the stage for emitting constant `Result` arrays into the QIR in the same fashion as `Qubit` arrays.
This builds off of the work in #3349 as we now track the difference between dynamic constants and dyanmic variables across function call boundaries, allowing RCA to properly detect comparison of dynamic constant results throughout the program.
@swernli swernli requested a review from idavis as a code owner June 18, 2026 05:55
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.

1 participant