fix: expose bitcode helpers and update QIR 2 fixtures#81
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the crate’s supported public bitcode boundary in Rust and aligns QIR 2 fixtures with QIR version 2.1 by (a) exposing reusable LLVM memory-buffer/bitcode helpers, (b) validating QIR major/minor pairs (accepting 2.1 while still rejecting unsupported pairs like 1.1), and (c) updating QIR 2 fixture metadata and snapshots to qir_minor_version = 1.
Changes:
- Expose
create_memory_buffer_from_bytes,memory_buffer_to_owned_bytes, andparse_bitcode_moduleas public Rust APIs for working with “public” bitcode bytes. - Update module-flag validation to accept QIR version pairs (1.0, 2.0, 2.1) and explicitly reject unsupported combinations (e.g., 1.1).
- Bump QIR 2 fixture/module-flag minor versions from
0to1across fixture sources and snapshots.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Exposes bitcode/memory-buffer helpers publicly; adds QIR version-pair validation and tests for 1.1 rejection / 2.1 acceptance. |
| tests/data/qir2_base.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/qir2_adaptive.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_result_mixed_array_output.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_result_array.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_result_alloc.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_qubit_array_ssa.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_qubit_array_checked.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_qubit_alloc.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/data/dynamic_qubit_alloc_checked.ll | Updates module flags to QIR 2.1 (qir_minor_version = 1). |
| tests/snaps/qir2_base.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/qir2_adaptive.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_result_mixed_array_output.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_result_array.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_result_alloc.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_qubit_array_ssa.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_qubit_array_checked.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_qubit_alloc.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
| tests/snaps/dynamic_qubit_alloc_checked.ll.snap | Updates snapshot module flags to QIR 2.1 minor version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
302e09d to
ad19e57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_memory_buffer_from_bytes,memory_buffer_to_owned_bytes, andparse_bitcode_moduleas supported Rust helpers for the public bitcode byte boundary.parse_bitcode_moduleis a copied-buffer parser path, not a raw/wrapped LLVM bitcode classifier or malformed-input diagnostic layer; downstream callers should keep pre-parse diagnostics before calling it.2.1is accepted while unsupported pairs like QIR1.1still fail explicitly.qir_minor_version = 0toqir_minor_version = 1.Fixes #78
Fixes #79
Testing
cargo test --lib bitcodemake lintmake test