Skip to content

Adaptive QIR emission does not properly handle negative indexing - #3689

Merged
Stefan J. Wernli (swernli) merged 1 commit into
mainfrom
swernli/issue3688
Sep 4, 2026
Merged

Adaptive QIR emission does not properly handle negative indexing#3689
Stefan J. Wernli (swernli) merged 1 commit into
mainfrom
swernli/issue3688

Conversation

@swernli

Copy link
Copy Markdown
Contributor

This changes updates the Index instruction from RIR to generate a sequence of instructions that checks the sign on the index and includes a corresponding offset to ensure that negative indexing works as expected in the emitted QIR. This change also adds a new integration test that validates both the QIR output and the execution time behavior of negative indexing. Fixes #3688

This changes updates the `Index` instruction from RIR to generate a sequence of instructions that checks the sign on the index and includes a corresponding offset to ensure that negative indexing works as expected in the emitted QIR. This change also adds a new integration test that validates both the QIR output and the execution time behavior of negative indexing.
Fixes #3688

@orpuente-MS orpuente-MS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix makes sense, and we verified it works with run_qir. Thanks!

@swernli
Stefan J. Wernli (swernli) added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 2dcf6a0 Sep 4, 2026
14 checks passed
@swernli
Stefan J. Wernli (swernli) deleted the swernli/issue3688 branch September 4, 2026 21:50
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.

Adaptive QIR emission does not properly handle negative indexing

2 participants