diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 383636863..32efa9425 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,9 @@ env: # different strings for install action and feature name # adapted from https://github.com/TheDan64/inkwell/blob/master/.github/workflows/test.yml - LLVM_VERSION: "14.0" - LLVM_FEATURE_NAME: "14-0" + LLVM_MAIN_VERSION: "21" + LLVM_VERSION: "21.1" + LLVM_FEATURE_NAME: "21-1" # Path to the cached tket-c-api library # When this envvar is set, the `./.github/actions/tket-c-api` action **must** be run to fetch the artifacts @@ -76,9 +77,11 @@ jobs: - name: Check formatting run: cargo fmt -- --check - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Run clippy run: cargo clippy --all-targets --all-features --workspace -- -D warnings - name: Build docs @@ -102,10 +105,11 @@ jobs: version: ${{ env.UV_VERSION }} enable-cache: true - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} - directory: ${{ runner.temp }}/llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: @@ -193,9 +197,11 @@ jobs: - name: Configure default rust toolchain run: rustup override set ${{steps.toolchain.outputs.name}} - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: @@ -227,9 +233,11 @@ jobs: with: toolchain: ${{ matrix.rust }} - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: @@ -261,9 +269,11 @@ jobs: toolchain: "nightly" components: llvm-tools-preview - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: @@ -308,9 +318,11 @@ jobs: - name: Configure default rust toolchain run: rustup override set ${{steps.toolchain.outputs.name}} - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: @@ -391,9 +403,11 @@ jobs: version: ${{ env.UV_VERSION }} enable-cache: true - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install Python ${{ env.PYTHON_LOWEST }} run: uv python install ${{ env.PYTHON_LOWEST }} - name: Run qis-compiler tests diff --git a/.github/workflows/python-wheels.yml b/.github/workflows/python-wheels.yml index 09f5885e5..42e630e99 100644 --- a/.github/workflows/python-wheels.yml +++ b/.github/workflows/python-wheels.yml @@ -33,8 +33,9 @@ env: RUSTC_WRAPPER: "sccache" # different strings for install action and feature name # adapted from https://github.com/TheDan64/inkwell/blob/master/.github/workflows/test.yml - LLVM_VERSION: "14.0" - LLVM_FEATURE_NAME: "14-0" + LLVM_MAIN_VERSION: "21" + LLVM_VERSION: "21.1" + LLVM_FEATURE_NAME: "21-1" jobs: # Check if the tag matches the package name, @@ -123,9 +124,11 @@ jobs: version: ${{ env.UV_VERSION }} enable-cache: true - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev # Set the path to the cached tket-c-api library # When this envvar is set, the `./.github/actions/tket-c-api` action **must** be run to fetch the artifacts diff --git a/.github/workflows/unsoundness.yml b/.github/workflows/unsoundness.yml index 6822b31ab..0e428a31b 100644 --- a/.github/workflows/unsoundness.yml +++ b/.github/workflows/unsoundness.yml @@ -23,8 +23,9 @@ env: # different strings for install action and feature name # adapted from https://github.com/TheDan64/inkwell/blob/master/.github/workflows/test.yml - LLVM_VERSION: "14.0" - LLVM_FEATURE_NAME: "14-0" + LLVM_MAIN_VERSION: "21" + LLVM_VERSION: "21.1" + LLVM_FEATURE_NAME: "21-1" # Path to the cached tket-c-api library # When this envvar is set, the `./.github/actions/tket-c-api` action **must** be run to fetch the artifacts @@ -46,9 +47,11 @@ jobs: rustup override set nightly cargo miri setup - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_VERSION }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_MAIN_VERSION }} main' + sudo apt update + sudo apt install llvm-${{ env.LLVM_MAIN_VERSION }} libpolly-${{ env.LLVM_MAIN_VERSION }}-dev - name: Install tket-c-api library uses: ./.github/actions/tket-c-api with: diff --git a/Cargo.lock b/Cargo.lock index 150bbd61c..f7bc8abe2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,9 +55,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "1.0.0" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -76,9 +76,9 @@ checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" -version = "1.0.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] @@ -166,7 +166,7 @@ dependencies = [ "petgraph 0.6.5", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -218,14 +218,14 @@ dependencies = [ "regex", "rustc-hash 2.1.1", "shlex", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "bitflags" -version = "2.11.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "bitvec" @@ -290,9 +290,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "capnp" -version = "0.25.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c982cc37b8f646c753f3b0a24d4d40ca2eac8a9c2b9ea6fff524be67ddc184cb" +checksum = "1ae0593da254d02d0e69525b5eec7a59586753aa3bd2e54842eca33c6786330c" dependencies = [ "embedded-io", ] @@ -317,16 +317,16 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.117", + "syn 2.0.114", "tempfile", "toml", ] [[package]] name = "cc" -version = "1.2.56" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ "find-msvc-tools", "jobserver", @@ -368,9 +368,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.44" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", "js-sys", @@ -420,9 +420,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.6.0" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" dependencies = [ "clap_builder", "clap_derive", @@ -440,9 +440,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.6.0" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" dependencies = [ "anstream", "anstyle", @@ -452,21 +452,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.6.0" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "clap_lex" -version = "1.1.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] name = "clio" @@ -671,9 +671,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ "darling_core", "darling_macro", @@ -681,27 +681,26 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "darling_macro" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -737,14 +736,14 @@ checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "deranged" -version = "0.5.8" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", "serde_core", @@ -758,18 +757,18 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "derive-where" -version = "1.6.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08b3a0bcc0d079199cd476b2cae8435016ec11d1c0986c6901c5ac223041534" +checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -782,7 +781,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -804,7 +803,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.117", + "syn 2.0.114", "unicode-xid", ] @@ -863,7 +862,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -874,9 +873,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "erased-serde" -version = "0.4.10" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" dependencies = [ "serde", "serde_core", @@ -937,26 +936,26 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-macro" -version = "0.3.32" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" @@ -966,14 +965,15 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", + "pin-utils", "slab", ] @@ -1004,21 +1004,8 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi 5.3.0", - "wasip2", -] - -[[package]] -name = "getrandom" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", + "r-efi", "wasip2", - "wasip3", ] [[package]] @@ -1099,21 +1086,20 @@ dependencies = [ [[package]] name = "hugr" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45b39ce076230f7b2d7ca08ba20d77a8f61bb9d4a3bba2c3ac25a8e2df0cb68" +checksum = "60bd5eca20bf3e7045b68668c7b29e80e05e1c36072e9adf1b7565ecaec906e3" dependencies = [ "hugr-core", "hugr-llvm", "hugr-model", - "hugr-passes", ] [[package]] name = "hugr-cli" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a4557d1748193b7970607bbdfb2fa9b9694ce49337a6df9aa96edef472c48f0" +checksum = "13c2e99f82b15e5a9f8a41c96f4fe8647ba93315b2c84a533a34f0e916b5b4eb" dependencies = [ "anyhow", "clap", @@ -1132,9 +1118,9 @@ dependencies = [ [[package]] name = "hugr-core" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0701cebf3e3331826d945c9f7b1e043a3c476cd5ca2ade3dbce105a6bd39c0d0" +checksum = "3aaf6aa2670a90068eafb9606418fd0d24c0b34064c70590e24e0db8c6d43cd9" dependencies = [ "base64", "cgmath", @@ -1161,7 +1147,7 @@ dependencies = [ "smallvec", "smol_str", "static_assertions", - "strum 0.28.0", + "strum", "thiserror 2.0.18", "tracing", "typetag", @@ -1170,9 +1156,9 @@ dependencies = [ [[package]] name = "hugr-llvm" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1babb400579c90091c0d3b0637563018208af332c90f2b9125b13bb1bb6f3a" +checksum = "efcbab7e40ab80cc1de863b998a17a01e9c58b1e2c1f339da33fe2fed9bbc124" dependencies = [ "anyhow", "cc", @@ -1185,14 +1171,14 @@ dependencies = [ "petgraph 0.8.3", "portgraph 0.15.3", "rstest", - "strum 0.28.0", + "strum", ] [[package]] name = "hugr-model" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b422e3b24b6586f683abe93393f8b9b8bb8b0d028723a13d4c48816039935e" +checksum = "5a2403a481855ba1dd61c1354c3173c03a53546558a8373e4dee3beaa0001796" dependencies = [ "base64", "bumpalo", @@ -1212,9 +1198,9 @@ dependencies = [ [[package]] name = "hugr-passes" -version = "0.25.7" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8034893e2f6def14f03406c1d43a79663b9c83364b840bc808e0ffef4ad34e2d" +checksum = "c3022a594f5c428c2ee12e6cf7c8f690eff71972231d9b40f29a52e299f8e91f" dependencies = [ "ascent", "derive_more 2.1.1", @@ -1225,7 +1211,7 @@ dependencies = [ "petgraph 0.8.3", "portgraph 0.15.3", "serde_json", - "strum 0.28.0", + "strum", "thiserror 2.0.18", ] @@ -1253,12 +1239,6 @@ dependencies = [ "cc", ] -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - [[package]] name = "ident_case" version = "1.0.1" @@ -1294,15 +1274,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "indoc" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" -dependencies = [ - "rustversion", -] - [[package]] name = "inkwell" version = "0.8.0" @@ -1324,7 +1295,7 @@ checksum = "63736175c9a30ea123f7018de9f26163e0b39cd6978990ae486b510c4f3bad69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -1350,9 +1321,9 @@ dependencies = [ [[package]] name = "inventory" -version = "0.3.22" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" dependencies = [ "rustversion", ] @@ -1413,15 +1384,15 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.4", + "getrandom", "libc", ] [[package]] name = "js-sys" -version = "0.3.91" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -1433,12 +1404,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - [[package]] name = "libc" version = "0.2.183" @@ -1457,20 +1422,21 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.12.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "llvm-sys" -version = "140.1.3" +version = "211.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3dc78e9857c0231ec11e3bdccf63870493fdc7d0570b0ea7d50bf5df0cb1a0c" +checksum = "108b3ad2b2eaf2a561fc74196273b20e3436e4a688b8b44e250d83974dc1b2e2" dependencies = [ + "anyhow", "cc", "lazy_static", "libc", - "regex", + "regex-lite", "semver", ] @@ -1491,18 +1457,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "memoffset" -version = "0.9.1" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "minimal-lexical" @@ -1586,9 +1543,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.4" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" @@ -1695,7 +1652,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -1732,9 +1689,15 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.17" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" @@ -1847,7 +1810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -1863,9 +1826,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.5.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ "toml_edit", ] @@ -1889,7 +1852,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -1903,29 +1866,17 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.27.2" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d" +checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1" dependencies = [ "anyhow", - "indoc", "libc", - "memoffset", "once_cell", "portable-atomic", - "pyo3-build-config 0.27.2", + "pyo3-build-config", "pyo3-ffi", "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6" -dependencies = [ - "target-lexicon", ] [[package]] @@ -1939,44 +1890,44 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.27.2" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089" +checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc" dependencies = [ "libc", - "pyo3-build-config 0.27.2", + "pyo3-build-config", ] [[package]] name = "pyo3-macros" -version = "0.27.2" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02" +checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "pyo3-macros-backend" -version = "0.27.2" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9" +checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a" dependencies = [ "heck", "proc-macro2", - "pyo3-build-config 0.27.2", + "pyo3-build-config", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "pythonize" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a8f29db331e28c332c63496cfcbb822aca3d7320bc08b655d7fd0c29c50ede" +checksum = "0b79f670c9626c8b651c0581011b57b6ba6970bb69faf01a7c4c0cfc81c43f95" dependencies = [ "pyo3", "serde", @@ -1984,9 +1935,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.45" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -1997,12 +1948,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - [[package]] name = "radium" version = "0.7.0" @@ -2074,7 +2019,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2091,20 +2036,26 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "relative-path" @@ -2172,7 +2123,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.117", + "syn 2.0.114", "unicode-ident", ] @@ -2199,9 +2150,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", @@ -2218,9 +2169,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.23" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "same-file" @@ -2265,7 +2216,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2283,11 +2234,11 @@ dependencies = [ "insta", "itertools 0.14.0", "pyo3", - "pyo3-build-config 0.28.2", + "pyo3-build-config", "rstest", "serde", "serde_json", - "strum 0.28.0", + "strum", "tket", "tket-qsystem", "tracing", @@ -2331,7 +2282,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2342,7 +2293,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2369,9 +2320,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.17.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" +checksum = "dd5414fad8e6907dbdd5bc441a50ae8d6e26151a03b1de04d89a5576de61d01f" dependencies = [ "base64", "chrono", @@ -2388,14 +2339,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.17.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" +checksum = "d3db8978e608f1fe7357e211969fd9abdcae80bac1ba7a3369bb7eb6b404eb65" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2477,34 +2428,13 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" -dependencies = [ - "strum_macros 0.27.2", -] - [[package]] name = "strum" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" dependencies = [ - "strum_macros 0.28.0", -] - -[[package]] -name = "strum_macros" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.117", + "strum_macros", ] [[package]] @@ -2516,7 +2446,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2532,9 +2462,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.117" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -2562,7 +2492,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2573,18 +2503,18 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.13.5" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" +checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba" [[package]] name = "tempfile" -version = "3.27.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand", - "getrandom 0.4.2", + "getrandom", "once_cell", "rustix", "windows-sys 0.61.2", @@ -2625,7 +2555,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2636,7 +2566,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -2726,6 +2656,7 @@ dependencies = [ "fxhash", "hugr", "hugr-core", + "hugr-passes", "indexmap 2.13.0", "insta", "itertools 0.14.0", @@ -2744,7 +2675,7 @@ dependencies = [ "serde_json", "serde_with", "smol_str", - "strum 0.28.0", + "strum", "tket-json-rs", "tracing", "typetag", @@ -2753,16 +2684,16 @@ dependencies = [ [[package]] name = "tket-json-rs" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd84cd4e9aba4cd47134be2d36fa04765e850ac16fd53948082734f5dc364965" +checksum = "f94cdded1cb82aaf9e0c2508762753f72c60ce8c068853b8ecc6c1bcd21644b9" dependencies = [ "derive_more 2.1.1", "pyo3", "pythonize", "serde", "serde_json", - "strum 0.27.2", + "strum", "uuid", ] @@ -2774,6 +2705,7 @@ dependencies = [ "cool_asserts", "derive_more 2.1.1", "hugr", + "hugr-passes", "itertools 0.14.0", "num_cpus", "portmatching", @@ -2782,7 +2714,7 @@ dependencies = [ "rstest", "serde", "serde_json", - "strum 0.28.0", + "strum", "tket", "tket-json-rs", "tket-qsystem", @@ -2801,6 +2733,7 @@ dependencies = [ "hugr", "hugr-cli", "hugr-core", + "hugr-passes", "indexmap 2.13.0", "itertools 0.14.0", "lazy_static", @@ -2810,7 +2743,7 @@ dependencies = [ "serde", "serde_json", "smol_str", - "strum 0.28.0", + "strum", "tket", "tket-json-rs", "tket1-passes", @@ -2838,14 +2771,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" +version = "0.9.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" dependencies = [ "indexmap 2.13.0", "serde_core", "serde_spanned", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", "winnow", @@ -2860,32 +2793,23 @@ dependencies = [ "serde_core", ] -[[package]] -name = "toml_datetime" -version = "1.0.0+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" -dependencies = [ - "serde_core", -] - [[package]] name = "toml_edit" -version = "0.25.4+spec-1.1.0" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap 2.13.0", - "toml_datetime 1.0.0+spec-1.1.0", + "toml_datetime", "toml_parser", "winnow", ] [[package]] name = "toml_parser" -version = "1.0.9+spec-1.1.0" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] @@ -2927,7 +2851,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -3004,7 +2928,7 @@ checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -3015,9 +2939,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.24" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-segmentation" @@ -3037,12 +2961,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unindent" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" - [[package]] name = "utf8-width" version = "0.1.8" @@ -3057,11 +2975,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.22.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ - "getrandom 0.4.2", + "getrandom", "js-sys", "serde_core", "wasm-bindgen", @@ -3098,20 +3016,11 @@ dependencies = [ "wit-bindgen", ] -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen", -] - [[package]] name = "wasm-bindgen" -version = "0.2.114" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", @@ -3122,9 +3031,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.114" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3132,65 +3041,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.114" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.114" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap 2.13.0", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "hashbrown 0.15.5", - "indexmap 2.13.0", - "semver", -] - [[package]] name = "web-sys" -version = "0.3.91" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -3248,7 +3123,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -3259,7 +3134,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] @@ -3427,9 +3302,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.15" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] @@ -3439,88 +3314,6 @@ name = "wit-bindgen" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap 2.13.0", - "prettyplease", - "syn 2.0.117", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn 2.0.117", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags", - "indexmap 2.13.0", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.13.0", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] [[package]] name = "wyz" @@ -3533,29 +3326,29 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.42" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.42" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.114", ] [[package]] name = "zmij" -version = "1.0.21" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" [[package]] name = "zstd" diff --git a/Cargo.toml b/Cargo.toml index 13c0b3d2c..78ac8d8b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,31 +43,31 @@ large_enum_variant = "allow" [patch.crates-io] # Uncomment to use unreleased versions of hugr -# hugr = { git = "https://github.com/quantinuum/hugr", "rev" = "5415abebf35be4af4e5bac5c7fe54381aea55a3e" } -# hugr-core = { git = "https://github.com/quantinuum/hugr", "rev" = "5415abebf35be4af4e5bac5c7fe54381aea55a3e" } -# hugr-cli = { git = "https://github.com/quantinuum/hugr", "rev" = "5415abebf35be4af4e5bac5c7fe54381aea55a3e" } -# hugr-passes = { git = "https://github.com/quantinuum/hugr", "rev" = "5415abebf35be4af4e5bac5c7fe54381aea55a3e" } -# hugr-llvm = { git = "https://github.com/quantinuum/hugr", "rev" = "5415abebf35be4af4e5bac5c7fe54381aea55a3e" } +#hugr = { git = "https://github.com/quantinuum/hugr", "rev" = "3dacad485c1004a84b22e8a1de0f86fb7087e05b" } +#hugr-core = { git = "https://github.com/quantinuum/hugr", "rev" = "3dacad485c1004a84b22e8a1de0f86fb7087e05b" } +#hugr-cli = { git = "https://github.com/quantinuum/hugr", "rev" = "3dacad485c1004a84b22e8a1de0f86fb7087e05b" } +#hugr-passes = { git = "https://github.com/quantinuum/hugr", "rev" = "3dacad485c1004a84b22e8a1de0f86fb7087e05b" } +#hugr-llvm = { git = "https://github.com/quantinuum/hugr", "rev" = "3dacad485c1004a84b22e8a1de0f86fb7087e05b" } # portgraph = { git = "https://github.com/quantinuum/portgraph", rev = "68b96ac737e0c285d8c543b2d74a7aa80a18202c" } [workspace.dependencies] - # Make sure to run `just recompile-eccs` if the hugr serialisation format changes. -hugr = "0.25.7" -hugr-core = "0.25.7" -hugr-cli = "0.25.7" +hugr = "0.26.0" +hugr-core = "0.26.0" +hugr-cli = "0.26.0" +hugr-passes = "0.26.0" portgraph = "0.15.3" # There can only be one `pyo3` version in the whole workspace, so we use a # loose version constraint to prevent breaking changes in dependent crates where possible. -pyo3 = ">= 0.27.2, < 0.29" -pyo3-build-config = ">= 0.27.2, < 0.29" +pyo3 = ">= 0.28.0, < 0.29" +pyo3-build-config = ">= 0.28.0, < 0.29" bindgen = "0.72" cbindgen = "0.29" -cc = "1.2.56" +cc = "1.2.57" conan2 = "0.1.9" itertools = "0.14.0" -tket-json-rs = "0.8.1" +tket-json-rs = "0.8.2" portmatching = "0.3.3" bytemuck = "1.25.0" cgmath = "0.18.0" @@ -92,7 +92,7 @@ rmp-serde = "1.3.1" rstest = "0.26.1" serde = "1.0.228" serde_json = "1.0.149" -serde_with = "3.17.0" +serde_with = "3.18.0" smol_str = "0.3.6" strum = ">= 0.28.0" thiserror = "2.0.18" diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index dc2514437..ade27a2bd 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -33,9 +33,9 @@ To setup the environment manually you will need: - cargo-nextest: - uv `>=0.3`: docs.astral.sh/uv/getting-started/installation - conan `>=2.0.0,<3`: This gets installed by `just setup` / `uv tool install conan` -- Optional: llvm `== 14.0`. The "llvm" feature (backed by the sub-crate `hugr-llvm`) - requires LLVM installed. We use the rust bindings - [llvm-sys](https://crates.io/crates/llvm-sys) to [llvm](https://llvm.org/). +- Optional: [llvm](https://llvm.org/) `== 21.1`. The "llvm" feature (backed by the sub-crate `hugr-llvm`) + requires LLVM 21.1 installed. We use the rust bindings from + [llvm-sys](https://crates.io/crates/llvm-sys). Once you have these installed, install the required python dependencies and setup pre-commit hooks with: @@ -45,11 +45,11 @@ just setup #### Note on LLVM -You will need llvm 14.0 installed in order for `just check` to run all its +You will need llvm 21.1 installed in order for `just check` to run all its checks successfully. On Debian-based systems you can install it as the -`llvm-14` package; you will also need to install `libpolly14-dev`. You should -set the environment variable `LLVM_SYS_140_PREFIX` to point to its location -(e.g. `/usr/lib/llvm-14`) when running `just check`. +`llvm-21` package; you may also need to install `libpolly21-dev`. You should +set the environment variable `LLVM_SYS_211_PREFIX` to point to its location +(e.g. `/usr/lib/llvm-21`) when running `just check`. ## 🚀 Local development using the tket python library diff --git a/devenv.lock b/devenv.lock index c88779258..6cb62ab88 100644 --- a/devenv.lock +++ b/devenv.lock @@ -87,27 +87,11 @@ "type": "github" } }, - "nixpkgs-2505": { - "locked": { - "lastModified": 1762498405, - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6faeb062ee4cf4f105989d490831713cc5a43ee1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-25.05", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "devenv": "devenv", "git-hooks": "git-hooks", "nixpkgs": "nixpkgs", - "nixpkgs-2505": "nixpkgs-2505", "pre-commit-hooks": [ "git-hooks" ], diff --git a/devenv.nix b/devenv.nix index 4118f8972..d929bc912 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,8 +1,10 @@ { pkgs, lib, inputs, ... }: let - pkgs-stable = import inputs.nixpkgs-2505 { system = pkgs.stdenv.system; }; - llvmVersion = "14"; - llvmPackages = pkgs-stable."llvmPackages_${llvmVersion}"; + llvmVersion = "21"; + llvmPackages = pkgs."llvmPackages_${llvmVersion}"; + versionInfo = builtins.splitVersion llvmPackages.release_version; + llvmVersionMajor = builtins.elemAt versionInfo 0; + llvmVersionMinor = builtins.elemAt versionInfo 1; in { # https://devenv.sh/packages/ @@ -40,7 +42,7 @@ in ''; env = { - "LLVM_SYS_${llvmVersion}0_PREFIX" = "${llvmPackages.libllvm.dev}"; + "LLVM_SYS_${llvmVersionMajor}${llvmVersionMinor}_PREFIX" = "${llvmPackages.libllvm.dev}"; "LIBCLANG_PATH" = "${pkgs.libclang.lib}/lib"; # hardening removed due its impact on tikv-jemalloc-sys build, # as depended upon by tikv-jemalloc-sys diff --git a/devenv.yaml b/devenv.yaml index cc9514dad..666f27ded 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -1,8 +1,6 @@ inputs: nixpkgs: url: github:NixOS/nixpkgs/nixpkgs-unstable - nixpkgs-2505: - url: github:NixOS/nixpkgs/nixos-25.05 rust-overlay: url: github:oxalica/rust-overlay inputs: diff --git a/qis-compiler/pyproject.toml b/qis-compiler/pyproject.toml index e42de2d4d..db5e567cc 100644 --- a/qis-compiler/pyproject.toml +++ b/qis-compiler/pyproject.toml @@ -92,7 +92,7 @@ test-command = "pytest -vv {package}" [tool.cibuildwheel.linux.environment] PATH = '$HOME/.cargo/bin:/tmp/llvm/bin:$PATH' -LLVM_SYS_140_PREFIX = '/tmp/llvm' +LLVM_SYS_211_PREFIX = '/tmp/llvm' environment-pass = ["CACHE_CARGO"] [tool.cibuildwheel.linux] before-all = ''' @@ -112,12 +112,12 @@ before-all = ''' mkdir -p /tmp/llvm; if [ "$(uname -m)" = "x86_64" ]; then - curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-x86_64-linux-gnu-rhel-8.4.tar.xz; - tar xf clang+llvm-14.0.6-x86_64-linux-gnu-rhel-8.4.tar.xz -C /tmp/llvm --strip-components=1; + curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-Linux-X64.tar.xz; + tar xf LLVM-21.1.8-Linux-X64.tar.xz -C /tmp/llvm --strip-components=1; else dnf install ncurses-compat-libs ncurses-devel -y; - curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-aarch64-linux-gnu.tar.xz - tar xf clang+llvm-14.0.6-aarch64-linux-gnu.tar.xz -C /tmp/llvm --strip-components=1; + curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-Linux-ARM64.tar.xz + tar xf LLVM-21.1.8-Linux-ARM64.tar.xz -C /tmp/llvm --strip-components=1; fi; ''' before-test = ''' @@ -151,15 +151,12 @@ repair-wheel-command = [ [tool.cibuildwheel.macos.environment] PATH = '/tmp/llvm:$PATH' -LLVM_SYS_140_PREFIX = '/tmp/llvm' +LLVM_SYS_211_PREFIX = '/tmp/llvm' MACOSX_DEPLOYMENT_TARGET = "15.0" [tool.cibuildwheel.macos] before-all = [ 'curl -sSf https://sh.rustup.rs | sh -s -- -y', - 'if [ "$(uname -m)" = "arm64" ]; then ARCH_PREFIX=arm64-apple-darwin22.3.0; else ARCH_PREFIX=x86_64-apple-darwin; fi', - 'curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-$ARCH_PREFIX.tar.xz', - 'mkdir -p /tmp/llvm', - 'tar xf clang+llvm-14.0.6-$ARCH_PREFIX.tar.xz -C /tmp/llvm --strip-components=1', + 'if [ "$(uname -m)" = "arm64" ]; then ARCH_SUFFIX=macOS-ARM64; else ARCH_SUFFIX=macOS-X64; fi && curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-$ARCH_SUFFIX.tar.xz && mkdir -p /tmp/llvm && tar xf LLVM-21.1.8-$ARCH_SUFFIX.tar.xz -C /tmp/llvm --strip-components=1', ] repair-wheel-command = [ 'DYLD_FALLBACK_LIBRARY_PATH=/tmp/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}', @@ -168,12 +165,12 @@ repair-wheel-command = [ [tool.cibuildwheel.windows.environment] PATH = 'C:\\LLVM\\bin;$PATH' -LLVM_SYS_140_PREFIX = 'C:\\LLVM' +LLVM_SYS_211_PREFIX = 'C:\\LLVM' [tool.cibuildwheel.windows] before-all = [ 'rustup update', - 'curl -LO https://github.com/PLC-lang/llvm-package-windows/releases/download/v14.0.6/LLVM-14.0.6-win64.7z', - '7z x LLVM-14.0.6-win64.7z "-oC:\LLVM" -y', + 'curl -LO https://github.com/PLC-lang/llvm-package-windows/releases/download/v21.1.8/LLVM-21.1.8-win64.7z', + '7z x LLVM-21.1.8-win64.7z "-oC:\LLVM" -y', ] repair-wheel-command = [ 'uvx delvewheel repair -w {dest_dir} {wheel}', diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/aarch64-apple-darwin/gpu_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/aarch64-apple-darwin/gpu_aarch64-apple-darwin index 6e7c7bb22..54cc86f5a 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/aarch64-apple-darwin/gpu_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/aarch64-apple-darwin/gpu_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @gpu_cache_is_set_function_id_fn_returning_float = thread_local local_unnamed_addr global i8 0 @@ -19,7 +19,7 @@ target triple = "aarch64-apple-darwin" ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_float() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -30,22 +30,22 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @function_name, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_float, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_float, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_float, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_float, align 8 br label %common.ret } ; Function Attrs: noinline define void @run_gpu_validation() local_unnamed_addr #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated.not = icmp eq i8 %validated, 0 br i1 %already_validated.not, label %validate, label %common.ret @@ -55,7 +55,7 @@ common.ret: ; preds = %entry, %validate validate: ; preds = %entry %validate_call = tail call i8 @gpu_validate_api(i64 0, i64 1, i64 0) tail call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 br label %common.ret } @@ -78,24 +78,24 @@ err: ; preds = %entry ; Function Attrs: noinline noreturn define void @gpu_error_handler() local_unnamed_addr #1 { entry: - %error_message = tail call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i64 0, i64 0), i8* %error_message - tail call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = tail call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + tail call void @panic_str(i32 70002, ptr nonnull %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() local_unnamed_addr +declare ptr @gpu_get_error() local_unnamed_addr ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) local_unnamed_addr #2 +declare void @panic_str(i32, ptr) local_unnamed_addr #2 -declare i8 @gpu_get_function_id(i8*, i64*) local_unnamed_addr +declare i8 @gpu_get_function_id(ptr, ptr) local_unnamed_addr ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_int() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -106,98 +106,90 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name.1, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name.1, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_int, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_int, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_int, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_int, align 8 br label %common.ret } -declare i8 @gpu_init(i64, i64*) local_unnamed_addr +declare i8 @gpu_init(i64, ptr) local_unnamed_addr -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) local_unnamed_addr +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) local_unnamed_addr -declare i8 @gpu_get_result(i64, i64, i8*) local_unnamed_addr +declare i8 @gpu_get_result(i64, i64, ptr) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr declare i8 @gpu_discard(i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: %gpu_ref_ptr.i = alloca i64, align 8 %gpu_input_blob.i = alloca [16 x i8], align 8 %int_result.i = alloca i64, align 8 - %gpu_input_blob26.i = alloca i64, align 8 - %int_result32.i = alloca i64, align 8 + %gpu_input_blob24.i = alloca [8 x i8], align 8 + %int_result28.i = alloca i64, align 8 tail call void @setup(i64 %0) - %1 = bitcast i64* %gpu_ref_ptr.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %1) - %2 = getelementptr inbounds [16 x i8], [16 x i8]* %gpu_input_blob.i, i64 0, i64 0 - call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %2) - %3 = bitcast i64* %int_result.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) - %4 = bitcast i64* %gpu_input_blob26.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %4) - %5 = bitcast i64* %int_result32.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %5) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result28.i) %function_id_call.i = tail call i64 @gpu_function_id_fn_returning_float() %function_id_call3.i = tail call i64 @gpu_function_id_fn_returning_int() tail call void @run_gpu_validation() - %gpu_ref_call.i = call i8 @gpu_init(i64 0, i64* nonnull %gpu_ref_ptr.i) + %gpu_ref_call.i = call i8 @gpu_init(i64 0, ptr nonnull %gpu_ref_ptr.i) call void @validate_gpu_response(i8 %gpu_ref_call.i) - %gpu_ref.i = load i64, i64* %gpu_ref_ptr.i, align 8 - %6 = bitcast [16 x i8]* %gpu_input_blob.i to i64* - store i64 42, i64* %6, align 8 - %dest_ptr17.i = getelementptr inbounds [16 x i8], [16 x i8]* %gpu_input_blob.i, i64 0, i64 8 - %7 = bitcast i8* %dest_ptr17.i to i64* - store i64 4613303441197561744, i64* %7, align 8 - %8 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, i8* nonnull %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @arg_types, i64 0, i64 0)) - call void @validate_gpu_response(i8 %8) - %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %3) + %gpu_ref.i = load i64, ptr %gpu_ref_ptr.i, align 8 + store i64 42, ptr %gpu_input_blob.i, align 8 + %dest_ptr17.i = getelementptr inbounds nuw i8, ptr %gpu_input_blob.i, i64 8 + store i64 4613303441197561744, ptr %dest_ptr17.i, align 8 + %1 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, ptr nonnull %gpu_input_blob.i, ptr nonnull @arg_types) + call void @validate_gpu_response(i8 %1) + %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result.i) call void @validate_gpu_response(i8 %read_status.i) - %int_result20.i = load i64, i64* %int_result.i, align 8 - call void @print_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @res_a.19FB4E83.0, i64 0, i64 0), i64 10, i64 %int_result20.i) - store i64 %int_result20.i, i64* %gpu_input_blob26.i, align 8 - %9 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, i8* nonnull %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @arg_types.2, i64 0, i64 0)) - call void @validate_gpu_response(i8 %9) - %read_status34.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %5) - call void @validate_gpu_response(i8 %read_status34.i) - %float_result_ptr.i = bitcast i64* %int_result32.i to double* - %float_result.i = load double, double* %float_result_ptr.i, align 8 - %10 = call i8 @gpu_discard(i64 %gpu_ref.i) - call void @validate_gpu_response(i8 %10) - call void @print_float(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_b.0E048F9C.0, i64 0, i64 0), i64 12, double %float_result.i) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) - call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %2) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %4) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) - %11 = call i64 @teardown() - ret i64 %11 + %result.i = load i64, ptr %int_result.i, align 8 + call void @print_int(ptr nonnull @res_a.19FB4E83.0, i64 10, i64 %result.i) + store i64 %result.i, ptr %gpu_input_blob24.i, align 8 + %2 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, ptr nonnull %gpu_input_blob24.i, ptr nonnull @arg_types.2) + call void @validate_gpu_response(i8 %2) + %read_status29.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result28.i) + call void @validate_gpu_response(i8 %read_status29.i) + %result30.i = load double, ptr %int_result28.i, align 8 + %3 = call i8 @gpu_discard(i64 %gpu_ref.i) + call void @validate_gpu_response(i8 %3) + call void @print_float(ptr nonnull @res_b.0E048F9C.0, i64 12, double %result30.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result28.i) + %4 = call i64 @teardown() + ret i64 %4 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #3 -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #3 attributes #0 = { noinline } attributes #1 = { noinline noreturn } attributes #2 = { noreturn } -attributes #3 = { argmemonly nofree nosync nounwind willreturn } +attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } !name = !{!0} diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-apple-darwin/gpu_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-apple-darwin/gpu_x86_64-apple-darwin index 37a77a905..55dc015eb 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-apple-darwin/gpu_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-apple-darwin/gpu_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @gpu_cache_is_set_function_id_fn_returning_float = thread_local local_unnamed_addr global i8 0 @@ -19,7 +19,7 @@ target triple = "x86_64-apple-darwin" ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_float() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -30,22 +30,22 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @function_name, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_float, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_float, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_float, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_float, align 8 br label %common.ret } ; Function Attrs: noinline define void @run_gpu_validation() local_unnamed_addr #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated.not = icmp eq i8 %validated, 0 br i1 %already_validated.not, label %validate, label %common.ret @@ -55,7 +55,7 @@ common.ret: ; preds = %entry, %validate validate: ; preds = %entry %validate_call = tail call i8 @gpu_validate_api(i64 0, i64 1, i64 0) tail call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 br label %common.ret } @@ -78,24 +78,24 @@ err: ; preds = %entry ; Function Attrs: noinline noreturn define void @gpu_error_handler() local_unnamed_addr #1 { entry: - %error_message = tail call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i64 0, i64 0), i8* %error_message - tail call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = tail call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + tail call void @panic_str(i32 70002, ptr nonnull %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() local_unnamed_addr +declare ptr @gpu_get_error() local_unnamed_addr ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) local_unnamed_addr #2 +declare void @panic_str(i32, ptr) local_unnamed_addr #2 -declare i8 @gpu_get_function_id(i8*, i64*) local_unnamed_addr +declare i8 @gpu_get_function_id(ptr, ptr) local_unnamed_addr ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_int() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -106,94 +106,90 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name.1, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name.1, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_int, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_int, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_int, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_int, align 8 br label %common.ret } -declare i8 @gpu_init(i64, i64*) local_unnamed_addr +declare i8 @gpu_init(i64, ptr) local_unnamed_addr -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) local_unnamed_addr +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) local_unnamed_addr -declare i8 @gpu_get_result(i64, i64, i8*) local_unnamed_addr +declare i8 @gpu_get_result(i64, i64, ptr) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr declare i8 @gpu_discard(i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: %gpu_ref_ptr.i = alloca i64, align 8 - %gpu_input_blob.i = alloca <2 x i64>, align 16 + %gpu_input_blob.i = alloca [16 x i8], align 8 %int_result.i = alloca i64, align 8 - %gpu_input_blob26.i = alloca i64, align 8 - %int_result32.i = alloca i64, align 8 + %gpu_input_blob24.i = alloca [8 x i8], align 8 + %int_result28.i = alloca i64, align 8 tail call void @setup(i64 %0) - %1 = bitcast i64* %gpu_ref_ptr.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %1) - %2 = bitcast <2 x i64>* %gpu_input_blob.i to i8* - call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %2) - %3 = bitcast i64* %int_result.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) - %4 = bitcast i64* %gpu_input_blob26.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %4) - %5 = bitcast i64* %int_result32.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %5) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result28.i) %function_id_call.i = tail call i64 @gpu_function_id_fn_returning_float() %function_id_call3.i = tail call i64 @gpu_function_id_fn_returning_int() tail call void @run_gpu_validation() - %gpu_ref_call.i = call i8 @gpu_init(i64 0, i64* nonnull %gpu_ref_ptr.i) + %gpu_ref_call.i = call i8 @gpu_init(i64 0, ptr nonnull %gpu_ref_ptr.i) call void @validate_gpu_response(i8 %gpu_ref_call.i) - %gpu_ref.i = load i64, i64* %gpu_ref_ptr.i, align 8 - store <2 x i64> , <2 x i64>* %gpu_input_blob.i, align 16 - %6 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, i8* nonnull %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @arg_types, i64 0, i64 0)) - call void @validate_gpu_response(i8 %6) - %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %3) + %gpu_ref.i = load i64, ptr %gpu_ref_ptr.i, align 8 + store i64 42, ptr %gpu_input_blob.i, align 8 + %dest_ptr17.i = getelementptr inbounds nuw i8, ptr %gpu_input_blob.i, i64 8 + store i64 4613303441197561744, ptr %dest_ptr17.i, align 8 + %1 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, ptr nonnull %gpu_input_blob.i, ptr nonnull @arg_types) + call void @validate_gpu_response(i8 %1) + %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result.i) call void @validate_gpu_response(i8 %read_status.i) - %int_result20.i = load i64, i64* %int_result.i, align 8 - call void @print_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @res_a.19FB4E83.0, i64 0, i64 0), i64 10, i64 %int_result20.i) - store i64 %int_result20.i, i64* %gpu_input_blob26.i, align 8 - %7 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, i8* nonnull %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @arg_types.2, i64 0, i64 0)) - call void @validate_gpu_response(i8 %7) - %read_status34.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %5) - call void @validate_gpu_response(i8 %read_status34.i) - %float_result_ptr.i = bitcast i64* %int_result32.i to double* - %float_result.i = load double, double* %float_result_ptr.i, align 8 - %8 = call i8 @gpu_discard(i64 %gpu_ref.i) - call void @validate_gpu_response(i8 %8) - call void @print_float(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_b.0E048F9C.0, i64 0, i64 0), i64 12, double %float_result.i) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) - call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %2) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %4) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) - %9 = call i64 @teardown() - ret i64 %9 + %result.i = load i64, ptr %int_result.i, align 8 + call void @print_int(ptr nonnull @res_a.19FB4E83.0, i64 10, i64 %result.i) + store i64 %result.i, ptr %gpu_input_blob24.i, align 8 + %2 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, ptr nonnull %gpu_input_blob24.i, ptr nonnull @arg_types.2) + call void @validate_gpu_response(i8 %2) + %read_status29.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result28.i) + call void @validate_gpu_response(i8 %read_status29.i) + %result30.i = load double, ptr %int_result28.i, align 8 + %3 = call i8 @gpu_discard(i64 %gpu_ref.i) + call void @validate_gpu_response(i8 %3) + call void @print_float(ptr nonnull @res_b.0E048F9C.0, i64 12, double %result30.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result28.i) + %4 = call i64 @teardown() + ret i64 %4 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #3 -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #3 attributes #0 = { noinline } attributes #1 = { noinline noreturn } attributes #2 = { noreturn } -attributes #3 = { argmemonly nofree nosync nounwind willreturn } +attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } !name = !{!0} diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-unknown-linux-gnu/gpu_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-unknown-linux-gnu/gpu_x86_64-unknown-linux-gnu index bbb9f1bd3..49dbc01c1 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-unknown-linux-gnu/gpu_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-unknown-linux-gnu/gpu_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @gpu_cache_is_set_function_id_fn_returning_float = thread_local local_unnamed_addr global i8 0 @@ -19,7 +19,7 @@ target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_float() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -30,22 +30,22 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @function_name, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_float, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_float, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_float, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_float, align 8 br label %common.ret } ; Function Attrs: noinline define void @run_gpu_validation() local_unnamed_addr #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated.not = icmp eq i8 %validated, 0 br i1 %already_validated.not, label %validate, label %common.ret @@ -55,7 +55,7 @@ common.ret: ; preds = %entry, %validate validate: ; preds = %entry %validate_call = tail call i8 @gpu_validate_api(i64 0, i64 1, i64 0) tail call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 br label %common.ret } @@ -78,24 +78,24 @@ err: ; preds = %entry ; Function Attrs: noinline noreturn define void @gpu_error_handler() local_unnamed_addr #1 { entry: - %error_message = tail call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i64 0, i64 0), i8* %error_message - tail call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = tail call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + tail call void @panic_str(i32 70002, ptr nonnull %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() local_unnamed_addr +declare ptr @gpu_get_error() local_unnamed_addr ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) local_unnamed_addr #2 +declare void @panic_str(i32, ptr) local_unnamed_addr #2 -declare i8 @gpu_get_function_id(i8*, i64*) local_unnamed_addr +declare i8 @gpu_get_function_id(ptr, ptr) local_unnamed_addr ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_int() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -106,94 +106,90 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name.1, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name.1, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_int, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_int, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_int, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_int, align 8 br label %common.ret } -declare i8 @gpu_init(i64, i64*) local_unnamed_addr +declare i8 @gpu_init(i64, ptr) local_unnamed_addr -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) local_unnamed_addr +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) local_unnamed_addr -declare i8 @gpu_get_result(i64, i64, i8*) local_unnamed_addr +declare i8 @gpu_get_result(i64, i64, ptr) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr declare i8 @gpu_discard(i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: %gpu_ref_ptr.i = alloca i64, align 8 - %gpu_input_blob.i = alloca <2 x i64>, align 16 + %gpu_input_blob.i = alloca [16 x i8], align 8 %int_result.i = alloca i64, align 8 - %gpu_input_blob26.i = alloca i64, align 8 - %int_result32.i = alloca i64, align 8 + %gpu_input_blob24.i = alloca [8 x i8], align 8 + %int_result28.i = alloca i64, align 8 tail call void @setup(i64 %0) - %1 = bitcast i64* %gpu_ref_ptr.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %1) - %2 = bitcast <2 x i64>* %gpu_input_blob.i to i8* - call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %2) - %3 = bitcast i64* %int_result.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) - %4 = bitcast i64* %gpu_input_blob26.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %4) - %5 = bitcast i64* %int_result32.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %5) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result28.i) %function_id_call.i = tail call i64 @gpu_function_id_fn_returning_float() %function_id_call3.i = tail call i64 @gpu_function_id_fn_returning_int() tail call void @run_gpu_validation() - %gpu_ref_call.i = call i8 @gpu_init(i64 0, i64* nonnull %gpu_ref_ptr.i) + %gpu_ref_call.i = call i8 @gpu_init(i64 0, ptr nonnull %gpu_ref_ptr.i) call void @validate_gpu_response(i8 %gpu_ref_call.i) - %gpu_ref.i = load i64, i64* %gpu_ref_ptr.i, align 8 - store <2 x i64> , <2 x i64>* %gpu_input_blob.i, align 16 - %6 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, i8* nonnull %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @arg_types, i64 0, i64 0)) - call void @validate_gpu_response(i8 %6) - %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %3) + %gpu_ref.i = load i64, ptr %gpu_ref_ptr.i, align 8 + store i64 42, ptr %gpu_input_blob.i, align 8 + %dest_ptr17.i = getelementptr inbounds nuw i8, ptr %gpu_input_blob.i, i64 8 + store i64 4613303441197561744, ptr %dest_ptr17.i, align 8 + %1 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, ptr nonnull %gpu_input_blob.i, ptr nonnull @arg_types) + call void @validate_gpu_response(i8 %1) + %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result.i) call void @validate_gpu_response(i8 %read_status.i) - %int_result20.i = load i64, i64* %int_result.i, align 8 - call void @print_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @res_a.19FB4E83.0, i64 0, i64 0), i64 10, i64 %int_result20.i) - store i64 %int_result20.i, i64* %gpu_input_blob26.i, align 8 - %7 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, i8* nonnull %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @arg_types.2, i64 0, i64 0)) - call void @validate_gpu_response(i8 %7) - %read_status34.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %5) - call void @validate_gpu_response(i8 %read_status34.i) - %float_result_ptr.i = bitcast i64* %int_result32.i to double* - %float_result.i = load double, double* %float_result_ptr.i, align 8 - %8 = call i8 @gpu_discard(i64 %gpu_ref.i) - call void @validate_gpu_response(i8 %8) - call void @print_float(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_b.0E048F9C.0, i64 0, i64 0), i64 12, double %float_result.i) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) - call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %2) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %4) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) - %9 = call i64 @teardown() - ret i64 %9 + %result.i = load i64, ptr %int_result.i, align 8 + call void @print_int(ptr nonnull @res_a.19FB4E83.0, i64 10, i64 %result.i) + store i64 %result.i, ptr %gpu_input_blob24.i, align 8 + %2 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, ptr nonnull %gpu_input_blob24.i, ptr nonnull @arg_types.2) + call void @validate_gpu_response(i8 %2) + %read_status29.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result28.i) + call void @validate_gpu_response(i8 %read_status29.i) + %result30.i = load double, ptr %int_result28.i, align 8 + %3 = call i8 @gpu_discard(i64 %gpu_ref.i) + call void @validate_gpu_response(i8 %3) + call void @print_float(ptr nonnull @res_b.0E048F9C.0, i64 12, double %result30.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result28.i) + %4 = call i64 @teardown() + ret i64 %4 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #3 -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #3 attributes #0 = { noinline } attributes #1 = { noinline noreturn } attributes #2 = { noreturn } -attributes #3 = { argmemonly nofree nosync nounwind willreturn } +attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } !name = !{!0} diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-windows-msvc/gpu_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-windows-msvc/gpu_x86_64-windows-msvc index 8ce8f41e3..37f4ec9f3 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-windows-msvc/gpu_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_gpu/x86_64-windows-msvc/gpu_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @gpu_cache_is_set_function_id_fn_returning_float = thread_local local_unnamed_addr global i8 0 @@ -19,7 +19,7 @@ target triple = "x86_64-windows-msvc" ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_float() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -30,22 +30,22 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @function_name, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_float, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_float, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_float, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_float, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_float, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_float, align 8 br label %common.ret } ; Function Attrs: noinline define void @run_gpu_validation() local_unnamed_addr #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated.not = icmp eq i8 %validated, 0 br i1 %already_validated.not, label %validate, label %common.ret @@ -55,7 +55,7 @@ common.ret: ; preds = %entry, %validate validate: ; preds = %entry %validate_call = tail call i8 @gpu_validate_api(i64 0, i64 1, i64 0) tail call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 br label %common.ret } @@ -78,24 +78,24 @@ err: ; preds = %entry ; Function Attrs: noinline noreturn define void @gpu_error_handler() local_unnamed_addr #1 { entry: - %error_message = tail call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i64 0, i64 0), i8* %error_message - tail call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = tail call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + tail call void @panic_str(i32 70002, ptr nonnull %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() local_unnamed_addr +declare ptr @gpu_get_error() local_unnamed_addr ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) local_unnamed_addr #2 +declare void @panic_str(i32, ptr) local_unnamed_addr #2 -declare i8 @gpu_get_function_id(i8*, i64*) local_unnamed_addr +declare i8 @gpu_get_function_id(ptr, ptr) local_unnamed_addr ; Function Attrs: noinline define i64 @gpu_function_id_fn_returning_int() local_unnamed_addr #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache @@ -106,94 +106,90 @@ common.ret: ; preds = %read_cache, %lookup lookup: ; preds = %entry tail call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name.1, i64 0, i64 0), i64* nonnull %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr nonnull @function_name.1, ptr nonnull %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 8 - store i64 %function_id2, i64* @gpu_cache_function_id_fn_returning_int, align 8 - store i8 1, i8* @gpu_cache_is_set_function_id_fn_returning_int, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 8 + store i64 %function_id2, ptr @gpu_cache_function_id_fn_returning_int, align 8 + store i8 1, ptr @gpu_cache_is_set_function_id_fn_returning_int, align 1 br label %common.ret read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_fn_returning_int, align 8 + %function_id1 = load i64, ptr @gpu_cache_function_id_fn_returning_int, align 8 br label %common.ret } -declare i8 @gpu_init(i64, i64*) local_unnamed_addr +declare i8 @gpu_init(i64, ptr) local_unnamed_addr -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) local_unnamed_addr +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) local_unnamed_addr -declare i8 @gpu_get_result(i64, i64, i8*) local_unnamed_addr +declare i8 @gpu_get_result(i64, i64, ptr) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr declare i8 @gpu_discard(i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: %gpu_ref_ptr.i = alloca i64, align 8 - %gpu_input_blob.i = alloca <2 x i64>, align 16 + %gpu_input_blob.i = alloca [16 x i8], align 8 %int_result.i = alloca i64, align 8 - %gpu_input_blob26.i = alloca i64, align 8 - %int_result32.i = alloca i64, align 8 + %gpu_input_blob24.i = alloca [8 x i8], align 8 + %int_result28.i = alloca i64, align 8 tail call void @setup(i64 %0) - %1 = bitcast i64* %gpu_ref_ptr.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %1) - %2 = bitcast <2 x i64>* %gpu_input_blob.i to i8* - call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %2) - %3 = bitcast i64* %int_result.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) - %4 = bitcast i64* %gpu_input_blob26.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %4) - %5 = bitcast i64* %int_result32.i to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %5) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %int_result28.i) %function_id_call.i = tail call i64 @gpu_function_id_fn_returning_float() %function_id_call3.i = tail call i64 @gpu_function_id_fn_returning_int() tail call void @run_gpu_validation() - %gpu_ref_call.i = call i8 @gpu_init(i64 0, i64* nonnull %gpu_ref_ptr.i) + %gpu_ref_call.i = call i8 @gpu_init(i64 0, ptr nonnull %gpu_ref_ptr.i) call void @validate_gpu_response(i8 %gpu_ref_call.i) - %gpu_ref.i = load i64, i64* %gpu_ref_ptr.i, align 8 - store <2 x i64> , <2 x i64>* %gpu_input_blob.i, align 16 - %6 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, i8* nonnull %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @arg_types, i64 0, i64 0)) - call void @validate_gpu_response(i8 %6) - %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %3) + %gpu_ref.i = load i64, ptr %gpu_ref_ptr.i, align 8 + store i64 42, ptr %gpu_input_blob.i, align 8 + %dest_ptr17.i = getelementptr inbounds nuw i8, ptr %gpu_input_blob.i, i64 8 + store i64 4613303441197561744, ptr %dest_ptr17.i, align 8 + %1 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call3.i, i64 16, ptr nonnull %gpu_input_blob.i, ptr nonnull @arg_types) + call void @validate_gpu_response(i8 %1) + %read_status.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result.i) call void @validate_gpu_response(i8 %read_status.i) - %int_result20.i = load i64, i64* %int_result.i, align 8 - call void @print_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @res_a.19FB4E83.0, i64 0, i64 0), i64 10, i64 %int_result20.i) - store i64 %int_result20.i, i64* %gpu_input_blob26.i, align 8 - %7 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, i8* nonnull %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @arg_types.2, i64 0, i64 0)) - call void @validate_gpu_response(i8 %7) - %read_status34.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, i8* nonnull %5) - call void @validate_gpu_response(i8 %read_status34.i) - %float_result_ptr.i = bitcast i64* %int_result32.i to double* - %float_result.i = load double, double* %float_result_ptr.i, align 8 - %8 = call i8 @gpu_discard(i64 %gpu_ref.i) - call void @validate_gpu_response(i8 %8) - call void @print_float(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_b.0E048F9C.0, i64 0, i64 0), i64 12, double %float_result.i) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) - call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %2) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %4) - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) - %9 = call i64 @teardown() - ret i64 %9 + %result.i = load i64, ptr %int_result.i, align 8 + call void @print_int(ptr nonnull @res_a.19FB4E83.0, i64 10, i64 %result.i) + store i64 %result.i, ptr %gpu_input_blob24.i, align 8 + %2 = call i8 @gpu_call(i64 %gpu_ref.i, i64 %function_id_call.i, i64 8, ptr nonnull %gpu_input_blob24.i, ptr nonnull @arg_types.2) + call void @validate_gpu_response(i8 %2) + %read_status29.i = call i8 @gpu_get_result(i64 %gpu_ref.i, i64 8, ptr nonnull %int_result28.i) + call void @validate_gpu_response(i8 %read_status29.i) + %result30.i = load double, ptr %int_result28.i, align 8 + %3 = call i8 @gpu_discard(i64 %gpu_ref.i) + call void @validate_gpu_response(i8 %3) + call void @print_float(ptr nonnull @res_b.0E048F9C.0, i64 12, double %result30.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_ref_ptr.i) + call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %gpu_input_blob.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %gpu_input_blob24.i) + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %int_result28.i) + %4 = call i64 @teardown() + ret i64 %4 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #3 -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #3 +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #3 attributes #0 = { noinline } attributes #1 = { noinline noreturn } attributes #2 = { noreturn } -attributes #3 = { argmemonly nofree nosync nounwind willreturn } +attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } !name = !{!0} diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-discard_qb_array/discard_qb_array_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-discard_qb_array/discard_qb_array_aarch64-apple-darwin index 53dd081c0..65da73d47 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-discard_qb_array/discard_qb_array_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-discard_qb_array/discard_qb_array_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,14 +8,14 @@ target triple = "aarch64-apple-darwin" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___qfree(i64) local_unnamed_addr -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -24,194 +24,264 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0114.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0114.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_211_case_0.i.i - -cond_211_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_211_case_0.i.i: ; preds = %cond_exit_20.8.i, %cond_exit_20.7.i, %cond_exit_20.6.i, %cond_exit_20.5.i, %cond_exit_20.4.i, %cond_exit_20.3.i, %cond_exit_20.2.i, %cond_exit_20.1.i, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0114.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0114.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__hugr__.__tk2_qalloc.216.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.9.i, %__hugr__.__tk2_qalloc.216.exit.8.i, %__hugr__.__tk2_qalloc.216.exit.7.i, %__hugr__.__tk2_qalloc.216.exit.6.i, %__hugr__.__tk2_qalloc.216.exit.5.i, %__hugr__.__tk2_qalloc.216.exit.4.i, %__hugr__.__tk2_qalloc.216.exit.3.i, %__hugr__.__tk2_qalloc.216.exit.2.i, %__hugr__.__tk2_qalloc.216.exit.1.i, %__hugr__.__tk2_qalloc.216.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0114.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.preheader.preheader.i, label %cond_20_case_1.i - -loop_out.preheader.preheader.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i99.i.i.i = icmp eq i64 %16, 0 - br i1 %.not.i99.i.i.i, label %cond_380_case_1.i.i, label %panic.i.i.i.i - -mask_block_err.i.i.i.i: ; preds = %cond_380_case_1.i.9.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) +cond_exit_20.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.i + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.1.i = tail call i64 @___qalloc() + %not_max.not.not.i.1.i = icmp eq i64 %qalloc.i.1.i, -1 + br i1 %not_max.not.not.i.1.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.1.i + +__hugr__.__tk2_qalloc.216.exit.1.i: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.1.i) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not.i = icmp eq i64 %7, 0 + br i1 %.not.i, label %panic.i.i, label %cond_exit_20.1.i + +cond_exit_20.1.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.1.i + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.1.i, ptr %9, align 4 + %qalloc.i.2.i = tail call i64 @___qalloc() + %not_max.not.not.i.2.i = icmp eq i64 %qalloc.i.2.i, -1 + br i1 %not_max.not.not.i.2.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.2.i + +__hugr__.__tk2_qalloc.216.exit.2.i: ; preds = %cond_exit_20.1.i + tail call void @___reset(i64 %qalloc.i.2.i) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not115.i = icmp eq i64 %11, 0 + br i1 %.not115.i, label %panic.i.i, label %cond_exit_20.2.i + +cond_exit_20.2.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.2.i + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.2.i, ptr %13, align 4 + %qalloc.i.3.i = tail call i64 @___qalloc() + %not_max.not.not.i.3.i = icmp eq i64 %qalloc.i.3.i, -1 + br i1 %not_max.not.not.i.3.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.3.i + +__hugr__.__tk2_qalloc.216.exit.3.i: ; preds = %cond_exit_20.2.i + tail call void @___reset(i64 %qalloc.i.3.i) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not116.i = icmp eq i64 %15, 0 + br i1 %.not116.i, label %panic.i.i, label %cond_exit_20.3.i + +cond_exit_20.3.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.3.i + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.3.i, ptr %17, align 4 + %qalloc.i.4.i = tail call i64 @___qalloc() + %not_max.not.not.i.4.i = icmp eq i64 %qalloc.i.4.i, -1 + br i1 %not_max.not.not.i.4.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.4.i + +__hugr__.__tk2_qalloc.216.exit.4.i: ; preds = %cond_exit_20.3.i + tail call void @___reset(i64 %qalloc.i.4.i) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not117.i = icmp eq i64 %19, 0 + br i1 %.not117.i, label %panic.i.i, label %cond_exit_20.4.i + +cond_exit_20.4.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.4.i + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.4.i, ptr %21, align 4 + %qalloc.i.5.i = tail call i64 @___qalloc() + %not_max.not.not.i.5.i = icmp eq i64 %qalloc.i.5.i, -1 + br i1 %not_max.not.not.i.5.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.5.i + +__hugr__.__tk2_qalloc.216.exit.5.i: ; preds = %cond_exit_20.4.i + tail call void @___reset(i64 %qalloc.i.5.i) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not118.i = icmp eq i64 %23, 0 + br i1 %.not118.i, label %panic.i.i, label %cond_exit_20.5.i + +cond_exit_20.5.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.5.i + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.5.i, ptr %25, align 4 + %qalloc.i.6.i = tail call i64 @___qalloc() + %not_max.not.not.i.6.i = icmp eq i64 %qalloc.i.6.i, -1 + br i1 %not_max.not.not.i.6.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.6.i + +__hugr__.__tk2_qalloc.216.exit.6.i: ; preds = %cond_exit_20.5.i + tail call void @___reset(i64 %qalloc.i.6.i) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not119.i = icmp eq i64 %27, 0 + br i1 %.not119.i, label %panic.i.i, label %cond_exit_20.6.i + +cond_exit_20.6.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.6.i + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.6.i, ptr %29, align 4 + %qalloc.i.7.i = tail call i64 @___qalloc() + %not_max.not.not.i.7.i = icmp eq i64 %qalloc.i.7.i, -1 + br i1 %not_max.not.not.i.7.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.7.i + +__hugr__.__tk2_qalloc.216.exit.7.i: ; preds = %cond_exit_20.6.i + tail call void @___reset(i64 %qalloc.i.7.i) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not120.i = icmp eq i64 %31, 0 + br i1 %.not120.i, label %panic.i.i, label %cond_exit_20.7.i + +cond_exit_20.7.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.7.i + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.7.i, ptr %33, align 4 + %qalloc.i.8.i = tail call i64 @___qalloc() + %not_max.not.not.i.8.i = icmp eq i64 %qalloc.i.8.i, -1 + br i1 %not_max.not.not.i.8.i, label %cond_211_case_0.i.i, label %__hugr__.__tk2_qalloc.216.exit.8.i + +__hugr__.__tk2_qalloc.216.exit.8.i: ; preds = %cond_exit_20.7.i + tail call void @___reset(i64 %qalloc.i.8.i) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not121.i = icmp eq i64 %35, 0 + br i1 %.not121.i, label %panic.i.i, label %cond_exit_20.8.i + +cond_exit_20.8.i: ; preds = %__hugr__.__tk2_qalloc.216.exit.8.i + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.8.i, ptr %37, align 4 + %qalloc.i.9.i = tail call i64 @___qalloc() + %not_max.not.not.i.9.i = icmp eq i64 %qalloc.i.9.i, -1 + br i1 %not_max.not.not.i.9.i, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %cond_exit_20.8.i + tail call void @___reset(i64 %qalloc.i.9.i) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not122.i = icmp eq i64 %39, 0 + br i1 %.not122.i, label %panic.i.i, label %cond_exit_20.9.i + +cond_exit_20.9.i: ; preds = %__barray_check_bounds.exit.9.i + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.9.i, ptr %41, align 4 + %"120.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"120.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.0.insert.i", ptr %2, 1 + %"120.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.1.insert.i", i64 0, 2 + %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"120.fca.2.insert.i", 0 + br label %__barray_check_bounds.exit.i.i.i + +43: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + %44 = lshr i64 %.fca.1.0.0.2.extract.i.i.i, 6 + %45 = getelementptr i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %44 + %46 = load i64, ptr %45, align 4 + %47 = and i64 %.fca.1.0.0.2.extract.i.i.i, 63 + %48 = sub nuw nsw i64 64, %47 + %49 = lshr i64 -1, %48 + %50 = icmp eq i64 %47, 0 + %51 = select i1 %50, i64 0, i64 %49 + %52 = or i64 %46, %51 + store i64 %52, ptr %45, align 4 + %last_valid.i.i.i.i = add i64 %.fca.1.0.0.2.extract.i.i.i, 9 + %53 = lshr i64 %last_valid.i.i.i.i, 6 + %54 = getelementptr inbounds nuw i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %53 + %55 = load i64, ptr %54, align 4 + %56 = and i64 %last_valid.i.i.i.i, 63 + %57 = shl nsw i64 -2, %56 + %58 = icmp eq i64 %56, 63 + %59 = select i1 %58, i64 0, i64 %57 + %60 = or i64 %55, %59 + store i64 %60, ptr %54, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %53, %44 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +61: ; preds = %mask_block_ok.i.i.i.i + %62 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %43, %61 + %.02.i.i.i.i = phi i64 [ %62, %61 ], [ 0, %43 ] + %gep.i.i.i.i = getelementptr i64, ptr %45, i64 %.02.i.i.i.i + %63 = load i64, ptr %gep.i.i.i.i, align 4 + %64 = icmp eq i64 %63, -1 + br i1 %64, label %61, label %mask_block_err.i.i.i.i + +mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -panic.i.i.i.i: ; preds = %cond_380_case_1.i.8.i, %cond_380_case_1.i.7.i, %cond_380_case_1.i.6.i, %cond_380_case_1.i.5.i, %cond_380_case_1.i.4.i, %cond_380_case_1.i.3.i, %cond_380_case_1.i.2.i, %cond_380_case_1.i.1.i, %cond_380_case_1.i.i, %loop_out.preheader.preheader.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i", %cond_exit_20.9.i + %.fca.2.extract83.i185.i.i = phi i64 [ 0, %cond_exit_20.9.i ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.1.extract82.i184.i.i = phi ptr [ %2, %cond_exit_20.9.i ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.0.extract81.i183.i.i = phi ptr [ %1, %cond_exit_20.9.i ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %"291_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.9.i ], [ %72, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.9.i ], [ %80, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %65 = add i64 %"291_0.0182.i.i", %.fca.2.extract83.i185.i.i + %66 = lshr i64 %65, 6 + %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i184.i.i, i64 %66 + %68 = load i64, ptr %67, align 4 + %69 = and i64 %65, 63 + %70 = lshr i64 %68, %69 + %71 = trunc i64 %70 to i1 + br i1 %71, label %panic.i.i.i.i, label %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -cond_380_case_1.i.i: ; preds = %loop_out.preheader.preheader.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___qfree(i64 %18) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 2 - %.not.i99.i.i.1.i = icmp eq i64 %20, 0 - br i1 %.not.i99.i.i.1.i, label %cond_380_case_1.i.1.i, label %panic.i.i.i.i - -cond_380_case_1.i.1.i: ; preds = %cond_380_case_1.i.i - %21 = xor i64 %19, 2 - store i64 %21, i64* %4, align 4 - %22 = getelementptr inbounds i8, i8* %1, i64 8 - %23 = bitcast i8* %22 to i64* - %24 = load i64, i64* %23, align 4 - tail call void @___qfree(i64 %24) - %25 = load i64, i64* %4, align 4 - %26 = and i64 %25, 4 - %.not.i99.i.i.2.i = icmp eq i64 %26, 0 - br i1 %.not.i99.i.i.2.i, label %cond_380_case_1.i.2.i, label %panic.i.i.i.i - -cond_380_case_1.i.2.i: ; preds = %cond_380_case_1.i.1.i - %27 = xor i64 %25, 4 - store i64 %27, i64* %4, align 4 - %28 = getelementptr inbounds i8, i8* %1, i64 16 - %29 = bitcast i8* %28 to i64* - %30 = load i64, i64* %29, align 4 - tail call void @___qfree(i64 %30) - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i99.i.i.3.i = icmp eq i64 %32, 0 - br i1 %.not.i99.i.i.3.i, label %cond_380_case_1.i.3.i, label %panic.i.i.i.i - -cond_380_case_1.i.3.i: ; preds = %cond_380_case_1.i.2.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___qfree(i64 %36) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 16 - %.not.i99.i.i.4.i = icmp eq i64 %38, 0 - br i1 %.not.i99.i.i.4.i, label %cond_380_case_1.i.4.i, label %panic.i.i.i.i - -cond_380_case_1.i.4.i: ; preds = %cond_380_case_1.i.3.i - %39 = xor i64 %37, 16 - store i64 %39, i64* %4, align 4 - %40 = getelementptr inbounds i8, i8* %1, i64 32 - %41 = bitcast i8* %40 to i64* - %42 = load i64, i64* %41, align 4 - tail call void @___qfree(i64 %42) - %43 = load i64, i64* %4, align 4 - %44 = and i64 %43, 32 - %.not.i99.i.i.5.i = icmp eq i64 %44, 0 - br i1 %.not.i99.i.i.5.i, label %cond_380_case_1.i.5.i, label %panic.i.i.i.i - -cond_380_case_1.i.5.i: ; preds = %cond_380_case_1.i.4.i - %45 = xor i64 %43, 32 - store i64 %45, i64* %4, align 4 - %46 = getelementptr inbounds i8, i8* %1, i64 40 - %47 = bitcast i8* %46 to i64* - %48 = load i64, i64* %47, align 4 - tail call void @___qfree(i64 %48) - %49 = load i64, i64* %4, align 4 - %50 = and i64 %49, 64 - %.not.i99.i.i.6.i = icmp eq i64 %50, 0 - br i1 %.not.i99.i.i.6.i, label %cond_380_case_1.i.6.i, label %panic.i.i.i.i - -cond_380_case_1.i.6.i: ; preds = %cond_380_case_1.i.5.i - %51 = xor i64 %49, 64 - store i64 %51, i64* %4, align 4 - %52 = getelementptr inbounds i8, i8* %1, i64 48 - %53 = bitcast i8* %52 to i64* - %54 = load i64, i64* %53, align 4 - tail call void @___qfree(i64 %54) - %55 = load i64, i64* %4, align 4 - %56 = and i64 %55, 128 - %.not.i99.i.i.7.i = icmp eq i64 %56, 0 - br i1 %.not.i99.i.i.7.i, label %cond_380_case_1.i.7.i, label %panic.i.i.i.i - -cond_380_case_1.i.7.i: ; preds = %cond_380_case_1.i.6.i - %57 = xor i64 %55, 128 - store i64 %57, i64* %4, align 4 - %58 = getelementptr inbounds i8, i8* %1, i64 56 - %59 = bitcast i8* %58 to i64* - %60 = load i64, i64* %59, align 4 - tail call void @___qfree(i64 %60) - %61 = load i64, i64* %4, align 4 - %62 = and i64 %61, 256 - %.not.i99.i.i.8.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.8.i, label %cond_380_case_1.i.8.i, label %panic.i.i.i.i - -cond_380_case_1.i.8.i: ; preds = %cond_380_case_1.i.7.i - %63 = xor i64 %61, 256 - store i64 %63, i64* %4, align 4 - %64 = getelementptr inbounds i8, i8* %1, i64 64 - %65 = bitcast i8* %64 to i64* - %66 = load i64, i64* %65, align 4 - tail call void @___qfree(i64 %66) - %67 = load i64, i64* %4, align 4 - %68 = and i64 %67, 512 - %.not.i99.i.i.9.i = icmp eq i64 %68, 0 - br i1 %.not.i99.i.i.9.i, label %cond_380_case_1.i.9.i, label %panic.i.i.i.i - -cond_380_case_1.i.9.i: ; preds = %cond_380_case_1.i.8.i - %69 = xor i64 %67, 512 - store i64 %69, i64* %4, align 4 - %70 = getelementptr inbounds i8, i8* %1, i64 72 - %71 = bitcast i8* %70 to i64* - %72 = load i64, i64* %71, align 4 - tail call void @___qfree(i64 %72) - %73 = load i64, i64* %4, align 4 - %74 = or i64 %73, -1024 - store i64 %74, i64* %4, align 4 - %75 = icmp eq i64 %74, -1 - br i1 %75, label %__hugr__.main.1.exit, label %mask_block_err.i.i.i.i - -__hugr__.main.1.exit: ; preds = %cond_380_case_1.i.9.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - %76 = tail call i64 @teardown() - ret i64 %76 +"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i + %72 = add nuw nsw i64 %"291_0.0182.i.i", 1 + %73 = shl nuw i64 1, %69 + %74 = xor i64 %73, %68 + store i64 %74, ptr %67, align 4 + %75 = getelementptr inbounds i64, ptr %.fca.0.extract81.i183.i.i, i64 %65 + %76 = load i64, ptr %75, align 4 + %.fca.1.0.0.0.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 0 + %.fca.1.0.0.1.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 1 + %.fca.1.0.0.2.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 2 + %77 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, i64 %72, 1 + %78 = insertvalue { { ptr, ptr, i64 }, i64 } %77, ptr %.fca.1.0.0.0.extract.i.i.i, 0, 0 + %79 = insertvalue { { ptr, ptr, i64 }, i64 } %78, ptr %.fca.1.0.0.1.extract.i.i.i, 0, 1 + %80 = insertvalue { { ptr, ptr, i64 }, i64 } %79, i64 %.fca.1.0.0.2.extract.i.i.i, 0, 2 + tail call void @___qfree(i64 %76) + %.not.i.i = icmp eq i64 %"291_0.0182.i.i", 9 + br i1 %.not.i.i, label %43, label %__barray_check_bounds.exit.i.i.i + +__hugr__.main.1.exit: ; preds = %61, %43 + tail call void @heap_free(ptr %.fca.1.0.0.0.extract.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.0.0.1.extract.i.i.i) + %81 = tail call i64 @teardown() + ret i64 %81 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-flip_some/flip_some_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-flip_some/flip_some_aarch64-apple-darwin index 2563f234e..938ef7cb9 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-flip_some/flip_some_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-flip_some/flip_some_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @res_c0.7C14CD6E.0 = private constant [13 x i8] c"\0CUSER:BOOL:c0" @@ -17,14 +17,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -32,110 +32,70 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_40_case_0.i.i, label %__hugr__.__tk2_qalloc.36.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.36.exit.i, label %cond_40_case_0.i.i - -cond_40_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_40_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.36.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) +__hugr__.__tk2_qalloc.36.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) %qalloc.i101.i = tail call i64 @___qalloc() - %not_max.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 - br i1 %not_max.not.i102.i, label %id_bb.i105.i, label %reset_bb.i103.i - -reset_bb.i103.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i - tail call void @___reset(i64 %qalloc.i101.i) - br label %id_bb.i105.i + %not_max.not.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 + br i1 %not_max.not.not.i102.i, label %cond_54_case_0.i.i, label %__hugr__.__tk2_qalloc.50.exit.i -id_bb.i105.i: ; preds = %reset_bb.i103.i, %__hugr__.__tk2_qalloc.36.exit.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i101.i, 1 - %4 = select i1 %not_max.not.i102.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i104.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i104.i, label %__hugr__.__tk2_qalloc.50.exit.i, label %cond_54_case_0.i.i - -cond_54_case_0.i.i: ; preds = %id_bb.i105.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_54_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.50.exit.i: ; preds = %id_bb.i105.i - %.fca.1.extract.i106.i = extractvalue { i1, i64 } %4, 1 - %qalloc.i107.i = tail call i64 @___qalloc() - %not_max.not.i108.i = icmp eq i64 %qalloc.i107.i, -1 - br i1 %not_max.not.i108.i, label %id_bb.i111.i, label %reset_bb.i109.i - -reset_bb.i109.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i - tail call void @___reset(i64 %qalloc.i107.i) - br label %id_bb.i111.i - -id_bb.i111.i: ; preds = %reset_bb.i109.i, %__hugr__.__tk2_qalloc.50.exit.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i107.i, 1 - %6 = select i1 %not_max.not.i108.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i110.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i110.i, label %__hugr__.__tk2_qalloc.64.exit.i, label %cond_68_case_0.i.i +__hugr__.__tk2_qalloc.50.exit.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @___reset(i64 %qalloc.i101.i) + %qalloc.i103.i = tail call i64 @___qalloc() + %not_max.not.not.i104.i = icmp eq i64 %qalloc.i103.i, -1 + br i1 %not_max.not.not.i104.i, label %cond_68_case_0.i.i, label %__hugr__.__tk2_qalloc.64.exit.i -cond_68_case_0.i.i: ; preds = %id_bb.i111.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_68_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.64.exit.i: ; preds = %id_bb.i111.i - %.fca.1.extract.i112.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i112.i, double 0x400921FB54442D18, double 0.000000e+00) - %qalloc.i113.i = tail call i64 @___qalloc() - %not_max.not.i114.i = icmp eq i64 %qalloc.i113.i, -1 - br i1 %not_max.not.i114.i, label %id_bb.i117.i, label %reset_bb.i115.i - -reset_bb.i115.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i - tail call void @___reset(i64 %qalloc.i113.i) - br label %id_bb.i117.i - -id_bb.i117.i: ; preds = %reset_bb.i115.i, %__hugr__.__tk2_qalloc.64.exit.i - %7 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i113.i, 1 - %8 = select i1 %not_max.not.i114.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %7 - %.fca.0.extract.i116.i = extractvalue { i1, i64 } %8, 0 - br i1 %.fca.0.extract.i116.i, label %__hugr__.main.1.exit, label %cond_82_case_0.i.i - -cond_82_case_0.i.i: ; preds = %id_bb.i117.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +__hugr__.__tk2_qalloc.64.exit.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @___reset(i64 %qalloc.i103.i) + tail call void @___rxy(i64 %qalloc.i103.i, double 0x400921FB54442D18, double 0.000000e+00) + %qalloc.i105.i = tail call i64 @___qalloc() + %not_max.not.not.i106.i = icmp eq i64 %qalloc.i105.i, -1 + br i1 %not_max.not.not.i106.i, label %cond_82_case_0.i.i, label %__hugr__.main.1.exit + +cond_82_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.main.1.exit: ; preds = %id_bb.i117.i - %.fca.1.extract.i118.i = extractvalue { i1, i64 } %8, 1 - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @___reset(i64 %qalloc.i105.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c0.7C14CD6E.0, i64 0, i64 0), i64 12, i1 %read_bool.i) - %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i106.i) - tail call void @___qfree(i64 %.fca.1.extract.i106.i) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool.i) + %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %qalloc.i101.i) + tail call void @___qfree(i64 %qalloc.i101.i) %read_bool35.i = tail call i1 @___read_future_bool(i64 %lazy_measure22.i) tail call void @___dec_future_refcount(i64 %lazy_measure22.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c1.1F7A6571.0, i64 0, i64 0), i64 12, i1 %read_bool35.i) - %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i112.i) - tail call void @___qfree(i64 %.fca.1.extract.i112.i) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35.i) + %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %qalloc.i103.i) + tail call void @___qfree(i64 %qalloc.i103.i) %read_bool57.i = tail call i1 @___read_future_bool(i64 %lazy_measure44.i) tail call void @___dec_future_refcount(i64 %lazy_measure44.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c2.60825383.0, i64 0, i64 0), i64 12, i1 %read_bool57.i) - tail call void @___rxy(i64 %.fca.1.extract.i118.i, double 0x400921FB54442D18, double 0.000000e+00) - %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i118.i) - tail call void @___qfree(i64 %.fca.1.extract.i118.i) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57.i) + tail call void @___rxy(i64 %qalloc.i105.i, double 0x400921FB54442D18, double 0.000000e+00) + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i105.i) + tail call void @___qfree(i64 %qalloc.i105.i) %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c3.B223E16D.0, i64 0, i64 0), i64 12, i1 %read_bool80.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-measure_qb_array/measure_qb_array_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-measure_qb_array/measure_qb_array_aarch64-apple-darwin index eae70fc2d..7339917b6 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-measure_qb_array/measure_qb_array_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-measure_qb_array/measure_qb_array_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,12 +8,12 @@ target triple = "aarch64-apple-darwin" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr @@ -30,279 +30,431 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0294.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0294.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i +cond_236_case_0.i.i: ; preds = %cond_exit_20.8.i, %cond_exit_20.7.i, %cond_exit_20.6.i, %cond_exit_20.5.i, %cond_exit_20.4.i, %cond_exit_20.3.i, %cond_exit_20.2.i, %cond_exit_20.1.i, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") + unreachable -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_236_case_0.i.i +__hugr__.__tk2_qalloc.208.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i -cond_236_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +panic.i.i: ; preds = %__barray_check_bounds.exit.9.i, %__hugr__.__tk2_qalloc.208.exit.8.i, %__hugr__.__tk2_qalloc.208.exit.7.i, %__hugr__.__tk2_qalloc.208.exit.6.i, %__hugr__.__tk2_qalloc.208.exit.5.i, %__hugr__.__tk2_qalloc.208.exit.4.i, %__hugr__.__tk2_qalloc.208.exit.3.i, %__hugr__.__tk2_qalloc.208.exit.2.i, %__hugr__.__tk2_qalloc.208.exit.1.i, %__hugr__.__tk2_qalloc.208.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0294.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0294.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +cond_exit_20.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.i + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.1.i = tail call i64 @___qalloc() + %not_max.not.not.i.1.i = icmp eq i64 %qalloc.i.1.i, -1 + br i1 %not_max.not.not.i.1.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.1.i + +__hugr__.__tk2_qalloc.208.exit.1.i: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.1.i) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not301.i = icmp eq i64 %7, 0 + br i1 %.not301.i, label %panic.i.i, label %cond_exit_20.1.i + +cond_exit_20.1.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.1.i + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.1.i, ptr %9, align 4 + %qalloc.i.2.i = tail call i64 @___qalloc() + %not_max.not.not.i.2.i = icmp eq i64 %qalloc.i.2.i, -1 + br i1 %not_max.not.not.i.2.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.2.i + +__hugr__.__tk2_qalloc.208.exit.2.i: ; preds = %cond_exit_20.1.i + tail call void @___reset(i64 %qalloc.i.2.i) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not302.i = icmp eq i64 %11, 0 + br i1 %.not302.i, label %panic.i.i, label %cond_exit_20.2.i + +cond_exit_20.2.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.2.i + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.2.i, ptr %13, align 4 + %qalloc.i.3.i = tail call i64 @___qalloc() + %not_max.not.not.i.3.i = icmp eq i64 %qalloc.i.3.i, -1 + br i1 %not_max.not.not.i.3.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.3.i + +__hugr__.__tk2_qalloc.208.exit.3.i: ; preds = %cond_exit_20.2.i + tail call void @___reset(i64 %qalloc.i.3.i) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not303.i = icmp eq i64 %15, 0 + br i1 %.not303.i, label %panic.i.i, label %cond_exit_20.3.i + +cond_exit_20.3.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.3.i + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.3.i, ptr %17, align 4 + %qalloc.i.4.i = tail call i64 @___qalloc() + %not_max.not.not.i.4.i = icmp eq i64 %qalloc.i.4.i, -1 + br i1 %not_max.not.not.i.4.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.4.i + +__hugr__.__tk2_qalloc.208.exit.4.i: ; preds = %cond_exit_20.3.i + tail call void @___reset(i64 %qalloc.i.4.i) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not304.i = icmp eq i64 %19, 0 + br i1 %.not304.i, label %panic.i.i, label %cond_exit_20.4.i + +cond_exit_20.4.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.4.i + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.4.i, ptr %21, align 4 + %qalloc.i.5.i = tail call i64 @___qalloc() + %not_max.not.not.i.5.i = icmp eq i64 %qalloc.i.5.i, -1 + br i1 %not_max.not.not.i.5.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.5.i + +__hugr__.__tk2_qalloc.208.exit.5.i: ; preds = %cond_exit_20.4.i + tail call void @___reset(i64 %qalloc.i.5.i) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not305.i = icmp eq i64 %23, 0 + br i1 %.not305.i, label %panic.i.i, label %cond_exit_20.5.i + +cond_exit_20.5.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.5.i + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.5.i, ptr %25, align 4 + %qalloc.i.6.i = tail call i64 @___qalloc() + %not_max.not.not.i.6.i = icmp eq i64 %qalloc.i.6.i, -1 + br i1 %not_max.not.not.i.6.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.6.i + +__hugr__.__tk2_qalloc.208.exit.6.i: ; preds = %cond_exit_20.5.i + tail call void @___reset(i64 %qalloc.i.6.i) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not306.i = icmp eq i64 %27, 0 + br i1 %.not306.i, label %panic.i.i, label %cond_exit_20.6.i + +cond_exit_20.6.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.6.i + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.6.i, ptr %29, align 4 + %qalloc.i.7.i = tail call i64 @___qalloc() + %not_max.not.not.i.7.i = icmp eq i64 %qalloc.i.7.i, -1 + br i1 %not_max.not.not.i.7.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.7.i + +__hugr__.__tk2_qalloc.208.exit.7.i: ; preds = %cond_exit_20.6.i + tail call void @___reset(i64 %qalloc.i.7.i) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not307.i = icmp eq i64 %31, 0 + br i1 %.not307.i, label %panic.i.i, label %cond_exit_20.7.i + +cond_exit_20.7.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.7.i + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.7.i, ptr %33, align 4 + %qalloc.i.8.i = tail call i64 @___qalloc() + %not_max.not.not.i.8.i = icmp eq i64 %qalloc.i.8.i, -1 + br i1 %not_max.not.not.i.8.i, label %cond_236_case_0.i.i, label %__hugr__.__tk2_qalloc.208.exit.8.i + +__hugr__.__tk2_qalloc.208.exit.8.i: ; preds = %cond_exit_20.7.i + tail call void @___reset(i64 %qalloc.i.8.i) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not308.i = icmp eq i64 %35, 0 + br i1 %.not308.i, label %panic.i.i, label %cond_exit_20.8.i + +cond_exit_20.8.i: ; preds = %__hugr__.__tk2_qalloc.208.exit.8.i + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.8.i, ptr %37, align 4 + %qalloc.i.9.i = tail call i64 @___qalloc() + %not_max.not.not.i.9.i = icmp eq i64 %qalloc.i.9.i, -1 + br i1 %not_max.not.not.i.9.i, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %cond_exit_20.8.i + tail call void @___reset(i64 %qalloc.i.9.i) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not309.i = icmp eq i64 %39, 0 + br i1 %.not309.i, label %panic.i.i, label %cond_exit_20.9.i + +cond_exit_20.9.i: ; preds = %__barray_check_bounds.exit.9.i + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.9.i, ptr %41, align 4 + %"128.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"128.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.0.insert.i", ptr %2, 1 + %"128.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.1.insert.i", i64 0, 2 + %42 = load i64, ptr %2, align 4 + %43 = trunc i64 %42 to i1 + br i1 %43, label %panic.i257.i, label %__barray_mask_borrow.exit.i + +panic.i257.i: ; preds = %cond_exit_20.9.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0294.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.i, label %cond_20_case_1.i - -loop_out.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i258.i = icmp eq i64 %16, 0 - br i1 %.not.i258.i, label %__barray_mask_borrow.exit.i, label %panic.i259.i - -panic.i259.i: ; preds = %loop_out.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) - unreachable +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.9.i + %44 = or disjoint i64 %42, 1 + store i64 %44, ptr %2, align 4 + %45 = load i64, ptr %1, align 4 + tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) + %46 = load i64, ptr %2, align 4 + %47 = trunc i64 %46 to i1 + br i1 %47, label %__barray_mask_return.exit259.i, label %panic.i258.i -__barray_mask_borrow.exit.i: ; preds = %loop_out.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___rxy(i64 %18, double 0x400921FB54442D18, double 0.000000e+00) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 1 - %.not.i260.i = icmp eq i64 %20, 0 - br i1 %.not.i260.i, label %panic.i261.i, label %__barray_mask_return.exit262.i - -panic.i261.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +panic.i258.i: ; preds = %__barray_mask_borrow.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit262.i: ; preds = %__barray_mask_borrow.exit.i - %21 = xor i64 %19, 1 - store i64 %21, i64* %4, align 4 - store i64 %18, i64* %2, align 4 - %22 = load i64, i64* %4, align 4 - %23 = and i64 %22, 4 - %.not.i263.i = icmp eq i64 %23, 0 - br i1 %.not.i263.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i - -panic.i264.i: ; preds = %__barray_mask_return.exit262.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_return.exit259.i: ; preds = %__barray_mask_borrow.exit.i + %48 = and i64 %46, -2 + store i64 %48, ptr %2, align 4 + store i64 %45, ptr %1, align 4 + %49 = load i64, ptr %2, align 4 + %50 = and i64 %49, 4 + %.not.i = icmp eq i64 %50, 0 + br i1 %.not.i, label %__barray_mask_borrow.exit261.i, label %panic.i260.i + +panic.i260.i: ; preds = %__barray_mask_return.exit259.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit262.i - %24 = xor i64 %22, 4 - store i64 %24, i64* %4, align 4 - %25 = getelementptr inbounds i8, i8* %1, i64 16 - %26 = bitcast i8* %25 to i64* - %27 = load i64, i64* %26, align 4 - tail call void @___rxy(i64 %27, double 0x400921FB54442D18, double 0.000000e+00) - %28 = load i64, i64* %4, align 4 - %29 = and i64 %28, 4 - %.not.i266.i = icmp eq i64 %29, 0 - br i1 %.not.i266.i, label %panic.i267.i, label %__barray_mask_return.exit268.i - -panic.i267.i: ; preds = %__barray_mask_borrow.exit265.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit261.i: ; preds = %__barray_mask_return.exit259.i + %51 = or disjoint i64 %49, 4 + store i64 %51, ptr %2, align 4 + %52 = load i64, ptr %13, align 4 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00) + %53 = load i64, ptr %2, align 4 + %54 = and i64 %53, 4 + %.not289.i = icmp eq i64 %54, 0 + br i1 %.not289.i, label %panic.i262.i, label %__barray_mask_return.exit263.i + +panic.i262.i: ; preds = %__barray_mask_borrow.exit261.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit268.i: ; preds = %__barray_mask_borrow.exit265.i - %30 = xor i64 %28, 4 - store i64 %30, i64* %4, align 4 - store i64 %27, i64* %26, align 4 - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i269.i = icmp eq i64 %32, 0 - br i1 %.not.i269.i, label %__barray_mask_borrow.exit271.i, label %panic.i270.i - -panic.i270.i: ; preds = %__barray_mask_return.exit268.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_return.exit263.i: ; preds = %__barray_mask_borrow.exit261.i + %55 = and i64 %53, -5 + store i64 %55, ptr %2, align 4 + store i64 %52, ptr %13, align 4 + %56 = load i64, ptr %2, align 4 + %57 = and i64 %56, 8 + %.not290.i = icmp eq i64 %57, 0 + br i1 %.not290.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i + +panic.i264.i: ; preds = %__barray_mask_return.exit263.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit271.i: ; preds = %__barray_mask_return.exit268.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___rxy(i64 %36, double 0x400921FB54442D18, double 0.000000e+00) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 8 - %.not.i272.i = icmp eq i64 %38, 0 - br i1 %.not.i272.i, label %panic.i273.i, label %__barray_mask_return.exit274.i - -panic.i273.i: ; preds = %__barray_mask_borrow.exit271.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit263.i + %58 = or disjoint i64 %56, 8 + store i64 %58, ptr %2, align 4 + %59 = load i64, ptr %17, align 4 + tail call void @___rxy(i64 %59, double 0x400921FB54442D18, double 0.000000e+00) + %60 = load i64, ptr %2, align 4 + %61 = and i64 %60, 8 + %.not291.i = icmp eq i64 %61, 0 + br i1 %.not291.i, label %panic.i266.i, label %__barray_mask_return.exit267.i + +panic.i266.i: ; preds = %__barray_mask_borrow.exit265.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit274.i: ; preds = %__barray_mask_borrow.exit271.i - %39 = xor i64 %37, 8 - store i64 %39, i64* %4, align 4 - store i64 %36, i64* %35, align 4 - %40 = load i64, i64* %4, align 4 - %41 = and i64 %40, 512 - %.not.i275.i = icmp eq i64 %41, 0 - br i1 %.not.i275.i, label %__barray_mask_borrow.exit277.i, label %panic.i276.i - -panic.i276.i: ; preds = %__barray_mask_return.exit274.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_return.exit267.i: ; preds = %__barray_mask_borrow.exit265.i + %62 = and i64 %60, -9 + store i64 %62, ptr %2, align 4 + store i64 %59, ptr %17, align 4 + %63 = load i64, ptr %2, align 4 + %64 = and i64 %63, 512 + %.not292.i = icmp eq i64 %64, 0 + br i1 %.not292.i, label %__barray_mask_borrow.exit269.i, label %panic.i268.i + +panic.i268.i: ; preds = %__barray_mask_return.exit267.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit277.i: ; preds = %__barray_mask_return.exit274.i - %42 = xor i64 %40, 512 - store i64 %42, i64* %4, align 4 - %43 = getelementptr inbounds i8, i8* %1, i64 72 - %44 = bitcast i8* %43 to i64* - %45 = load i64, i64* %44, align 4 - tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) - %46 = load i64, i64* %4, align 4 - %47 = and i64 %46, 512 - %.not.i278.i = icmp eq i64 %47, 0 - br i1 %.not.i278.i, label %panic.i279.i, label %__barray_mask_return.exit280.i - -panic.i279.i: ; preds = %__barray_mask_borrow.exit277.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit269.i: ; preds = %__barray_mask_return.exit267.i + %65 = or disjoint i64 %63, 512 + store i64 %65, ptr %2, align 4 + %66 = load i64, ptr %41, align 4 + tail call void @___rxy(i64 %66, double 0x400921FB54442D18, double 0.000000e+00) + %67 = load i64, ptr %2, align 4 + %68 = and i64 %67, 512 + %.not293.i = icmp eq i64 %68, 0 + br i1 %.not293.i, label %panic.i270.i, label %__barray_mask_return.exit271.i + +panic.i270.i: ; preds = %__barray_mask_borrow.exit269.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit280.i: ; preds = %__barray_mask_borrow.exit277.i - %48 = xor i64 %46, 512 - store i64 %48, i64* %4, align 4 - store i64 %45, i64* %44, align 4 - %49 = tail call i8* @heap_alloc(i64 240) - %50 = bitcast i8* %49 to { i1, i64, i1 }* - %51 = tail call i8* @heap_alloc(i64 8) - %52 = bitcast i8* %51 to i64* - store i64 -1, i64* %52, align 1 - br label %56 - -mask_block_ok.i.i.i.i: ; preds = %cond_exit_353.i.i - %53 = load i64, i64* %4, align 4 - %54 = or i64 %53, -1024 - store i64 %54, i64* %4, align 4 - %55 = icmp eq i64 %54, -1 - br i1 %55, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_err.i.i.i.i - -"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %mask_block_ok.i.i.i.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - br label %__barray_check_bounds.exit283.i +__barray_mask_return.exit271.i: ; preds = %__barray_mask_borrow.exit269.i + %69 = and i64 %67, -513 + store i64 %69, ptr %2, align 4 + store i64 %66, ptr %41, align 4 + %70 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"128.fca.2.insert.i", 0 + %71 = tail call ptr @heap_alloc(i64 240) + %72 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %72, align 1 + br label %__barray_check_bounds.exit.i.i.i + +73: ; preds = %loop_body.i.i + %74 = lshr i64 %.fca.2.extract83.i.i.i, 6 + %75 = getelementptr i64, ptr %.fca.1.extract82.i.i.i, i64 %74 + %76 = load i64, ptr %75, align 4 + %77 = and i64 %.fca.2.extract83.i.i.i, 63 + %78 = sub nuw nsw i64 64, %77 + %79 = lshr i64 -1, %78 + %80 = icmp eq i64 %77, 0 + %81 = select i1 %80, i64 0, i64 %79 + %82 = or i64 %76, %81 + store i64 %82, ptr %75, align 4 + %last_valid.i.i.i.i = add i64 %.fca.2.extract83.i.i.i, 9 + %83 = lshr i64 %last_valid.i.i.i.i, 6 + %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i.i.i, i64 %83 + %85 = load i64, ptr %84, align 4 + %86 = and i64 %last_valid.i.i.i.i, 63 + %87 = shl nsw i64 -2, %86 + %88 = icmp eq i64 %86, 63 + %89 = select i1 %88, i64 0, i64 %87 + %90 = or i64 %85, %89 + store i64 %90, ptr %84, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %83, %74 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +91: ; preds = %mask_block_ok.i.i.i.i + %92 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %73, %91 + %.02.i.i.i.i = phi i64 [ %92, %91 ], [ 0, %73 ] + %gep.i.i.i.i = getelementptr i64, ptr %75, i64 %.02.i.i.i.i + %93 = load i64, ptr %gep.i.i.i.i, align 4 + %94 = icmp eq i64 %93, -1 + br i1 %94, label %91, label %mask_block_err.i.i.i.i mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -56: ; preds = %cond_exit_353.i.i, %__barray_mask_return.exit280.i - %"303_0.sroa.15.0.i296.i" = phi i64 [ 0, %__barray_mask_return.exit280.i ], [ %57, %cond_exit_353.i.i ] - %57 = add nuw nsw i64 %"303_0.sroa.15.0.i296.i", 1 - %58 = lshr i64 %"303_0.sroa.15.0.i296.i", 6 - %59 = getelementptr inbounds i64, i64* %4, i64 %58 - %60 = load i64, i64* %59, align 4 - %61 = shl nuw nsw i64 1, %"303_0.sroa.15.0.i296.i" - %62 = and i64 %60, %61 - %.not.i99.i.i.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.i, label %__barray_check_bounds.exit.i.i, label %panic.i.i.i.i - -panic.i.i.i.i: ; preds = %56 - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit271.i + %.fca.2.extract83.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %.fca.2.extract83.i.i.i, %loop_body.i.i ] + %.fca.1.extract82.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit271.i ], [ %.fca.1.extract82.i.i.i, %loop_body.i.i ] + %.fca.0.extract81.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit271.i ], [ %.fca.0.extract81.i.i.i, %loop_body.i.i ] + %"303_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %95, %loop_body.i.i ] + %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit271.i ], [ %110, %loop_body.i.i ] + %95 = add nuw nsw i64 %"303_0.sroa.15.0184.i.i", 1 + %96 = add i64 %"303_0.sroa.15.0184.i.i", %.fca.2.extract83.i187.i.i + %97 = lshr i64 %96, 6 + %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i186.i.i, i64 %97 + %99 = load i64, ptr %98, align 4 + %100 = and i64 %96, 63 + %101 = lshr i64 %99, %100 + %102 = trunc i64 %101 to i1 + br i1 %102, label %panic.i.i.i.i, label %__barray_check_bounds.exit.i.i + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_check_bounds.exit.i.i: ; preds = %56 - %63 = xor i64 %60, %61 - store i64 %63, i64* %59, align 4 - %64 = getelementptr inbounds i64, i64* %2, i64 %"303_0.sroa.15.0.i296.i" - %65 = load i64, i64* %64, align 4 - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %65) - tail call void @___qfree(i64 %65) - %66 = getelementptr inbounds i64, i64* %52, i64 %58 - %67 = load i64, i64* %66, align 4 - %68 = and i64 %67, %61 - %.not.i.i.i = icmp eq i64 %68, 0 - br i1 %.not.i.i.i, label %panic.i.i.i, label %cond_exit_353.i.i +__barray_check_bounds.exit.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + %103 = shl nuw i64 1, %100 + %104 = xor i64 %103, %99 + store i64 %104, ptr %98, align 4 + %105 = getelementptr inbounds i64, ptr %.fca.0.extract81.i185.i.i, i64 %96 + %106 = load i64, ptr %105, align 4 + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %106) + tail call void @___qfree(i64 %106) + %107 = load i64, ptr %72, align 4 + %108 = lshr i64 %107, %"303_0.sroa.15.0184.i.i" + %109 = trunc i64 %108 to i1 + br i1 %109, label %loop_body.i.i, label %panic.i.i.i panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -cond_exit_353.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure.i.i, 1 - %69 = xor i64 %67, %61 - store i64 %69, i64* %66, align 4 - %70 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"303_0.sroa.15.0.i296.i" - store { i1, i64, i1 } %"367_054.fca.1.insert.i.i", { i1, i64, i1 }* %70, align 4 - %exitcond297.not.i = icmp eq i64 %57, 10 - br i1 %exitcond297.not.i, label %mask_block_ok.i.i.i.i, label %56 - -cond_87_case_0.i: ; preds = %cond_exit_87.i - %71 = load i64, i64* %52, align 4 - %72 = or i64 %71, -1024 - store i64 %72, i64* %52, align 4 - %73 = icmp eq i64 %72, -1 - br i1 %73, label %__hugr__.main.1.exit, label %mask_block_err.i.i +loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i + %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 + %"367_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"367_054.fca.1.insert.i.i", i1 undef, 2 + %110 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, i64 %95, 1 + %111 = shl nuw nsw i64 1, %"303_0.sroa.15.0184.i.i" + %112 = xor i64 %107, %111 + store i64 %112, ptr %72, align 4 + %113 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"303_0.sroa.15.0184.i.i" + store { i1, i64, i1 } %"367_054.fca.2.insert.i.i", ptr %113, align 4 + %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 + %.fca.0.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 + %.fca.1.extract82.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 + %.fca.2.extract83.i.i.i = extractvalue { ptr, ptr, i64 } %114, 2 + %exitcond.not.i.i = icmp eq i64 %95, 10 + br i1 %exitcond.not.i.i, label %73, label %__barray_check_bounds.exit.i.i.i + +"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %91, %73 + tail call void @heap_free(ptr %.fca.0.extract81.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.extract82.i.i.i) + br label %__barray_check_bounds.exit274.i + +cond_87_case_0.i: ; preds = %cond_exit_87.thread.i + %115 = load i64, ptr %72, align 4 + %116 = or i64 %115, -1024 + store i64 %116, ptr %72, align 4 + %117 = icmp eq i64 %116, -1 + br i1 %117, label %__hugr__.main.1.exit, label %mask_block_err.i.i mask_block_err.i.i: ; preds = %cond_87_case_0.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -__barray_check_bounds.exit283.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i", %cond_exit_87.i - %"90_0.0.i1" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).277.exit.i" ], [ %74, %cond_exit_87.i ] - %74 = add nuw nsw i64 %"90_0.0.i1", 1 - %75 = lshr i64 %"90_0.0.i1", 6 - %76 = getelementptr inbounds i64, i64* %52, i64 %75 - %77 = load i64, i64* %76, align 4 - %78 = shl nuw nsw i64 1, %"90_0.0.i1" - %79 = and i64 %77, %78 - %.not.i = icmp eq i64 %79, 0 - br i1 %.not.i, label %__barray_mask_borrow.exit288.i, label %cond_exit_87.i - -__barray_mask_borrow.exit288.i: ; preds = %__barray_check_bounds.exit283.i - %80 = xor i64 %77, %78 - store i64 %80, i64* %76, align 4 - %81 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"90_0.0.i1" - %82 = load { i1, i64, i1 }, { i1, i64, i1 }* %81, align 4 - %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %82, 0 - br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.i - -cond_exit_87.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit288.i, %__barray_check_bounds.exit283.i - %exitcond.not = icmp eq i64 %74, 10 - br i1 %exitcond.not, label %cond_87_case_0.i, label %__barray_check_bounds.exit283.i - -cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit288.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %82, 1 +__barray_check_bounds.exit274.i: ; preds = %cond_exit_87.thread.i, %"__hugr__.$measure_array$$n(10).277.exit.i" + %"90_0.0300.i" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).277.exit.i" ], [ %118, %cond_exit_87.thread.i ] + %118 = add nuw nsw i64 %"90_0.0300.i", 1 + %119 = load i64, ptr %72, align 4 + %120 = lshr i64 %119, %"90_0.0300.i" + %121 = trunc i64 %120 to i1 + br i1 %121, label %cond_exit_87.thread.i, label %__barray_mask_borrow.exit278.i + +__barray_mask_borrow.exit278.i: ; preds = %__barray_check_bounds.exit274.i + %122 = shl nuw nsw i64 1, %"90_0.0300.i" + %123 = xor i64 %119, %122 + store i64 %123, ptr %72, align 4 + %124 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"90_0.0300.i" + %125 = load { i1, i64, i1 }, ptr %124, align 4 + %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %125, 0 + br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.thread.i + +cond_exit_87.thread.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit278.i, %__barray_check_bounds.exit274.i + %exitcond.i = icmp eq i64 %118, 10 + br i1 %exitcond.i, label %cond_87_case_0.i, label %__barray_check_bounds.exit274.i + +cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit278.i + %.fca.1.extract.i = extractvalue { i1, i64, i1 } %125, 1 tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - br label %cond_exit_87.i + br label %cond_exit_87.thread.i __hugr__.main.1.exit: ; preds = %cond_87_case_0.i - tail call void @heap_free(i8* %49) - tail call void @heap_free(i8* nonnull %51) - %83 = tail call i64 @teardown() - ret i64 %83 + tail call void @heap_free(ptr %71) + tail call void @heap_free(ptr nonnull %72) + %126 = tail call i64 @teardown() + ret i64 %126 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-no_results/no_results_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-no_results/no_results_aarch64-apple-darwin index a7d8d58c5..50ddd8eca 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-no_results/no_results_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-no_results/no_results_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." @@ -16,7 +16,7 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -26,32 +26,22 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_18_case_0.i.i, label %__hugr__.bar.1.exit -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.bar.1.exit, label %cond_18_case_0.i.i - -cond_18_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_18_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.bar.1.exit: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.bar.1.exit: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - %3 = tail call i64 @teardown() - ret i64 %3 + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_exit/postselect_exit_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_exit/postselect_exit_aarch64-apple-darwin index 095ab2b1b..bc31f619e 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_exit/postselect_exit_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_exit/postselect_exit_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 42, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 42, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_panic/postselect_panic_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_panic/postselect_panic_aarch64-apple-darwin index d0e81f408..06d7895ae 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_panic/postselect_panic_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-postselect_panic/postselect_panic_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 1001, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-print_current_shot/print_current_shot_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-print_current_shot/print_current_shot_aarch64-apple-darwin index dc18fbd80..47a2a4968 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-print_current_shot/print_current_shot_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-print_current_shot/print_current_shot_aarch64-apple-darwin @@ -1,19 +1,19 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" declare i64 @get_current_shot() local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_shot.6D86EAF7.0, i64 0, i64 0), i64 13, i64 %shot.i) + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) %1 = tail call i64 @teardown() ret i64 %1 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rng/rng_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rng/rng_aarch64-apple-darwin index 7e9799778..466a4f849 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rng/rng_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rng/rng_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @res_rint.B928E41E.0 = private constant [14 x i8] c"\0DUSER:INT:rint" @@ -17,9 +17,9 @@ declare double @random_float() local_unnamed_addr declare i32 @random_rng(i32) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr @@ -34,19 +34,19 @@ entry: %1 = sext i32 %rintb.i to i64 %2 = sext i32 %rint20.i to i64 %3 = sext i32 %rint.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_rint.B928E41E.0, i64 0, i64 0), i64 13, i64 %3) - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint1.0884EC03.0, i64 0, i64 0), i64 14, i64 %2) - tail call void @print_float(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rfloat.F0E4DD2C.0, i64 0, i64 0), i64 17, double %rfloat.i) - tail call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rint_bnd.CB1E6B0D.0, i64 0, i64 0), i64 17, i64 %1) + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %3) + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %2) + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat.i) + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %1) tail call void @random_seed(i64 84) %rint53.i = tail call i32 @random_int() %rfloat55.i = tail call double @random_float() %rintb58.i = tail call i32 @random_rng(i32 200) %4 = sext i32 %rintb58.i to i64 %5 = sext i32 %rint53.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint2.F0335598.0, i64 0, i64 0), i64 14, i64 %5) - tail call void @print_float(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rfloat2.4DAB941F.0, i64 0, i64 0), i64 18, double %rfloat55.i) - tail call void @print_int(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rint_bnd2.169DE399.0, i64 0, i64 0), i64 18, i64 %4) + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %5) + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat55.i) + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %4) %6 = tail call i64 @teardown() ret i64 %6 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rus/rus_aarch64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rus/rus_aarch64-apple-darwin index c0bea5117..95ddd2420 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rus/rus_aarch64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/aarch64-apple-darwin-rus/rus_aarch64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" target triple = "aarch64-apple-darwin" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @@ -14,14 +14,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -33,119 +33,89 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_87_case_0.i.i, label %__hugr__.__tk2_qalloc.83.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.83.exit.i, label %cond_87_case_0.i.i - -cond_87_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_87_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.83.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - br label %cond_242_case_1.i.i - -cond_242_case_1.i.i: ; preds = %cond_242_case_1.i.i.backedge, %__hugr__.__tk2_qalloc.83.exit.i - %qalloc.i.i.i = tail call i64 @___qalloc() - %not_max.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 - br i1 %not_max.not.i.i.i, label %id_bb.i.i.i, label %reset_bb.i.i.i - -reset_bb.i.i.i: ; preds = %cond_242_case_1.i.i - tail call void @___reset(i64 %qalloc.i.i.i) - br label %id_bb.i.i.i - -id_bb.i.i.i: ; preds = %reset_bb.i.i.i, %cond_242_case_1.i.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i.i, 1 - %4 = select i1 %not_max.not.i.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i.i.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i, label %cond_101_case_0.i.i.i +__hugr__.__tk2_qalloc.83.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %qalloc.i132.i.i = tail call i64 @___qalloc() + %not_max.not.not.i133.i.i = icmp eq i64 %qalloc.i132.i.i, -1 + br i1 %not_max.not.not.i133.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i -cond_101_case_0.i.i.i: ; preds = %id_bb.i.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_101_case_0.i.i.i: ; preds = %cond_242_case_1.backedge.i.i, %__hugr__.__tk2_qalloc.83.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %id_bb.i.i.i - %.fca.1.extract.i.i.i = extractvalue { i1, i64 } %4, 1 +__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.83.exit.i, %cond_242_case_1.backedge.i.i + %qalloc.i134.i.i = phi i64 [ %qalloc.i.i.i, %cond_242_case_1.backedge.i.i ], [ %qalloc.i132.i.i, %__hugr__.__tk2_qalloc.83.exit.i ] + tail call void @___reset(i64 %qalloc.i134.i.i) %qalloc.i128.i.i = tail call i64 @___qalloc() - %not_max.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 - br i1 %not_max.not.i129.i.i, label %id_bb.i132.i.i, label %reset_bb.i130.i.i + %not_max.not.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 + br i1 %not_max.not.not.i129.i.i, label %cond_115_case_0.i.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i -reset_bb.i130.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i - tail call void @___reset(i64 %qalloc.i128.i.i) - br label %id_bb.i132.i.i - -id_bb.i132.i.i: ; preds = %reset_bb.i130.i.i, %__hugr__.__tk2_qalloc.97.exit.i.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i128.i.i, 1 - %6 = select i1 %not_max.not.i129.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i131.i.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i131.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i, label %cond_115_case_0.i.i.i - -cond_115_case_0.i.i.i: ; preds = %id_bb.i132.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_115_case_0.i.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %id_bb.i132.i.i - %.fca.1.extract.i133.i.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFE921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i133.i.i, i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x3FE921FB54442D18) - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i.i) +__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @___reset(i64 %qalloc.i128.i.i) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFE921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i128.i.i, i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x3FE921FB54442D18) + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i.i) + tail call void @___qfree(i64 %qalloc.i134.i.i) %read_bool.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i.i) - br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %7 + br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %1 -7: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) - br label %cond_242_case_1.i.i.backedge +1: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i + tail call void @___qfree(i64 %qalloc.i128.i.i) + br label %cond_242_case_1.backedge.i.i + +cond_242_case_1.backedge.i.i: ; preds = %2, %1 + %qalloc.i.i.i = tail call i64 @___qalloc() + %not_max.not.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 + br i1 %not_max.not.not.i.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i cond_256_case_1.i.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x3FE921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i.i, i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x3FE921FB54442D18) - %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i133.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) + tail call void @___rz(i64 %qalloc.i.i, double 0x3FE921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i.i, i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x3FE921FB54442D18) + %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i.i) + tail call void @___qfree(i64 %qalloc.i128.i.i) %read_bool80.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i.i) - br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %8 - -8: ; preds = %cond_256_case_1.i.i - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) - br label %cond_242_case_1.i.i.backedge + br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %2 -cond_242_case_1.i.i.backedge: ; preds = %8, %7 - br label %cond_242_case_1.i.i +2: ; preds = %cond_256_case_1.i.i + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) + br label %cond_242_case_1.backedge.i.i __hugr__.main.1.exit: ; preds = %cond_256_case_1.i.i - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @res_result.457DE32D.0, i64 0, i64 0), i64 16, i1 %read_bool.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) + %3 = tail call i64 @teardown() + ret i64 %3 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-discard_qb_array/discard_qb_array_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-discard_qb_array/discard_qb_array_x86_64-apple-darwin index f08dd5207..5bc61b599 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-discard_qb_array/discard_qb_array_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-discard_qb_array/discard_qb_array_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,14 +8,14 @@ target triple = "x86_64-apple-darwin" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___qfree(i64) local_unnamed_addr -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -24,194 +24,264 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0114.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0114.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_211_case_0.i.i - -cond_211_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_211_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0114.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0114.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0114.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.preheader.preheader.i, label %cond_20_case_1.i - -loop_out.preheader.preheader.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i99.i.i.i = icmp eq i64 %16, 0 - br i1 %.not.i99.i.i.i, label %cond_380_case_1.i.i, label %panic.i.i.i.i - -mask_block_err.i.i.i.i: ; preds = %cond_380_case_1.i.9.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"120.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"120.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.0.insert.i", ptr %2, 1 + %"120.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.1.insert.i", i64 0, 2 + %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"120.fca.2.insert.i", 0 + br label %__barray_check_bounds.exit.i.i.i + +43: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + %44 = lshr i64 %.fca.1.0.0.2.extract.i.i.i, 6 + %45 = getelementptr i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %44 + %46 = load i64, ptr %45, align 4 + %47 = and i64 %.fca.1.0.0.2.extract.i.i.i, 63 + %48 = sub nuw nsw i64 64, %47 + %49 = lshr i64 -1, %48 + %50 = icmp eq i64 %47, 0 + %51 = select i1 %50, i64 0, i64 %49 + %52 = or i64 %46, %51 + store i64 %52, ptr %45, align 4 + %last_valid.i.i.i.i = add i64 %.fca.1.0.0.2.extract.i.i.i, 9 + %53 = lshr i64 %last_valid.i.i.i.i, 6 + %54 = getelementptr inbounds nuw i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %53 + %55 = load i64, ptr %54, align 4 + %56 = and i64 %last_valid.i.i.i.i, 63 + %57 = shl nsw i64 -2, %56 + %58 = icmp eq i64 %56, 63 + %59 = select i1 %58, i64 0, i64 %57 + %60 = or i64 %55, %59 + store i64 %60, ptr %54, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %53, %44 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +61: ; preds = %mask_block_ok.i.i.i.i + %62 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %43, %61 + %.02.i.i.i.i = phi i64 [ %62, %61 ], [ 0, %43 ] + %gep.i.i.i.i = getelementptr i64, ptr %45, i64 %.02.i.i.i.i + %63 = load i64, ptr %gep.i.i.i.i, align 4 + %64 = icmp eq i64 %63, -1 + br i1 %64, label %61, label %mask_block_err.i.i.i.i + +mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -panic.i.i.i.i: ; preds = %cond_380_case_1.i.8.i, %cond_380_case_1.i.7.i, %cond_380_case_1.i.6.i, %cond_380_case_1.i.5.i, %cond_380_case_1.i.4.i, %cond_380_case_1.i.3.i, %cond_380_case_1.i.2.i, %cond_380_case_1.i.1.i, %cond_380_case_1.i.i, %loop_out.preheader.preheader.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i", %cond_exit_20.i.9 + %.fca.2.extract83.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.1.extract82.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.0.extract81.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %"291_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %65 = add i64 %"291_0.0182.i.i", %.fca.2.extract83.i185.i.i + %66 = lshr i64 %65, 6 + %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i184.i.i, i64 %66 + %68 = load i64, ptr %67, align 4 + %69 = and i64 %65, 63 + %70 = lshr i64 %68, %69 + %71 = trunc i64 %70 to i1 + br i1 %71, label %panic.i.i.i.i, label %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -cond_380_case_1.i.i: ; preds = %loop_out.preheader.preheader.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___qfree(i64 %18) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 2 - %.not.i99.i.i.1.i = icmp eq i64 %20, 0 - br i1 %.not.i99.i.i.1.i, label %cond_380_case_1.i.1.i, label %panic.i.i.i.i - -cond_380_case_1.i.1.i: ; preds = %cond_380_case_1.i.i - %21 = xor i64 %19, 2 - store i64 %21, i64* %4, align 4 - %22 = getelementptr inbounds i8, i8* %1, i64 8 - %23 = bitcast i8* %22 to i64* - %24 = load i64, i64* %23, align 4 - tail call void @___qfree(i64 %24) - %25 = load i64, i64* %4, align 4 - %26 = and i64 %25, 4 - %.not.i99.i.i.2.i = icmp eq i64 %26, 0 - br i1 %.not.i99.i.i.2.i, label %cond_380_case_1.i.2.i, label %panic.i.i.i.i - -cond_380_case_1.i.2.i: ; preds = %cond_380_case_1.i.1.i - %27 = xor i64 %25, 4 - store i64 %27, i64* %4, align 4 - %28 = getelementptr inbounds i8, i8* %1, i64 16 - %29 = bitcast i8* %28 to i64* - %30 = load i64, i64* %29, align 4 - tail call void @___qfree(i64 %30) - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i99.i.i.3.i = icmp eq i64 %32, 0 - br i1 %.not.i99.i.i.3.i, label %cond_380_case_1.i.3.i, label %panic.i.i.i.i - -cond_380_case_1.i.3.i: ; preds = %cond_380_case_1.i.2.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___qfree(i64 %36) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 16 - %.not.i99.i.i.4.i = icmp eq i64 %38, 0 - br i1 %.not.i99.i.i.4.i, label %cond_380_case_1.i.4.i, label %panic.i.i.i.i - -cond_380_case_1.i.4.i: ; preds = %cond_380_case_1.i.3.i - %39 = xor i64 %37, 16 - store i64 %39, i64* %4, align 4 - %40 = getelementptr inbounds i8, i8* %1, i64 32 - %41 = bitcast i8* %40 to i64* - %42 = load i64, i64* %41, align 4 - tail call void @___qfree(i64 %42) - %43 = load i64, i64* %4, align 4 - %44 = and i64 %43, 32 - %.not.i99.i.i.5.i = icmp eq i64 %44, 0 - br i1 %.not.i99.i.i.5.i, label %cond_380_case_1.i.5.i, label %panic.i.i.i.i - -cond_380_case_1.i.5.i: ; preds = %cond_380_case_1.i.4.i - %45 = xor i64 %43, 32 - store i64 %45, i64* %4, align 4 - %46 = getelementptr inbounds i8, i8* %1, i64 40 - %47 = bitcast i8* %46 to i64* - %48 = load i64, i64* %47, align 4 - tail call void @___qfree(i64 %48) - %49 = load i64, i64* %4, align 4 - %50 = and i64 %49, 64 - %.not.i99.i.i.6.i = icmp eq i64 %50, 0 - br i1 %.not.i99.i.i.6.i, label %cond_380_case_1.i.6.i, label %panic.i.i.i.i - -cond_380_case_1.i.6.i: ; preds = %cond_380_case_1.i.5.i - %51 = xor i64 %49, 64 - store i64 %51, i64* %4, align 4 - %52 = getelementptr inbounds i8, i8* %1, i64 48 - %53 = bitcast i8* %52 to i64* - %54 = load i64, i64* %53, align 4 - tail call void @___qfree(i64 %54) - %55 = load i64, i64* %4, align 4 - %56 = and i64 %55, 128 - %.not.i99.i.i.7.i = icmp eq i64 %56, 0 - br i1 %.not.i99.i.i.7.i, label %cond_380_case_1.i.7.i, label %panic.i.i.i.i - -cond_380_case_1.i.7.i: ; preds = %cond_380_case_1.i.6.i - %57 = xor i64 %55, 128 - store i64 %57, i64* %4, align 4 - %58 = getelementptr inbounds i8, i8* %1, i64 56 - %59 = bitcast i8* %58 to i64* - %60 = load i64, i64* %59, align 4 - tail call void @___qfree(i64 %60) - %61 = load i64, i64* %4, align 4 - %62 = and i64 %61, 256 - %.not.i99.i.i.8.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.8.i, label %cond_380_case_1.i.8.i, label %panic.i.i.i.i - -cond_380_case_1.i.8.i: ; preds = %cond_380_case_1.i.7.i - %63 = xor i64 %61, 256 - store i64 %63, i64* %4, align 4 - %64 = getelementptr inbounds i8, i8* %1, i64 64 - %65 = bitcast i8* %64 to i64* - %66 = load i64, i64* %65, align 4 - tail call void @___qfree(i64 %66) - %67 = load i64, i64* %4, align 4 - %68 = and i64 %67, 512 - %.not.i99.i.i.9.i = icmp eq i64 %68, 0 - br i1 %.not.i99.i.i.9.i, label %cond_380_case_1.i.9.i, label %panic.i.i.i.i - -cond_380_case_1.i.9.i: ; preds = %cond_380_case_1.i.8.i - %69 = xor i64 %67, 512 - store i64 %69, i64* %4, align 4 - %70 = getelementptr inbounds i8, i8* %1, i64 72 - %71 = bitcast i8* %70 to i64* - %72 = load i64, i64* %71, align 4 - tail call void @___qfree(i64 %72) - %73 = load i64, i64* %4, align 4 - %74 = or i64 %73, -1024 - store i64 %74, i64* %4, align 4 - %75 = icmp eq i64 %74, -1 - br i1 %75, label %__hugr__.main.1.exit, label %mask_block_err.i.i.i.i - -__hugr__.main.1.exit: ; preds = %cond_380_case_1.i.9.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - %76 = tail call i64 @teardown() - ret i64 %76 +"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i + %72 = add nuw nsw i64 %"291_0.0182.i.i", 1 + %73 = shl nuw i64 1, %69 + %74 = xor i64 %73, %68 + store i64 %74, ptr %67, align 4 + %75 = getelementptr inbounds i64, ptr %.fca.0.extract81.i183.i.i, i64 %65 + %76 = load i64, ptr %75, align 4 + %.fca.1.0.0.0.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 0 + %.fca.1.0.0.1.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 1 + %.fca.1.0.0.2.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 2 + %77 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, i64 %72, 1 + %78 = insertvalue { { ptr, ptr, i64 }, i64 } %77, ptr %.fca.1.0.0.0.extract.i.i.i, 0, 0 + %79 = insertvalue { { ptr, ptr, i64 }, i64 } %78, ptr %.fca.1.0.0.1.extract.i.i.i, 0, 1 + %80 = insertvalue { { ptr, ptr, i64 }, i64 } %79, i64 %.fca.1.0.0.2.extract.i.i.i, 0, 2 + tail call void @___qfree(i64 %76) + %.not.i.i = icmp eq i64 %"291_0.0182.i.i", 9 + br i1 %.not.i.i, label %43, label %__barray_check_bounds.exit.i.i.i + +__hugr__.main.1.exit: ; preds = %61, %43 + tail call void @heap_free(ptr %.fca.1.0.0.0.extract.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.0.0.1.extract.i.i.i) + %81 = tail call i64 @teardown() + ret i64 %81 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-flip_some/flip_some_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-flip_some/flip_some_x86_64-apple-darwin index 66137e702..692aab40e 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-flip_some/flip_some_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-flip_some/flip_some_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @res_c0.7C14CD6E.0 = private constant [13 x i8] c"\0CUSER:BOOL:c0" @@ -17,14 +17,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -32,110 +32,70 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_40_case_0.i.i, label %__hugr__.__tk2_qalloc.36.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.36.exit.i, label %cond_40_case_0.i.i - -cond_40_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_40_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.36.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) +__hugr__.__tk2_qalloc.36.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) %qalloc.i101.i = tail call i64 @___qalloc() - %not_max.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 - br i1 %not_max.not.i102.i, label %id_bb.i105.i, label %reset_bb.i103.i - -reset_bb.i103.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i - tail call void @___reset(i64 %qalloc.i101.i) - br label %id_bb.i105.i + %not_max.not.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 + br i1 %not_max.not.not.i102.i, label %cond_54_case_0.i.i, label %__hugr__.__tk2_qalloc.50.exit.i -id_bb.i105.i: ; preds = %reset_bb.i103.i, %__hugr__.__tk2_qalloc.36.exit.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i101.i, 1 - %4 = select i1 %not_max.not.i102.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i104.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i104.i, label %__hugr__.__tk2_qalloc.50.exit.i, label %cond_54_case_0.i.i - -cond_54_case_0.i.i: ; preds = %id_bb.i105.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_54_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.50.exit.i: ; preds = %id_bb.i105.i - %.fca.1.extract.i106.i = extractvalue { i1, i64 } %4, 1 - %qalloc.i107.i = tail call i64 @___qalloc() - %not_max.not.i108.i = icmp eq i64 %qalloc.i107.i, -1 - br i1 %not_max.not.i108.i, label %id_bb.i111.i, label %reset_bb.i109.i - -reset_bb.i109.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i - tail call void @___reset(i64 %qalloc.i107.i) - br label %id_bb.i111.i - -id_bb.i111.i: ; preds = %reset_bb.i109.i, %__hugr__.__tk2_qalloc.50.exit.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i107.i, 1 - %6 = select i1 %not_max.not.i108.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i110.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i110.i, label %__hugr__.__tk2_qalloc.64.exit.i, label %cond_68_case_0.i.i +__hugr__.__tk2_qalloc.50.exit.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @___reset(i64 %qalloc.i101.i) + %qalloc.i103.i = tail call i64 @___qalloc() + %not_max.not.not.i104.i = icmp eq i64 %qalloc.i103.i, -1 + br i1 %not_max.not.not.i104.i, label %cond_68_case_0.i.i, label %__hugr__.__tk2_qalloc.64.exit.i -cond_68_case_0.i.i: ; preds = %id_bb.i111.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_68_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.64.exit.i: ; preds = %id_bb.i111.i - %.fca.1.extract.i112.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i112.i, double 0x400921FB54442D18, double 0.000000e+00) - %qalloc.i113.i = tail call i64 @___qalloc() - %not_max.not.i114.i = icmp eq i64 %qalloc.i113.i, -1 - br i1 %not_max.not.i114.i, label %id_bb.i117.i, label %reset_bb.i115.i - -reset_bb.i115.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i - tail call void @___reset(i64 %qalloc.i113.i) - br label %id_bb.i117.i - -id_bb.i117.i: ; preds = %reset_bb.i115.i, %__hugr__.__tk2_qalloc.64.exit.i - %7 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i113.i, 1 - %8 = select i1 %not_max.not.i114.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %7 - %.fca.0.extract.i116.i = extractvalue { i1, i64 } %8, 0 - br i1 %.fca.0.extract.i116.i, label %__hugr__.main.1.exit, label %cond_82_case_0.i.i - -cond_82_case_0.i.i: ; preds = %id_bb.i117.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +__hugr__.__tk2_qalloc.64.exit.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @___reset(i64 %qalloc.i103.i) + tail call void @___rxy(i64 %qalloc.i103.i, double 0x400921FB54442D18, double 0.000000e+00) + %qalloc.i105.i = tail call i64 @___qalloc() + %not_max.not.not.i106.i = icmp eq i64 %qalloc.i105.i, -1 + br i1 %not_max.not.not.i106.i, label %cond_82_case_0.i.i, label %__hugr__.main.1.exit + +cond_82_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.main.1.exit: ; preds = %id_bb.i117.i - %.fca.1.extract.i118.i = extractvalue { i1, i64 } %8, 1 - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @___reset(i64 %qalloc.i105.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c0.7C14CD6E.0, i64 0, i64 0), i64 12, i1 %read_bool.i) - %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i106.i) - tail call void @___qfree(i64 %.fca.1.extract.i106.i) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool.i) + %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %qalloc.i101.i) + tail call void @___qfree(i64 %qalloc.i101.i) %read_bool35.i = tail call i1 @___read_future_bool(i64 %lazy_measure22.i) tail call void @___dec_future_refcount(i64 %lazy_measure22.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c1.1F7A6571.0, i64 0, i64 0), i64 12, i1 %read_bool35.i) - %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i112.i) - tail call void @___qfree(i64 %.fca.1.extract.i112.i) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35.i) + %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %qalloc.i103.i) + tail call void @___qfree(i64 %qalloc.i103.i) %read_bool57.i = tail call i1 @___read_future_bool(i64 %lazy_measure44.i) tail call void @___dec_future_refcount(i64 %lazy_measure44.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c2.60825383.0, i64 0, i64 0), i64 12, i1 %read_bool57.i) - tail call void @___rxy(i64 %.fca.1.extract.i118.i, double 0x400921FB54442D18, double 0.000000e+00) - %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i118.i) - tail call void @___qfree(i64 %.fca.1.extract.i118.i) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57.i) + tail call void @___rxy(i64 %qalloc.i105.i, double 0x400921FB54442D18, double 0.000000e+00) + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i105.i) + tail call void @___qfree(i64 %qalloc.i105.i) %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c3.B223E16D.0, i64 0, i64 0), i64 12, i1 %read_bool80.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-measure_qb_array/measure_qb_array_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-measure_qb_array/measure_qb_array_x86_64-apple-darwin index e27edecd6..8399ca245 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-measure_qb_array/measure_qb_array_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-measure_qb_array/measure_qb_array_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,12 +8,12 @@ target triple = "x86_64-apple-darwin" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr @@ -30,279 +30,600 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0294.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0294.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_236_case_0.i.i - -cond_236_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_236_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0294.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0294.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0294.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.i, label %cond_20_case_1.i - -loop_out.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i258.i = icmp eq i64 %16, 0 - br i1 %.not.i258.i, label %__barray_mask_borrow.exit.i, label %panic.i259.i - -panic.i259.i: ; preds = %loop_out.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"128.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"128.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.0.insert.i", ptr %2, 1 + %"128.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.1.insert.i", i64 0, 2 + %42 = load i64, ptr %2, align 4 + %43 = trunc i64 %42 to i1 + br i1 %43, label %panic.i257.i, label %__barray_mask_borrow.exit.i + +panic.i257.i: ; preds = %cond_exit_20.i.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit.i: ; preds = %loop_out.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___rxy(i64 %18, double 0x400921FB54442D18, double 0.000000e+00) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 1 - %.not.i260.i = icmp eq i64 %20, 0 - br i1 %.not.i260.i, label %panic.i261.i, label %__barray_mask_return.exit262.i - -panic.i261.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) - unreachable +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.i.9 + %44 = or disjoint i64 %42, 1 + store i64 %44, ptr %2, align 4 + %45 = load i64, ptr %1, align 4 + tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) + %46 = load i64, ptr %2, align 4 + %47 = trunc i64 %46 to i1 + br i1 %47, label %__barray_mask_return.exit259.i, label %panic.i258.i -__barray_mask_return.exit262.i: ; preds = %__barray_mask_borrow.exit.i - %21 = xor i64 %19, 1 - store i64 %21, i64* %4, align 4 - store i64 %18, i64* %2, align 4 - %22 = load i64, i64* %4, align 4 - %23 = and i64 %22, 4 - %.not.i263.i = icmp eq i64 %23, 0 - br i1 %.not.i263.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i - -panic.i264.i: ; preds = %__barray_mask_return.exit262.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +panic.i258.i: ; preds = %__barray_mask_borrow.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit262.i - %24 = xor i64 %22, 4 - store i64 %24, i64* %4, align 4 - %25 = getelementptr inbounds i8, i8* %1, i64 16 - %26 = bitcast i8* %25 to i64* - %27 = load i64, i64* %26, align 4 - tail call void @___rxy(i64 %27, double 0x400921FB54442D18, double 0.000000e+00) - %28 = load i64, i64* %4, align 4 - %29 = and i64 %28, 4 - %.not.i266.i = icmp eq i64 %29, 0 - br i1 %.not.i266.i, label %panic.i267.i, label %__barray_mask_return.exit268.i - -panic.i267.i: ; preds = %__barray_mask_borrow.exit265.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit259.i: ; preds = %__barray_mask_borrow.exit.i + %48 = and i64 %46, -2 + store i64 %48, ptr %2, align 4 + store i64 %45, ptr %1, align 4 + %49 = load i64, ptr %2, align 4 + %50 = and i64 %49, 4 + %.not.i = icmp eq i64 %50, 0 + br i1 %.not.i, label %__barray_mask_borrow.exit261.i, label %panic.i260.i + +panic.i260.i: ; preds = %__barray_mask_return.exit259.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit268.i: ; preds = %__barray_mask_borrow.exit265.i - %30 = xor i64 %28, 4 - store i64 %30, i64* %4, align 4 - store i64 %27, i64* %26, align 4 - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i269.i = icmp eq i64 %32, 0 - br i1 %.not.i269.i, label %__barray_mask_borrow.exit271.i, label %panic.i270.i - -panic.i270.i: ; preds = %__barray_mask_return.exit268.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit261.i: ; preds = %__barray_mask_return.exit259.i + %51 = or disjoint i64 %49, 4 + store i64 %51, ptr %2, align 4 + %52 = load i64, ptr %13, align 4 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00) + %53 = load i64, ptr %2, align 4 + %54 = and i64 %53, 4 + %.not289.i = icmp eq i64 %54, 0 + br i1 %.not289.i, label %panic.i262.i, label %__barray_mask_return.exit263.i + +panic.i262.i: ; preds = %__barray_mask_borrow.exit261.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit271.i: ; preds = %__barray_mask_return.exit268.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___rxy(i64 %36, double 0x400921FB54442D18, double 0.000000e+00) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 8 - %.not.i272.i = icmp eq i64 %38, 0 - br i1 %.not.i272.i, label %panic.i273.i, label %__barray_mask_return.exit274.i - -panic.i273.i: ; preds = %__barray_mask_borrow.exit271.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit263.i: ; preds = %__barray_mask_borrow.exit261.i + %55 = and i64 %53, -5 + store i64 %55, ptr %2, align 4 + store i64 %52, ptr %13, align 4 + %56 = load i64, ptr %2, align 4 + %57 = and i64 %56, 8 + %.not290.i = icmp eq i64 %57, 0 + br i1 %.not290.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i + +panic.i264.i: ; preds = %__barray_mask_return.exit263.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit274.i: ; preds = %__barray_mask_borrow.exit271.i - %39 = xor i64 %37, 8 - store i64 %39, i64* %4, align 4 - store i64 %36, i64* %35, align 4 - %40 = load i64, i64* %4, align 4 - %41 = and i64 %40, 512 - %.not.i275.i = icmp eq i64 %41, 0 - br i1 %.not.i275.i, label %__barray_mask_borrow.exit277.i, label %panic.i276.i - -panic.i276.i: ; preds = %__barray_mask_return.exit274.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit263.i + %58 = or disjoint i64 %56, 8 + store i64 %58, ptr %2, align 4 + %59 = load i64, ptr %17, align 4 + tail call void @___rxy(i64 %59, double 0x400921FB54442D18, double 0.000000e+00) + %60 = load i64, ptr %2, align 4 + %61 = and i64 %60, 8 + %.not291.i = icmp eq i64 %61, 0 + br i1 %.not291.i, label %panic.i266.i, label %__barray_mask_return.exit267.i + +panic.i266.i: ; preds = %__barray_mask_borrow.exit265.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit277.i: ; preds = %__barray_mask_return.exit274.i - %42 = xor i64 %40, 512 - store i64 %42, i64* %4, align 4 - %43 = getelementptr inbounds i8, i8* %1, i64 72 - %44 = bitcast i8* %43 to i64* - %45 = load i64, i64* %44, align 4 - tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) - %46 = load i64, i64* %4, align 4 - %47 = and i64 %46, 512 - %.not.i278.i = icmp eq i64 %47, 0 - br i1 %.not.i278.i, label %panic.i279.i, label %__barray_mask_return.exit280.i +__barray_mask_return.exit267.i: ; preds = %__barray_mask_borrow.exit265.i + %62 = and i64 %60, -9 + store i64 %62, ptr %2, align 4 + store i64 %59, ptr %17, align 4 + %63 = load i64, ptr %2, align 4 + %64 = and i64 %63, 512 + %.not292.i = icmp eq i64 %64, 0 + br i1 %.not292.i, label %__barray_mask_borrow.exit269.i, label %panic.i268.i + +panic.i268.i: ; preds = %__barray_mask_return.exit267.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") + unreachable -panic.i279.i: ; preds = %__barray_mask_borrow.exit277.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit269.i: ; preds = %__barray_mask_return.exit267.i + %65 = or disjoint i64 %63, 512 + store i64 %65, ptr %2, align 4 + %66 = load i64, ptr %41, align 4 + tail call void @___rxy(i64 %66, double 0x400921FB54442D18, double 0.000000e+00) + %67 = load i64, ptr %2, align 4 + %68 = and i64 %67, 512 + %.not293.i = icmp eq i64 %68, 0 + br i1 %.not293.i, label %panic.i270.i, label %__barray_mask_return.exit271.i + +panic.i270.i: ; preds = %__barray_mask_borrow.exit269.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit280.i: ; preds = %__barray_mask_borrow.exit277.i - %48 = xor i64 %46, 512 - store i64 %48, i64* %4, align 4 - store i64 %45, i64* %44, align 4 - %49 = tail call i8* @heap_alloc(i64 240) - %50 = bitcast i8* %49 to { i1, i64, i1 }* - %51 = tail call i8* @heap_alloc(i64 8) - %52 = bitcast i8* %51 to i64* - store i64 -1, i64* %52, align 1 - br label %56 - -mask_block_ok.i.i.i.i: ; preds = %cond_exit_353.i.i - %53 = load i64, i64* %4, align 4 - %54 = or i64 %53, -1024 - store i64 %54, i64* %4, align 4 - %55 = icmp eq i64 %54, -1 - br i1 %55, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_err.i.i.i.i - -"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %mask_block_ok.i.i.i.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - br label %__barray_check_bounds.exit283.i +__barray_mask_return.exit271.i: ; preds = %__barray_mask_borrow.exit269.i + %69 = and i64 %67, -513 + store i64 %69, ptr %2, align 4 + store i64 %66, ptr %41, align 4 + %70 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"128.fca.2.insert.i", 0 + %71 = tail call ptr @heap_alloc(i64 240) + %72 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %72, align 1 + br label %__barray_check_bounds.exit.i.i.i + +73: ; preds = %loop_body.i.i + %74 = lshr i64 %.fca.2.extract83.i.i.i, 6 + %75 = getelementptr i64, ptr %.fca.1.extract82.i.i.i, i64 %74 + %76 = load i64, ptr %75, align 4 + %77 = and i64 %.fca.2.extract83.i.i.i, 63 + %78 = sub nuw nsw i64 64, %77 + %79 = lshr i64 -1, %78 + %80 = icmp eq i64 %77, 0 + %81 = select i1 %80, i64 0, i64 %79 + %82 = or i64 %76, %81 + store i64 %82, ptr %75, align 4 + %last_valid.i.i.i.i = add i64 %.fca.2.extract83.i.i.i, 9 + %83 = lshr i64 %last_valid.i.i.i.i, 6 + %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i.i.i, i64 %83 + %85 = load i64, ptr %84, align 4 + %86 = and i64 %last_valid.i.i.i.i, 63 + %87 = shl nsw i64 -2, %86 + %88 = icmp eq i64 %86, 63 + %89 = select i1 %88, i64 0, i64 %87 + %90 = or i64 %85, %89 + store i64 %90, ptr %84, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %83, %74 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +91: ; preds = %mask_block_ok.i.i.i.i + %92 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %73, %91 + %.02.i.i.i.i = phi i64 [ %92, %91 ], [ 0, %73 ] + %gep.i.i.i.i = getelementptr i64, ptr %75, i64 %.02.i.i.i.i + %93 = load i64, ptr %gep.i.i.i.i, align 4 + %94 = icmp eq i64 %93, -1 + br i1 %94, label %91, label %mask_block_err.i.i.i.i mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -56: ; preds = %cond_exit_353.i.i, %__barray_mask_return.exit280.i - %"303_0.sroa.15.0.i296.i" = phi i64 [ 0, %__barray_mask_return.exit280.i ], [ %57, %cond_exit_353.i.i ] - %57 = add nuw nsw i64 %"303_0.sroa.15.0.i296.i", 1 - %58 = lshr i64 %"303_0.sroa.15.0.i296.i", 6 - %59 = getelementptr inbounds i64, i64* %4, i64 %58 - %60 = load i64, i64* %59, align 4 - %61 = shl nuw nsw i64 1, %"303_0.sroa.15.0.i296.i" - %62 = and i64 %60, %61 - %.not.i99.i.i.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.i, label %__barray_check_bounds.exit.i.i, label %panic.i.i.i.i - -panic.i.i.i.i: ; preds = %56 - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit271.i + %.fca.2.extract83.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %.fca.2.extract83.i.i.i, %loop_body.i.i ] + %.fca.1.extract82.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit271.i ], [ %.fca.1.extract82.i.i.i, %loop_body.i.i ] + %.fca.0.extract81.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit271.i ], [ %.fca.0.extract81.i.i.i, %loop_body.i.i ] + %"303_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %95, %loop_body.i.i ] + %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit271.i ], [ %110, %loop_body.i.i ] + %95 = add nuw nsw i64 %"303_0.sroa.15.0184.i.i", 1 + %96 = add i64 %"303_0.sroa.15.0184.i.i", %.fca.2.extract83.i187.i.i + %97 = lshr i64 %96, 6 + %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i186.i.i, i64 %97 + %99 = load i64, ptr %98, align 4 + %100 = and i64 %96, 63 + %101 = lshr i64 %99, %100 + %102 = trunc i64 %101 to i1 + br i1 %102, label %panic.i.i.i.i, label %__barray_check_bounds.exit.i.i + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_check_bounds.exit.i.i: ; preds = %56 - %63 = xor i64 %60, %61 - store i64 %63, i64* %59, align 4 - %64 = getelementptr inbounds i64, i64* %2, i64 %"303_0.sroa.15.0.i296.i" - %65 = load i64, i64* %64, align 4 - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %65) - tail call void @___qfree(i64 %65) - %66 = getelementptr inbounds i64, i64* %52, i64 %58 - %67 = load i64, i64* %66, align 4 - %68 = and i64 %67, %61 - %.not.i.i.i = icmp eq i64 %68, 0 - br i1 %.not.i.i.i, label %panic.i.i.i, label %cond_exit_353.i.i +__barray_check_bounds.exit.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + %103 = shl nuw i64 1, %100 + %104 = xor i64 %103, %99 + store i64 %104, ptr %98, align 4 + %105 = getelementptr inbounds i64, ptr %.fca.0.extract81.i185.i.i, i64 %96 + %106 = load i64, ptr %105, align 4 + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %106) + tail call void @___qfree(i64 %106) + %107 = load i64, ptr %72, align 4 + %108 = lshr i64 %107, %"303_0.sroa.15.0184.i.i" + %109 = trunc i64 %108 to i1 + br i1 %109, label %loop_body.i.i, label %panic.i.i.i panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -cond_exit_353.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure.i.i, 1 - %69 = xor i64 %67, %61 - store i64 %69, i64* %66, align 4 - %70 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"303_0.sroa.15.0.i296.i" - store { i1, i64, i1 } %"367_054.fca.1.insert.i.i", { i1, i64, i1 }* %70, align 4 - %exitcond297.not.i = icmp eq i64 %57, 10 - br i1 %exitcond297.not.i, label %mask_block_ok.i.i.i.i, label %56 - -cond_87_case_0.i: ; preds = %cond_exit_87.i - %71 = load i64, i64* %52, align 4 - %72 = or i64 %71, -1024 - store i64 %72, i64* %52, align 4 - %73 = icmp eq i64 %72, -1 - br i1 %73, label %__hugr__.main.1.exit, label %mask_block_err.i.i - -mask_block_err.i.i: ; preds = %cond_87_case_0.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) +loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i + %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 + %"367_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"367_054.fca.1.insert.i.i", i1 undef, 2 + %110 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, i64 %95, 1 + %111 = shl nuw nsw i64 1, %"303_0.sroa.15.0184.i.i" + %112 = xor i64 %107, %111 + store i64 %112, ptr %72, align 4 + %113 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"303_0.sroa.15.0184.i.i" + store { i1, i64, i1 } %"367_054.fca.2.insert.i.i", ptr %113, align 4 + %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 + %.fca.0.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 + %.fca.1.extract82.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 + %.fca.2.extract83.i.i.i = extractvalue { ptr, ptr, i64 } %114, 2 + %exitcond.not.i.i = icmp eq i64 %95, 10 + br i1 %exitcond.not.i.i, label %73, label %__barray_check_bounds.exit.i.i.i + +"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %91, %73 + tail call void @heap_free(ptr %.fca.0.extract81.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.extract82.i.i.i) + %115 = load i64, ptr %72, align 4 + %116 = trunc i64 %115 to i1 + br i1 %116, label %cond_exit_87.thread.i, label %__barray_mask_borrow.exit278.i + +mask_block_err.i.i: ; preds = %cond_exit_87.thread.9.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -__barray_check_bounds.exit283.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i", %cond_exit_87.i - %"90_0.0.i1" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).277.exit.i" ], [ %74, %cond_exit_87.i ] - %74 = add nuw nsw i64 %"90_0.0.i1", 1 - %75 = lshr i64 %"90_0.0.i1", 6 - %76 = getelementptr inbounds i64, i64* %52, i64 %75 - %77 = load i64, i64* %76, align 4 - %78 = shl nuw nsw i64 1, %"90_0.0.i1" - %79 = and i64 %77, %78 - %.not.i = icmp eq i64 %79, 0 - br i1 %.not.i, label %__barray_mask_borrow.exit288.i, label %cond_exit_87.i - -__barray_mask_borrow.exit288.i: ; preds = %__barray_check_bounds.exit283.i - %80 = xor i64 %77, %78 - store i64 %80, i64* %76, align 4 - %81 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"90_0.0.i1" - %82 = load { i1, i64, i1 }, { i1, i64, i1 }* %81, align 4 - %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %82, 0 - br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.i - -cond_exit_87.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit288.i, %__barray_check_bounds.exit283.i - %exitcond.not = icmp eq i64 %74, 10 - br i1 %exitcond.not, label %cond_87_case_0.i, label %__barray_check_bounds.exit283.i - -cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit288.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %82, 1 +__barray_mask_borrow.exit278.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i" + %117 = or disjoint i64 %115, 1 + store i64 %117, ptr %72, align 4 + %118 = load { i1, i64, i1 }, ptr %71, align 4 + %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %118, 0 + br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.thread.i + +cond_exit_87.thread.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit278.i, %"__hugr__.$measure_array$$n(10).277.exit.i" + %119 = phi i64 [ %.pre.i, %cond_390_case_1.i ], [ %117, %__barray_mask_borrow.exit278.i ], [ %115, %"__hugr__.$measure_array$$n(10).277.exit.i" ] + %120 = and i64 %119, 2 + %.not311.i = icmp eq i64 %120, 0 + br i1 %.not311.i, label %__barray_mask_borrow.exit278.1.i, label %cond_exit_87.thread.1.i + +__barray_mask_borrow.exit278.1.i: ; preds = %cond_exit_87.thread.i + %121 = or disjoint i64 %119, 2 + store i64 %121, ptr %72, align 4 + %122 = getelementptr inbounds nuw i8, ptr %71, i64 24 + %123 = load { i1, i64, i1 }, ptr %122, align 4 + %.fca.0.extract179.1.i = extractvalue { i1, i64, i1 } %123, 0 + br i1 %.fca.0.extract179.1.i, label %cond_390_case_1.1.i, label %cond_exit_87.thread.1.i + +cond_390_case_1.1.i: ; preds = %__barray_mask_borrow.exit278.1.i + %.fca.1.extract.1.i = extractvalue { i1, i64, i1 } %123, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1.i) + %.pre302.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.1.i + +cond_exit_87.thread.1.i: ; preds = %cond_390_case_1.1.i, %__barray_mask_borrow.exit278.1.i, %cond_exit_87.thread.i + %124 = phi i64 [ %.pre302.i, %cond_390_case_1.1.i ], [ %121, %__barray_mask_borrow.exit278.1.i ], [ %119, %cond_exit_87.thread.i ] + %125 = and i64 %124, 4 + %.not312.i = icmp eq i64 %125, 0 + br i1 %.not312.i, label %__barray_mask_borrow.exit278.2.i, label %cond_exit_87.thread.2.i + +__barray_mask_borrow.exit278.2.i: ; preds = %cond_exit_87.thread.1.i + %126 = or disjoint i64 %124, 4 + store i64 %126, ptr %72, align 4 + %127 = getelementptr inbounds nuw i8, ptr %71, i64 48 + %128 = load { i1, i64, i1 }, ptr %127, align 4 + %.fca.0.extract179.2.i = extractvalue { i1, i64, i1 } %128, 0 + br i1 %.fca.0.extract179.2.i, label %cond_390_case_1.2.i, label %cond_exit_87.thread.2.i + +cond_390_case_1.2.i: ; preds = %__barray_mask_borrow.exit278.2.i + %.fca.1.extract.2.i = extractvalue { i1, i64, i1 } %128, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2.i) + %.pre303.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.2.i + +cond_exit_87.thread.2.i: ; preds = %cond_390_case_1.2.i, %__barray_mask_borrow.exit278.2.i, %cond_exit_87.thread.1.i + %129 = phi i64 [ %.pre303.i, %cond_390_case_1.2.i ], [ %126, %__barray_mask_borrow.exit278.2.i ], [ %124, %cond_exit_87.thread.1.i ] + %130 = and i64 %129, 8 + %.not313.i = icmp eq i64 %130, 0 + br i1 %.not313.i, label %__barray_mask_borrow.exit278.3.i, label %cond_exit_87.thread.3.i + +__barray_mask_borrow.exit278.3.i: ; preds = %cond_exit_87.thread.2.i + %131 = or disjoint i64 %129, 8 + store i64 %131, ptr %72, align 4 + %132 = getelementptr inbounds nuw i8, ptr %71, i64 72 + %133 = load { i1, i64, i1 }, ptr %132, align 4 + %.fca.0.extract179.3.i = extractvalue { i1, i64, i1 } %133, 0 + br i1 %.fca.0.extract179.3.i, label %cond_390_case_1.3.i, label %cond_exit_87.thread.3.i + +cond_390_case_1.3.i: ; preds = %__barray_mask_borrow.exit278.3.i + %.fca.1.extract.3.i = extractvalue { i1, i64, i1 } %133, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3.i) + %.pre304.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.3.i + +cond_exit_87.thread.3.i: ; preds = %cond_390_case_1.3.i, %__barray_mask_borrow.exit278.3.i, %cond_exit_87.thread.2.i + %134 = phi i64 [ %.pre304.i, %cond_390_case_1.3.i ], [ %131, %__barray_mask_borrow.exit278.3.i ], [ %129, %cond_exit_87.thread.2.i ] + %135 = and i64 %134, 16 + %.not314.i = icmp eq i64 %135, 0 + br i1 %.not314.i, label %__barray_mask_borrow.exit278.4.i, label %cond_exit_87.thread.4.i + +__barray_mask_borrow.exit278.4.i: ; preds = %cond_exit_87.thread.3.i + %136 = or disjoint i64 %134, 16 + store i64 %136, ptr %72, align 4 + %137 = getelementptr inbounds nuw i8, ptr %71, i64 96 + %138 = load { i1, i64, i1 }, ptr %137, align 4 + %.fca.0.extract179.4.i = extractvalue { i1, i64, i1 } %138, 0 + br i1 %.fca.0.extract179.4.i, label %cond_390_case_1.4.i, label %cond_exit_87.thread.4.i + +cond_390_case_1.4.i: ; preds = %__barray_mask_borrow.exit278.4.i + %.fca.1.extract.4.i = extractvalue { i1, i64, i1 } %138, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4.i) + %.pre305.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.4.i + +cond_exit_87.thread.4.i: ; preds = %cond_390_case_1.4.i, %__barray_mask_borrow.exit278.4.i, %cond_exit_87.thread.3.i + %139 = phi i64 [ %.pre305.i, %cond_390_case_1.4.i ], [ %136, %__barray_mask_borrow.exit278.4.i ], [ %134, %cond_exit_87.thread.3.i ] + %140 = and i64 %139, 32 + %.not315.i = icmp eq i64 %140, 0 + br i1 %.not315.i, label %__barray_mask_borrow.exit278.5.i, label %cond_exit_87.thread.5.i + +__barray_mask_borrow.exit278.5.i: ; preds = %cond_exit_87.thread.4.i + %141 = or disjoint i64 %139, 32 + store i64 %141, ptr %72, align 4 + %142 = getelementptr inbounds nuw i8, ptr %71, i64 120 + %143 = load { i1, i64, i1 }, ptr %142, align 4 + %.fca.0.extract179.5.i = extractvalue { i1, i64, i1 } %143, 0 + br i1 %.fca.0.extract179.5.i, label %cond_390_case_1.5.i, label %cond_exit_87.thread.5.i + +cond_390_case_1.5.i: ; preds = %__barray_mask_borrow.exit278.5.i + %.fca.1.extract.5.i = extractvalue { i1, i64, i1 } %143, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5.i) + %.pre306.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.5.i + +cond_exit_87.thread.5.i: ; preds = %cond_390_case_1.5.i, %__barray_mask_borrow.exit278.5.i, %cond_exit_87.thread.4.i + %144 = phi i64 [ %.pre306.i, %cond_390_case_1.5.i ], [ %141, %__barray_mask_borrow.exit278.5.i ], [ %139, %cond_exit_87.thread.4.i ] + %145 = and i64 %144, 64 + %.not316.i = icmp eq i64 %145, 0 + br i1 %.not316.i, label %__barray_mask_borrow.exit278.6.i, label %cond_exit_87.thread.6.i + +__barray_mask_borrow.exit278.6.i: ; preds = %cond_exit_87.thread.5.i + %146 = or disjoint i64 %144, 64 + store i64 %146, ptr %72, align 4 + %147 = getelementptr inbounds nuw i8, ptr %71, i64 144 + %148 = load { i1, i64, i1 }, ptr %147, align 4 + %.fca.0.extract179.6.i = extractvalue { i1, i64, i1 } %148, 0 + br i1 %.fca.0.extract179.6.i, label %cond_390_case_1.6.i, label %cond_exit_87.thread.6.i + +cond_390_case_1.6.i: ; preds = %__barray_mask_borrow.exit278.6.i + %.fca.1.extract.6.i = extractvalue { i1, i64, i1 } %148, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6.i) + %.pre307.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.6.i + +cond_exit_87.thread.6.i: ; preds = %cond_390_case_1.6.i, %__barray_mask_borrow.exit278.6.i, %cond_exit_87.thread.5.i + %149 = phi i64 [ %.pre307.i, %cond_390_case_1.6.i ], [ %146, %__barray_mask_borrow.exit278.6.i ], [ %144, %cond_exit_87.thread.5.i ] + %150 = and i64 %149, 128 + %.not317.i = icmp eq i64 %150, 0 + br i1 %.not317.i, label %__barray_mask_borrow.exit278.7.i, label %cond_exit_87.thread.7.i + +__barray_mask_borrow.exit278.7.i: ; preds = %cond_exit_87.thread.6.i + %151 = or disjoint i64 %149, 128 + store i64 %151, ptr %72, align 4 + %152 = getelementptr inbounds nuw i8, ptr %71, i64 168 + %153 = load { i1, i64, i1 }, ptr %152, align 4 + %.fca.0.extract179.7.i = extractvalue { i1, i64, i1 } %153, 0 + br i1 %.fca.0.extract179.7.i, label %cond_390_case_1.7.i, label %cond_exit_87.thread.7.i + +cond_390_case_1.7.i: ; preds = %__barray_mask_borrow.exit278.7.i + %.fca.1.extract.7.i = extractvalue { i1, i64, i1 } %153, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7.i) + %.pre308.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.7.i + +cond_exit_87.thread.7.i: ; preds = %cond_390_case_1.7.i, %__barray_mask_borrow.exit278.7.i, %cond_exit_87.thread.6.i + %154 = phi i64 [ %.pre308.i, %cond_390_case_1.7.i ], [ %151, %__barray_mask_borrow.exit278.7.i ], [ %149, %cond_exit_87.thread.6.i ] + %155 = and i64 %154, 256 + %.not318.i = icmp eq i64 %155, 0 + br i1 %.not318.i, label %__barray_mask_borrow.exit278.8.i, label %cond_exit_87.thread.8.i + +__barray_mask_borrow.exit278.8.i: ; preds = %cond_exit_87.thread.7.i + %156 = or disjoint i64 %154, 256 + store i64 %156, ptr %72, align 4 + %157 = getelementptr inbounds nuw i8, ptr %71, i64 192 + %158 = load { i1, i64, i1 }, ptr %157, align 4 + %.fca.0.extract179.8.i = extractvalue { i1, i64, i1 } %158, 0 + br i1 %.fca.0.extract179.8.i, label %cond_390_case_1.8.i, label %cond_exit_87.thread.8.i + +cond_390_case_1.8.i: ; preds = %__barray_mask_borrow.exit278.8.i + %.fca.1.extract.8.i = extractvalue { i1, i64, i1 } %158, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8.i) + %.pre309.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.8.i + +cond_exit_87.thread.8.i: ; preds = %cond_390_case_1.8.i, %__barray_mask_borrow.exit278.8.i, %cond_exit_87.thread.7.i + %159 = phi i64 [ %.pre309.i, %cond_390_case_1.8.i ], [ %156, %__barray_mask_borrow.exit278.8.i ], [ %154, %cond_exit_87.thread.7.i ] + %160 = and i64 %159, 512 + %.not319.i = icmp eq i64 %160, 0 + br i1 %.not319.i, label %__barray_mask_borrow.exit278.9.i, label %cond_exit_87.thread.9.i + +__barray_mask_borrow.exit278.9.i: ; preds = %cond_exit_87.thread.8.i + %161 = or disjoint i64 %159, 512 + store i64 %161, ptr %72, align 4 + %162 = getelementptr inbounds nuw i8, ptr %71, i64 216 + %163 = load { i1, i64, i1 }, ptr %162, align 4 + %.fca.0.extract179.9.i = extractvalue { i1, i64, i1 } %163, 0 + br i1 %.fca.0.extract179.9.i, label %cond_390_case_1.9.i, label %cond_exit_87.thread.9.i + +cond_390_case_1.9.i: ; preds = %__barray_mask_borrow.exit278.9.i + %.fca.1.extract.9.i = extractvalue { i1, i64, i1 } %163, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9.i) + %.pre310.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.9.i + +cond_exit_87.thread.9.i: ; preds = %cond_390_case_1.9.i, %__barray_mask_borrow.exit278.9.i, %cond_exit_87.thread.8.i + %164 = phi i64 [ %.pre310.i, %cond_390_case_1.9.i ], [ %161, %__barray_mask_borrow.exit278.9.i ], [ %159, %cond_exit_87.thread.8.i ] + %165 = or i64 %164, -1024 + store i64 %165, ptr %72, align 4 + %166 = icmp eq i64 %165, -1 + br i1 %166, label %__hugr__.main.1.exit, label %mask_block_err.i.i + +cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit278.i + %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - br label %cond_exit_87.i - -__hugr__.main.1.exit: ; preds = %cond_87_case_0.i - tail call void @heap_free(i8* %49) - tail call void @heap_free(i8* nonnull %51) - %83 = tail call i64 @teardown() - ret i64 %83 + %.pre.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.i + +__hugr__.main.1.exit: ; preds = %cond_exit_87.thread.9.i + tail call void @heap_free(ptr %71) + tail call void @heap_free(ptr nonnull %72) + %167 = tail call i64 @teardown() + ret i64 %167 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-no_results/no_results_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-no_results/no_results_x86_64-apple-darwin index 30648c824..ee3bf9879 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-no_results/no_results_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-no_results/no_results_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." @@ -16,7 +16,7 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -26,32 +26,22 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_18_case_0.i.i, label %__hugr__.bar.1.exit -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.bar.1.exit, label %cond_18_case_0.i.i - -cond_18_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_18_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.bar.1.exit: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.bar.1.exit: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - %3 = tail call i64 @teardown() - ret i64 %3 + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_exit/postselect_exit_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_exit/postselect_exit_x86_64-apple-darwin index a5980160b..6a17bf13e 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_exit/postselect_exit_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_exit/postselect_exit_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 42, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 42, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_panic/postselect_panic_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_panic/postselect_panic_x86_64-apple-darwin index 5e1be3450..1b52f5089 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_panic/postselect_panic_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-postselect_panic/postselect_panic_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 1001, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-print_current_shot/print_current_shot_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-print_current_shot/print_current_shot_x86_64-apple-darwin index c5a9ef92b..2f2765e7d 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-print_current_shot/print_current_shot_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-print_current_shot/print_current_shot_x86_64-apple-darwin @@ -1,19 +1,19 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" declare i64 @get_current_shot() local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_shot.6D86EAF7.0, i64 0, i64 0), i64 13, i64 %shot.i) + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) %1 = tail call i64 @teardown() ret i64 %1 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rng/rng_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rng/rng_x86_64-apple-darwin index 841227703..0f176c0be 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rng/rng_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rng/rng_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @res_rint.B928E41E.0 = private constant [14 x i8] c"\0DUSER:INT:rint" @@ -17,9 +17,9 @@ declare double @random_float() local_unnamed_addr declare i32 @random_rng(i32) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr @@ -34,19 +34,19 @@ entry: %1 = sext i32 %rintb.i to i64 %2 = sext i32 %rint20.i to i64 %3 = sext i32 %rint.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_rint.B928E41E.0, i64 0, i64 0), i64 13, i64 %3) - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint1.0884EC03.0, i64 0, i64 0), i64 14, i64 %2) - tail call void @print_float(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rfloat.F0E4DD2C.0, i64 0, i64 0), i64 17, double %rfloat.i) - tail call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rint_bnd.CB1E6B0D.0, i64 0, i64 0), i64 17, i64 %1) + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %3) + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %2) + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat.i) + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %1) tail call void @random_seed(i64 84) %rint53.i = tail call i32 @random_int() %rfloat55.i = tail call double @random_float() %rintb58.i = tail call i32 @random_rng(i32 200) %4 = sext i32 %rintb58.i to i64 %5 = sext i32 %rint53.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint2.F0335598.0, i64 0, i64 0), i64 14, i64 %5) - tail call void @print_float(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rfloat2.4DAB941F.0, i64 0, i64 0), i64 18, double %rfloat55.i) - tail call void @print_int(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rint_bnd2.169DE399.0, i64 0, i64 0), i64 18, i64 %4) + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %5) + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat55.i) + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %4) %6 = tail call i64 @teardown() ret i64 %6 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rus/rus_x86_64-apple-darwin b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rus/rus_x86_64-apple-darwin index d981614b2..77f401c44 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rus/rus_x86_64-apple-darwin +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-apple-darwin-rus/rus_x86_64-apple-darwin @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @@ -14,14 +14,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -33,119 +33,89 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_87_case_0.i.i, label %__hugr__.__tk2_qalloc.83.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.83.exit.i, label %cond_87_case_0.i.i - -cond_87_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_87_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.83.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - br label %cond_242_case_1.i.i - -cond_242_case_1.i.i: ; preds = %cond_242_case_1.i.i.backedge, %__hugr__.__tk2_qalloc.83.exit.i - %qalloc.i.i.i = tail call i64 @___qalloc() - %not_max.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 - br i1 %not_max.not.i.i.i, label %id_bb.i.i.i, label %reset_bb.i.i.i - -reset_bb.i.i.i: ; preds = %cond_242_case_1.i.i - tail call void @___reset(i64 %qalloc.i.i.i) - br label %id_bb.i.i.i - -id_bb.i.i.i: ; preds = %reset_bb.i.i.i, %cond_242_case_1.i.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i.i, 1 - %4 = select i1 %not_max.not.i.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i.i.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i, label %cond_101_case_0.i.i.i +__hugr__.__tk2_qalloc.83.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %qalloc.i132.i.i = tail call i64 @___qalloc() + %not_max.not.not.i133.i.i = icmp eq i64 %qalloc.i132.i.i, -1 + br i1 %not_max.not.not.i133.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i -cond_101_case_0.i.i.i: ; preds = %id_bb.i.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_101_case_0.i.i.i: ; preds = %cond_242_case_1.backedge.i.i, %__hugr__.__tk2_qalloc.83.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %id_bb.i.i.i - %.fca.1.extract.i.i.i = extractvalue { i1, i64 } %4, 1 +__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.83.exit.i, %cond_242_case_1.backedge.i.i + %qalloc.i134.i.i = phi i64 [ %qalloc.i.i.i, %cond_242_case_1.backedge.i.i ], [ %qalloc.i132.i.i, %__hugr__.__tk2_qalloc.83.exit.i ] + tail call void @___reset(i64 %qalloc.i134.i.i) %qalloc.i128.i.i = tail call i64 @___qalloc() - %not_max.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 - br i1 %not_max.not.i129.i.i, label %id_bb.i132.i.i, label %reset_bb.i130.i.i + %not_max.not.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 + br i1 %not_max.not.not.i129.i.i, label %cond_115_case_0.i.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i -reset_bb.i130.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i - tail call void @___reset(i64 %qalloc.i128.i.i) - br label %id_bb.i132.i.i - -id_bb.i132.i.i: ; preds = %reset_bb.i130.i.i, %__hugr__.__tk2_qalloc.97.exit.i.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i128.i.i, 1 - %6 = select i1 %not_max.not.i129.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i131.i.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i131.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i, label %cond_115_case_0.i.i.i - -cond_115_case_0.i.i.i: ; preds = %id_bb.i132.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_115_case_0.i.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %id_bb.i132.i.i - %.fca.1.extract.i133.i.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFE921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i133.i.i, i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x3FE921FB54442D18) - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i.i) +__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @___reset(i64 %qalloc.i128.i.i) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFE921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i128.i.i, i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x3FE921FB54442D18) + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i.i) + tail call void @___qfree(i64 %qalloc.i134.i.i) %read_bool.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i.i) - br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %7 + br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %1 -7: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) - br label %cond_242_case_1.i.i.backedge +1: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i + tail call void @___qfree(i64 %qalloc.i128.i.i) + br label %cond_242_case_1.backedge.i.i + +cond_242_case_1.backedge.i.i: ; preds = %2, %1 + %qalloc.i.i.i = tail call i64 @___qalloc() + %not_max.not.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 + br i1 %not_max.not.not.i.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i cond_256_case_1.i.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x3FE921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i.i, i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x3FE921FB54442D18) - %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i133.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) + tail call void @___rz(i64 %qalloc.i.i, double 0x3FE921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i.i, i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x3FE921FB54442D18) + %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i.i) + tail call void @___qfree(i64 %qalloc.i128.i.i) %read_bool80.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i.i) - br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %8 - -8: ; preds = %cond_256_case_1.i.i - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) - br label %cond_242_case_1.i.i.backedge + br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %2 -cond_242_case_1.i.i.backedge: ; preds = %8, %7 - br label %cond_242_case_1.i.i +2: ; preds = %cond_256_case_1.i.i + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) + br label %cond_242_case_1.backedge.i.i __hugr__.main.1.exit: ; preds = %cond_256_case_1.i.i - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @res_result.457DE32D.0, i64 0, i64 0), i64 16, i1 %read_bool.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) + %3 = tail call i64 @teardown() + ret i64 %3 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-discard_qb_array/discard_qb_array_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-discard_qb_array/discard_qb_array_x86_64-unknown-linux-gnu index 794a55a63..849877232 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-discard_qb_array/discard_qb_array_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-discard_qb_array/discard_qb_array_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,14 +8,14 @@ target triple = "x86_64-unknown-linux-gnu" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___qfree(i64) local_unnamed_addr -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -24,194 +24,264 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0114.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0114.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_211_case_0.i.i - -cond_211_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_211_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0114.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0114.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0114.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.preheader.preheader.i, label %cond_20_case_1.i - -loop_out.preheader.preheader.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i99.i.i.i = icmp eq i64 %16, 0 - br i1 %.not.i99.i.i.i, label %cond_380_case_1.i.i, label %panic.i.i.i.i - -mask_block_err.i.i.i.i: ; preds = %cond_380_case_1.i.9.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"120.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"120.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.0.insert.i", ptr %2, 1 + %"120.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.1.insert.i", i64 0, 2 + %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"120.fca.2.insert.i", 0 + br label %__barray_check_bounds.exit.i.i.i + +43: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + %44 = lshr i64 %.fca.1.0.0.2.extract.i.i.i, 6 + %45 = getelementptr i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %44 + %46 = load i64, ptr %45, align 4 + %47 = and i64 %.fca.1.0.0.2.extract.i.i.i, 63 + %48 = sub nuw nsw i64 64, %47 + %49 = lshr i64 -1, %48 + %50 = icmp eq i64 %47, 0 + %51 = select i1 %50, i64 0, i64 %49 + %52 = or i64 %46, %51 + store i64 %52, ptr %45, align 4 + %last_valid.i.i.i.i = add i64 %.fca.1.0.0.2.extract.i.i.i, 9 + %53 = lshr i64 %last_valid.i.i.i.i, 6 + %54 = getelementptr inbounds nuw i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %53 + %55 = load i64, ptr %54, align 4 + %56 = and i64 %last_valid.i.i.i.i, 63 + %57 = shl nsw i64 -2, %56 + %58 = icmp eq i64 %56, 63 + %59 = select i1 %58, i64 0, i64 %57 + %60 = or i64 %55, %59 + store i64 %60, ptr %54, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %53, %44 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +61: ; preds = %mask_block_ok.i.i.i.i + %62 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %43, %61 + %.02.i.i.i.i = phi i64 [ %62, %61 ], [ 0, %43 ] + %gep.i.i.i.i = getelementptr i64, ptr %45, i64 %.02.i.i.i.i + %63 = load i64, ptr %gep.i.i.i.i, align 4 + %64 = icmp eq i64 %63, -1 + br i1 %64, label %61, label %mask_block_err.i.i.i.i + +mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -panic.i.i.i.i: ; preds = %cond_380_case_1.i.8.i, %cond_380_case_1.i.7.i, %cond_380_case_1.i.6.i, %cond_380_case_1.i.5.i, %cond_380_case_1.i.4.i, %cond_380_case_1.i.3.i, %cond_380_case_1.i.2.i, %cond_380_case_1.i.1.i, %cond_380_case_1.i.i, %loop_out.preheader.preheader.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i", %cond_exit_20.i.9 + %.fca.2.extract83.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.1.extract82.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.0.extract81.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %"291_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %65 = add i64 %"291_0.0182.i.i", %.fca.2.extract83.i185.i.i + %66 = lshr i64 %65, 6 + %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i184.i.i, i64 %66 + %68 = load i64, ptr %67, align 4 + %69 = and i64 %65, 63 + %70 = lshr i64 %68, %69 + %71 = trunc i64 %70 to i1 + br i1 %71, label %panic.i.i.i.i, label %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -cond_380_case_1.i.i: ; preds = %loop_out.preheader.preheader.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___qfree(i64 %18) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 2 - %.not.i99.i.i.1.i = icmp eq i64 %20, 0 - br i1 %.not.i99.i.i.1.i, label %cond_380_case_1.i.1.i, label %panic.i.i.i.i - -cond_380_case_1.i.1.i: ; preds = %cond_380_case_1.i.i - %21 = xor i64 %19, 2 - store i64 %21, i64* %4, align 4 - %22 = getelementptr inbounds i8, i8* %1, i64 8 - %23 = bitcast i8* %22 to i64* - %24 = load i64, i64* %23, align 4 - tail call void @___qfree(i64 %24) - %25 = load i64, i64* %4, align 4 - %26 = and i64 %25, 4 - %.not.i99.i.i.2.i = icmp eq i64 %26, 0 - br i1 %.not.i99.i.i.2.i, label %cond_380_case_1.i.2.i, label %panic.i.i.i.i - -cond_380_case_1.i.2.i: ; preds = %cond_380_case_1.i.1.i - %27 = xor i64 %25, 4 - store i64 %27, i64* %4, align 4 - %28 = getelementptr inbounds i8, i8* %1, i64 16 - %29 = bitcast i8* %28 to i64* - %30 = load i64, i64* %29, align 4 - tail call void @___qfree(i64 %30) - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i99.i.i.3.i = icmp eq i64 %32, 0 - br i1 %.not.i99.i.i.3.i, label %cond_380_case_1.i.3.i, label %panic.i.i.i.i - -cond_380_case_1.i.3.i: ; preds = %cond_380_case_1.i.2.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___qfree(i64 %36) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 16 - %.not.i99.i.i.4.i = icmp eq i64 %38, 0 - br i1 %.not.i99.i.i.4.i, label %cond_380_case_1.i.4.i, label %panic.i.i.i.i - -cond_380_case_1.i.4.i: ; preds = %cond_380_case_1.i.3.i - %39 = xor i64 %37, 16 - store i64 %39, i64* %4, align 4 - %40 = getelementptr inbounds i8, i8* %1, i64 32 - %41 = bitcast i8* %40 to i64* - %42 = load i64, i64* %41, align 4 - tail call void @___qfree(i64 %42) - %43 = load i64, i64* %4, align 4 - %44 = and i64 %43, 32 - %.not.i99.i.i.5.i = icmp eq i64 %44, 0 - br i1 %.not.i99.i.i.5.i, label %cond_380_case_1.i.5.i, label %panic.i.i.i.i - -cond_380_case_1.i.5.i: ; preds = %cond_380_case_1.i.4.i - %45 = xor i64 %43, 32 - store i64 %45, i64* %4, align 4 - %46 = getelementptr inbounds i8, i8* %1, i64 40 - %47 = bitcast i8* %46 to i64* - %48 = load i64, i64* %47, align 4 - tail call void @___qfree(i64 %48) - %49 = load i64, i64* %4, align 4 - %50 = and i64 %49, 64 - %.not.i99.i.i.6.i = icmp eq i64 %50, 0 - br i1 %.not.i99.i.i.6.i, label %cond_380_case_1.i.6.i, label %panic.i.i.i.i - -cond_380_case_1.i.6.i: ; preds = %cond_380_case_1.i.5.i - %51 = xor i64 %49, 64 - store i64 %51, i64* %4, align 4 - %52 = getelementptr inbounds i8, i8* %1, i64 48 - %53 = bitcast i8* %52 to i64* - %54 = load i64, i64* %53, align 4 - tail call void @___qfree(i64 %54) - %55 = load i64, i64* %4, align 4 - %56 = and i64 %55, 128 - %.not.i99.i.i.7.i = icmp eq i64 %56, 0 - br i1 %.not.i99.i.i.7.i, label %cond_380_case_1.i.7.i, label %panic.i.i.i.i - -cond_380_case_1.i.7.i: ; preds = %cond_380_case_1.i.6.i - %57 = xor i64 %55, 128 - store i64 %57, i64* %4, align 4 - %58 = getelementptr inbounds i8, i8* %1, i64 56 - %59 = bitcast i8* %58 to i64* - %60 = load i64, i64* %59, align 4 - tail call void @___qfree(i64 %60) - %61 = load i64, i64* %4, align 4 - %62 = and i64 %61, 256 - %.not.i99.i.i.8.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.8.i, label %cond_380_case_1.i.8.i, label %panic.i.i.i.i - -cond_380_case_1.i.8.i: ; preds = %cond_380_case_1.i.7.i - %63 = xor i64 %61, 256 - store i64 %63, i64* %4, align 4 - %64 = getelementptr inbounds i8, i8* %1, i64 64 - %65 = bitcast i8* %64 to i64* - %66 = load i64, i64* %65, align 4 - tail call void @___qfree(i64 %66) - %67 = load i64, i64* %4, align 4 - %68 = and i64 %67, 512 - %.not.i99.i.i.9.i = icmp eq i64 %68, 0 - br i1 %.not.i99.i.i.9.i, label %cond_380_case_1.i.9.i, label %panic.i.i.i.i - -cond_380_case_1.i.9.i: ; preds = %cond_380_case_1.i.8.i - %69 = xor i64 %67, 512 - store i64 %69, i64* %4, align 4 - %70 = getelementptr inbounds i8, i8* %1, i64 72 - %71 = bitcast i8* %70 to i64* - %72 = load i64, i64* %71, align 4 - tail call void @___qfree(i64 %72) - %73 = load i64, i64* %4, align 4 - %74 = or i64 %73, -1024 - store i64 %74, i64* %4, align 4 - %75 = icmp eq i64 %74, -1 - br i1 %75, label %__hugr__.main.1.exit, label %mask_block_err.i.i.i.i - -__hugr__.main.1.exit: ; preds = %cond_380_case_1.i.9.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - %76 = tail call i64 @teardown() - ret i64 %76 +"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i + %72 = add nuw nsw i64 %"291_0.0182.i.i", 1 + %73 = shl nuw i64 1, %69 + %74 = xor i64 %73, %68 + store i64 %74, ptr %67, align 4 + %75 = getelementptr inbounds i64, ptr %.fca.0.extract81.i183.i.i, i64 %65 + %76 = load i64, ptr %75, align 4 + %.fca.1.0.0.0.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 0 + %.fca.1.0.0.1.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 1 + %.fca.1.0.0.2.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 2 + %77 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, i64 %72, 1 + %78 = insertvalue { { ptr, ptr, i64 }, i64 } %77, ptr %.fca.1.0.0.0.extract.i.i.i, 0, 0 + %79 = insertvalue { { ptr, ptr, i64 }, i64 } %78, ptr %.fca.1.0.0.1.extract.i.i.i, 0, 1 + %80 = insertvalue { { ptr, ptr, i64 }, i64 } %79, i64 %.fca.1.0.0.2.extract.i.i.i, 0, 2 + tail call void @___qfree(i64 %76) + %.not.i.i = icmp eq i64 %"291_0.0182.i.i", 9 + br i1 %.not.i.i, label %43, label %__barray_check_bounds.exit.i.i.i + +__hugr__.main.1.exit: ; preds = %61, %43 + tail call void @heap_free(ptr %.fca.1.0.0.0.extract.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.0.0.1.extract.i.i.i) + %81 = tail call i64 @teardown() + ret i64 %81 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-flip_some/flip_some_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-flip_some/flip_some_x86_64-unknown-linux-gnu index cab4ef0bf..9dced28f8 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-flip_some/flip_some_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-flip_some/flip_some_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @res_c0.7C14CD6E.0 = private constant [13 x i8] c"\0CUSER:BOOL:c0" @@ -17,14 +17,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -32,110 +32,70 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_40_case_0.i.i, label %__hugr__.__tk2_qalloc.36.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.36.exit.i, label %cond_40_case_0.i.i - -cond_40_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_40_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.36.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) +__hugr__.__tk2_qalloc.36.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) %qalloc.i101.i = tail call i64 @___qalloc() - %not_max.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 - br i1 %not_max.not.i102.i, label %id_bb.i105.i, label %reset_bb.i103.i - -reset_bb.i103.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i - tail call void @___reset(i64 %qalloc.i101.i) - br label %id_bb.i105.i + %not_max.not.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 + br i1 %not_max.not.not.i102.i, label %cond_54_case_0.i.i, label %__hugr__.__tk2_qalloc.50.exit.i -id_bb.i105.i: ; preds = %reset_bb.i103.i, %__hugr__.__tk2_qalloc.36.exit.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i101.i, 1 - %4 = select i1 %not_max.not.i102.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i104.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i104.i, label %__hugr__.__tk2_qalloc.50.exit.i, label %cond_54_case_0.i.i - -cond_54_case_0.i.i: ; preds = %id_bb.i105.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_54_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.50.exit.i: ; preds = %id_bb.i105.i - %.fca.1.extract.i106.i = extractvalue { i1, i64 } %4, 1 - %qalloc.i107.i = tail call i64 @___qalloc() - %not_max.not.i108.i = icmp eq i64 %qalloc.i107.i, -1 - br i1 %not_max.not.i108.i, label %id_bb.i111.i, label %reset_bb.i109.i - -reset_bb.i109.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i - tail call void @___reset(i64 %qalloc.i107.i) - br label %id_bb.i111.i - -id_bb.i111.i: ; preds = %reset_bb.i109.i, %__hugr__.__tk2_qalloc.50.exit.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i107.i, 1 - %6 = select i1 %not_max.not.i108.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i110.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i110.i, label %__hugr__.__tk2_qalloc.64.exit.i, label %cond_68_case_0.i.i +__hugr__.__tk2_qalloc.50.exit.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @___reset(i64 %qalloc.i101.i) + %qalloc.i103.i = tail call i64 @___qalloc() + %not_max.not.not.i104.i = icmp eq i64 %qalloc.i103.i, -1 + br i1 %not_max.not.not.i104.i, label %cond_68_case_0.i.i, label %__hugr__.__tk2_qalloc.64.exit.i -cond_68_case_0.i.i: ; preds = %id_bb.i111.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_68_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.64.exit.i: ; preds = %id_bb.i111.i - %.fca.1.extract.i112.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i112.i, double 0x400921FB54442D18, double 0.000000e+00) - %qalloc.i113.i = tail call i64 @___qalloc() - %not_max.not.i114.i = icmp eq i64 %qalloc.i113.i, -1 - br i1 %not_max.not.i114.i, label %id_bb.i117.i, label %reset_bb.i115.i - -reset_bb.i115.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i - tail call void @___reset(i64 %qalloc.i113.i) - br label %id_bb.i117.i - -id_bb.i117.i: ; preds = %reset_bb.i115.i, %__hugr__.__tk2_qalloc.64.exit.i - %7 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i113.i, 1 - %8 = select i1 %not_max.not.i114.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %7 - %.fca.0.extract.i116.i = extractvalue { i1, i64 } %8, 0 - br i1 %.fca.0.extract.i116.i, label %__hugr__.main.1.exit, label %cond_82_case_0.i.i - -cond_82_case_0.i.i: ; preds = %id_bb.i117.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +__hugr__.__tk2_qalloc.64.exit.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @___reset(i64 %qalloc.i103.i) + tail call void @___rxy(i64 %qalloc.i103.i, double 0x400921FB54442D18, double 0.000000e+00) + %qalloc.i105.i = tail call i64 @___qalloc() + %not_max.not.not.i106.i = icmp eq i64 %qalloc.i105.i, -1 + br i1 %not_max.not.not.i106.i, label %cond_82_case_0.i.i, label %__hugr__.main.1.exit + +cond_82_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.main.1.exit: ; preds = %id_bb.i117.i - %.fca.1.extract.i118.i = extractvalue { i1, i64 } %8, 1 - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @___reset(i64 %qalloc.i105.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c0.7C14CD6E.0, i64 0, i64 0), i64 12, i1 %read_bool.i) - %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i106.i) - tail call void @___qfree(i64 %.fca.1.extract.i106.i) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool.i) + %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %qalloc.i101.i) + tail call void @___qfree(i64 %qalloc.i101.i) %read_bool35.i = tail call i1 @___read_future_bool(i64 %lazy_measure22.i) tail call void @___dec_future_refcount(i64 %lazy_measure22.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c1.1F7A6571.0, i64 0, i64 0), i64 12, i1 %read_bool35.i) - %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i112.i) - tail call void @___qfree(i64 %.fca.1.extract.i112.i) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35.i) + %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %qalloc.i103.i) + tail call void @___qfree(i64 %qalloc.i103.i) %read_bool57.i = tail call i1 @___read_future_bool(i64 %lazy_measure44.i) tail call void @___dec_future_refcount(i64 %lazy_measure44.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c2.60825383.0, i64 0, i64 0), i64 12, i1 %read_bool57.i) - tail call void @___rxy(i64 %.fca.1.extract.i118.i, double 0x400921FB54442D18, double 0.000000e+00) - %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i118.i) - tail call void @___qfree(i64 %.fca.1.extract.i118.i) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57.i) + tail call void @___rxy(i64 %qalloc.i105.i, double 0x400921FB54442D18, double 0.000000e+00) + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i105.i) + tail call void @___qfree(i64 %qalloc.i105.i) %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c3.B223E16D.0, i64 0, i64 0), i64 12, i1 %read_bool80.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-measure_qb_array/measure_qb_array_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-measure_qb_array/measure_qb_array_x86_64-unknown-linux-gnu index 9951b3a8c..a6f9d1720 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-measure_qb_array/measure_qb_array_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-measure_qb_array/measure_qb_array_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,12 +8,12 @@ target triple = "x86_64-unknown-linux-gnu" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr @@ -30,279 +30,600 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0294.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0294.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_236_case_0.i.i - -cond_236_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_236_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0294.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0294.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0294.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.i, label %cond_20_case_1.i - -loop_out.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i258.i = icmp eq i64 %16, 0 - br i1 %.not.i258.i, label %__barray_mask_borrow.exit.i, label %panic.i259.i - -panic.i259.i: ; preds = %loop_out.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"128.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"128.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.0.insert.i", ptr %2, 1 + %"128.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.1.insert.i", i64 0, 2 + %42 = load i64, ptr %2, align 4 + %43 = trunc i64 %42 to i1 + br i1 %43, label %panic.i257.i, label %__barray_mask_borrow.exit.i + +panic.i257.i: ; preds = %cond_exit_20.i.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit.i: ; preds = %loop_out.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___rxy(i64 %18, double 0x400921FB54442D18, double 0.000000e+00) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 1 - %.not.i260.i = icmp eq i64 %20, 0 - br i1 %.not.i260.i, label %panic.i261.i, label %__barray_mask_return.exit262.i - -panic.i261.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) - unreachable +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.i.9 + %44 = or disjoint i64 %42, 1 + store i64 %44, ptr %2, align 4 + %45 = load i64, ptr %1, align 4 + tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) + %46 = load i64, ptr %2, align 4 + %47 = trunc i64 %46 to i1 + br i1 %47, label %__barray_mask_return.exit259.i, label %panic.i258.i -__barray_mask_return.exit262.i: ; preds = %__barray_mask_borrow.exit.i - %21 = xor i64 %19, 1 - store i64 %21, i64* %4, align 4 - store i64 %18, i64* %2, align 4 - %22 = load i64, i64* %4, align 4 - %23 = and i64 %22, 4 - %.not.i263.i = icmp eq i64 %23, 0 - br i1 %.not.i263.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i - -panic.i264.i: ; preds = %__barray_mask_return.exit262.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +panic.i258.i: ; preds = %__barray_mask_borrow.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit262.i - %24 = xor i64 %22, 4 - store i64 %24, i64* %4, align 4 - %25 = getelementptr inbounds i8, i8* %1, i64 16 - %26 = bitcast i8* %25 to i64* - %27 = load i64, i64* %26, align 4 - tail call void @___rxy(i64 %27, double 0x400921FB54442D18, double 0.000000e+00) - %28 = load i64, i64* %4, align 4 - %29 = and i64 %28, 4 - %.not.i266.i = icmp eq i64 %29, 0 - br i1 %.not.i266.i, label %panic.i267.i, label %__barray_mask_return.exit268.i - -panic.i267.i: ; preds = %__barray_mask_borrow.exit265.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit259.i: ; preds = %__barray_mask_borrow.exit.i + %48 = and i64 %46, -2 + store i64 %48, ptr %2, align 4 + store i64 %45, ptr %1, align 4 + %49 = load i64, ptr %2, align 4 + %50 = and i64 %49, 4 + %.not.i = icmp eq i64 %50, 0 + br i1 %.not.i, label %__barray_mask_borrow.exit261.i, label %panic.i260.i + +panic.i260.i: ; preds = %__barray_mask_return.exit259.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit268.i: ; preds = %__barray_mask_borrow.exit265.i - %30 = xor i64 %28, 4 - store i64 %30, i64* %4, align 4 - store i64 %27, i64* %26, align 4 - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i269.i = icmp eq i64 %32, 0 - br i1 %.not.i269.i, label %__barray_mask_borrow.exit271.i, label %panic.i270.i - -panic.i270.i: ; preds = %__barray_mask_return.exit268.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit261.i: ; preds = %__barray_mask_return.exit259.i + %51 = or disjoint i64 %49, 4 + store i64 %51, ptr %2, align 4 + %52 = load i64, ptr %13, align 4 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00) + %53 = load i64, ptr %2, align 4 + %54 = and i64 %53, 4 + %.not289.i = icmp eq i64 %54, 0 + br i1 %.not289.i, label %panic.i262.i, label %__barray_mask_return.exit263.i + +panic.i262.i: ; preds = %__barray_mask_borrow.exit261.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit271.i: ; preds = %__barray_mask_return.exit268.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___rxy(i64 %36, double 0x400921FB54442D18, double 0.000000e+00) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 8 - %.not.i272.i = icmp eq i64 %38, 0 - br i1 %.not.i272.i, label %panic.i273.i, label %__barray_mask_return.exit274.i - -panic.i273.i: ; preds = %__barray_mask_borrow.exit271.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit263.i: ; preds = %__barray_mask_borrow.exit261.i + %55 = and i64 %53, -5 + store i64 %55, ptr %2, align 4 + store i64 %52, ptr %13, align 4 + %56 = load i64, ptr %2, align 4 + %57 = and i64 %56, 8 + %.not290.i = icmp eq i64 %57, 0 + br i1 %.not290.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i + +panic.i264.i: ; preds = %__barray_mask_return.exit263.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit274.i: ; preds = %__barray_mask_borrow.exit271.i - %39 = xor i64 %37, 8 - store i64 %39, i64* %4, align 4 - store i64 %36, i64* %35, align 4 - %40 = load i64, i64* %4, align 4 - %41 = and i64 %40, 512 - %.not.i275.i = icmp eq i64 %41, 0 - br i1 %.not.i275.i, label %__barray_mask_borrow.exit277.i, label %panic.i276.i - -panic.i276.i: ; preds = %__barray_mask_return.exit274.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit263.i + %58 = or disjoint i64 %56, 8 + store i64 %58, ptr %2, align 4 + %59 = load i64, ptr %17, align 4 + tail call void @___rxy(i64 %59, double 0x400921FB54442D18, double 0.000000e+00) + %60 = load i64, ptr %2, align 4 + %61 = and i64 %60, 8 + %.not291.i = icmp eq i64 %61, 0 + br i1 %.not291.i, label %panic.i266.i, label %__barray_mask_return.exit267.i + +panic.i266.i: ; preds = %__barray_mask_borrow.exit265.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit277.i: ; preds = %__barray_mask_return.exit274.i - %42 = xor i64 %40, 512 - store i64 %42, i64* %4, align 4 - %43 = getelementptr inbounds i8, i8* %1, i64 72 - %44 = bitcast i8* %43 to i64* - %45 = load i64, i64* %44, align 4 - tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) - %46 = load i64, i64* %4, align 4 - %47 = and i64 %46, 512 - %.not.i278.i = icmp eq i64 %47, 0 - br i1 %.not.i278.i, label %panic.i279.i, label %__barray_mask_return.exit280.i +__barray_mask_return.exit267.i: ; preds = %__barray_mask_borrow.exit265.i + %62 = and i64 %60, -9 + store i64 %62, ptr %2, align 4 + store i64 %59, ptr %17, align 4 + %63 = load i64, ptr %2, align 4 + %64 = and i64 %63, 512 + %.not292.i = icmp eq i64 %64, 0 + br i1 %.not292.i, label %__barray_mask_borrow.exit269.i, label %panic.i268.i + +panic.i268.i: ; preds = %__barray_mask_return.exit267.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") + unreachable -panic.i279.i: ; preds = %__barray_mask_borrow.exit277.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit269.i: ; preds = %__barray_mask_return.exit267.i + %65 = or disjoint i64 %63, 512 + store i64 %65, ptr %2, align 4 + %66 = load i64, ptr %41, align 4 + tail call void @___rxy(i64 %66, double 0x400921FB54442D18, double 0.000000e+00) + %67 = load i64, ptr %2, align 4 + %68 = and i64 %67, 512 + %.not293.i = icmp eq i64 %68, 0 + br i1 %.not293.i, label %panic.i270.i, label %__barray_mask_return.exit271.i + +panic.i270.i: ; preds = %__barray_mask_borrow.exit269.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit280.i: ; preds = %__barray_mask_borrow.exit277.i - %48 = xor i64 %46, 512 - store i64 %48, i64* %4, align 4 - store i64 %45, i64* %44, align 4 - %49 = tail call i8* @heap_alloc(i64 240) - %50 = bitcast i8* %49 to { i1, i64, i1 }* - %51 = tail call i8* @heap_alloc(i64 8) - %52 = bitcast i8* %51 to i64* - store i64 -1, i64* %52, align 1 - br label %56 - -mask_block_ok.i.i.i.i: ; preds = %cond_exit_353.i.i - %53 = load i64, i64* %4, align 4 - %54 = or i64 %53, -1024 - store i64 %54, i64* %4, align 4 - %55 = icmp eq i64 %54, -1 - br i1 %55, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_err.i.i.i.i - -"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %mask_block_ok.i.i.i.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - br label %__barray_check_bounds.exit283.i +__barray_mask_return.exit271.i: ; preds = %__barray_mask_borrow.exit269.i + %69 = and i64 %67, -513 + store i64 %69, ptr %2, align 4 + store i64 %66, ptr %41, align 4 + %70 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"128.fca.2.insert.i", 0 + %71 = tail call ptr @heap_alloc(i64 240) + %72 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %72, align 1 + br label %__barray_check_bounds.exit.i.i.i + +73: ; preds = %loop_body.i.i + %74 = lshr i64 %.fca.2.extract83.i.i.i, 6 + %75 = getelementptr i64, ptr %.fca.1.extract82.i.i.i, i64 %74 + %76 = load i64, ptr %75, align 4 + %77 = and i64 %.fca.2.extract83.i.i.i, 63 + %78 = sub nuw nsw i64 64, %77 + %79 = lshr i64 -1, %78 + %80 = icmp eq i64 %77, 0 + %81 = select i1 %80, i64 0, i64 %79 + %82 = or i64 %76, %81 + store i64 %82, ptr %75, align 4 + %last_valid.i.i.i.i = add i64 %.fca.2.extract83.i.i.i, 9 + %83 = lshr i64 %last_valid.i.i.i.i, 6 + %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i.i.i, i64 %83 + %85 = load i64, ptr %84, align 4 + %86 = and i64 %last_valid.i.i.i.i, 63 + %87 = shl nsw i64 -2, %86 + %88 = icmp eq i64 %86, 63 + %89 = select i1 %88, i64 0, i64 %87 + %90 = or i64 %85, %89 + store i64 %90, ptr %84, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %83, %74 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +91: ; preds = %mask_block_ok.i.i.i.i + %92 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %73, %91 + %.02.i.i.i.i = phi i64 [ %92, %91 ], [ 0, %73 ] + %gep.i.i.i.i = getelementptr i64, ptr %75, i64 %.02.i.i.i.i + %93 = load i64, ptr %gep.i.i.i.i, align 4 + %94 = icmp eq i64 %93, -1 + br i1 %94, label %91, label %mask_block_err.i.i.i.i mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -56: ; preds = %cond_exit_353.i.i, %__barray_mask_return.exit280.i - %"303_0.sroa.15.0.i296.i" = phi i64 [ 0, %__barray_mask_return.exit280.i ], [ %57, %cond_exit_353.i.i ] - %57 = add nuw nsw i64 %"303_0.sroa.15.0.i296.i", 1 - %58 = lshr i64 %"303_0.sroa.15.0.i296.i", 6 - %59 = getelementptr inbounds i64, i64* %4, i64 %58 - %60 = load i64, i64* %59, align 4 - %61 = shl nuw nsw i64 1, %"303_0.sroa.15.0.i296.i" - %62 = and i64 %60, %61 - %.not.i99.i.i.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.i, label %__barray_check_bounds.exit.i.i, label %panic.i.i.i.i - -panic.i.i.i.i: ; preds = %56 - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit271.i + %.fca.2.extract83.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %.fca.2.extract83.i.i.i, %loop_body.i.i ] + %.fca.1.extract82.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit271.i ], [ %.fca.1.extract82.i.i.i, %loop_body.i.i ] + %.fca.0.extract81.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit271.i ], [ %.fca.0.extract81.i.i.i, %loop_body.i.i ] + %"303_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %95, %loop_body.i.i ] + %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit271.i ], [ %110, %loop_body.i.i ] + %95 = add nuw nsw i64 %"303_0.sroa.15.0184.i.i", 1 + %96 = add i64 %"303_0.sroa.15.0184.i.i", %.fca.2.extract83.i187.i.i + %97 = lshr i64 %96, 6 + %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i186.i.i, i64 %97 + %99 = load i64, ptr %98, align 4 + %100 = and i64 %96, 63 + %101 = lshr i64 %99, %100 + %102 = trunc i64 %101 to i1 + br i1 %102, label %panic.i.i.i.i, label %__barray_check_bounds.exit.i.i + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_check_bounds.exit.i.i: ; preds = %56 - %63 = xor i64 %60, %61 - store i64 %63, i64* %59, align 4 - %64 = getelementptr inbounds i64, i64* %2, i64 %"303_0.sroa.15.0.i296.i" - %65 = load i64, i64* %64, align 4 - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %65) - tail call void @___qfree(i64 %65) - %66 = getelementptr inbounds i64, i64* %52, i64 %58 - %67 = load i64, i64* %66, align 4 - %68 = and i64 %67, %61 - %.not.i.i.i = icmp eq i64 %68, 0 - br i1 %.not.i.i.i, label %panic.i.i.i, label %cond_exit_353.i.i +__barray_check_bounds.exit.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + %103 = shl nuw i64 1, %100 + %104 = xor i64 %103, %99 + store i64 %104, ptr %98, align 4 + %105 = getelementptr inbounds i64, ptr %.fca.0.extract81.i185.i.i, i64 %96 + %106 = load i64, ptr %105, align 4 + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %106) + tail call void @___qfree(i64 %106) + %107 = load i64, ptr %72, align 4 + %108 = lshr i64 %107, %"303_0.sroa.15.0184.i.i" + %109 = trunc i64 %108 to i1 + br i1 %109, label %loop_body.i.i, label %panic.i.i.i panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -cond_exit_353.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure.i.i, 1 - %69 = xor i64 %67, %61 - store i64 %69, i64* %66, align 4 - %70 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"303_0.sroa.15.0.i296.i" - store { i1, i64, i1 } %"367_054.fca.1.insert.i.i", { i1, i64, i1 }* %70, align 4 - %exitcond297.not.i = icmp eq i64 %57, 10 - br i1 %exitcond297.not.i, label %mask_block_ok.i.i.i.i, label %56 - -cond_87_case_0.i: ; preds = %cond_exit_87.i - %71 = load i64, i64* %52, align 4 - %72 = or i64 %71, -1024 - store i64 %72, i64* %52, align 4 - %73 = icmp eq i64 %72, -1 - br i1 %73, label %__hugr__.main.1.exit, label %mask_block_err.i.i - -mask_block_err.i.i: ; preds = %cond_87_case_0.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) +loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i + %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 + %"367_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"367_054.fca.1.insert.i.i", i1 undef, 2 + %110 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, i64 %95, 1 + %111 = shl nuw nsw i64 1, %"303_0.sroa.15.0184.i.i" + %112 = xor i64 %107, %111 + store i64 %112, ptr %72, align 4 + %113 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"303_0.sroa.15.0184.i.i" + store { i1, i64, i1 } %"367_054.fca.2.insert.i.i", ptr %113, align 4 + %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 + %.fca.0.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 + %.fca.1.extract82.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 + %.fca.2.extract83.i.i.i = extractvalue { ptr, ptr, i64 } %114, 2 + %exitcond.not.i.i = icmp eq i64 %95, 10 + br i1 %exitcond.not.i.i, label %73, label %__barray_check_bounds.exit.i.i.i + +"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %91, %73 + tail call void @heap_free(ptr %.fca.0.extract81.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.extract82.i.i.i) + %115 = load i64, ptr %72, align 4 + %116 = trunc i64 %115 to i1 + br i1 %116, label %cond_exit_87.thread.i, label %__barray_mask_borrow.exit278.i + +mask_block_err.i.i: ; preds = %cond_exit_87.thread.9.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -__barray_check_bounds.exit283.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i", %cond_exit_87.i - %"90_0.0.i1" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).277.exit.i" ], [ %74, %cond_exit_87.i ] - %74 = add nuw nsw i64 %"90_0.0.i1", 1 - %75 = lshr i64 %"90_0.0.i1", 6 - %76 = getelementptr inbounds i64, i64* %52, i64 %75 - %77 = load i64, i64* %76, align 4 - %78 = shl nuw nsw i64 1, %"90_0.0.i1" - %79 = and i64 %77, %78 - %.not.i = icmp eq i64 %79, 0 - br i1 %.not.i, label %__barray_mask_borrow.exit288.i, label %cond_exit_87.i - -__barray_mask_borrow.exit288.i: ; preds = %__barray_check_bounds.exit283.i - %80 = xor i64 %77, %78 - store i64 %80, i64* %76, align 4 - %81 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"90_0.0.i1" - %82 = load { i1, i64, i1 }, { i1, i64, i1 }* %81, align 4 - %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %82, 0 - br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.i - -cond_exit_87.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit288.i, %__barray_check_bounds.exit283.i - %exitcond.not = icmp eq i64 %74, 10 - br i1 %exitcond.not, label %cond_87_case_0.i, label %__barray_check_bounds.exit283.i - -cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit288.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %82, 1 +__barray_mask_borrow.exit278.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i" + %117 = or disjoint i64 %115, 1 + store i64 %117, ptr %72, align 4 + %118 = load { i1, i64, i1 }, ptr %71, align 4 + %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %118, 0 + br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.thread.i + +cond_exit_87.thread.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit278.i, %"__hugr__.$measure_array$$n(10).277.exit.i" + %119 = phi i64 [ %.pre.i, %cond_390_case_1.i ], [ %117, %__barray_mask_borrow.exit278.i ], [ %115, %"__hugr__.$measure_array$$n(10).277.exit.i" ] + %120 = and i64 %119, 2 + %.not311.i = icmp eq i64 %120, 0 + br i1 %.not311.i, label %__barray_mask_borrow.exit278.1.i, label %cond_exit_87.thread.1.i + +__barray_mask_borrow.exit278.1.i: ; preds = %cond_exit_87.thread.i + %121 = or disjoint i64 %119, 2 + store i64 %121, ptr %72, align 4 + %122 = getelementptr inbounds nuw i8, ptr %71, i64 24 + %123 = load { i1, i64, i1 }, ptr %122, align 4 + %.fca.0.extract179.1.i = extractvalue { i1, i64, i1 } %123, 0 + br i1 %.fca.0.extract179.1.i, label %cond_390_case_1.1.i, label %cond_exit_87.thread.1.i + +cond_390_case_1.1.i: ; preds = %__barray_mask_borrow.exit278.1.i + %.fca.1.extract.1.i = extractvalue { i1, i64, i1 } %123, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1.i) + %.pre302.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.1.i + +cond_exit_87.thread.1.i: ; preds = %cond_390_case_1.1.i, %__barray_mask_borrow.exit278.1.i, %cond_exit_87.thread.i + %124 = phi i64 [ %.pre302.i, %cond_390_case_1.1.i ], [ %121, %__barray_mask_borrow.exit278.1.i ], [ %119, %cond_exit_87.thread.i ] + %125 = and i64 %124, 4 + %.not312.i = icmp eq i64 %125, 0 + br i1 %.not312.i, label %__barray_mask_borrow.exit278.2.i, label %cond_exit_87.thread.2.i + +__barray_mask_borrow.exit278.2.i: ; preds = %cond_exit_87.thread.1.i + %126 = or disjoint i64 %124, 4 + store i64 %126, ptr %72, align 4 + %127 = getelementptr inbounds nuw i8, ptr %71, i64 48 + %128 = load { i1, i64, i1 }, ptr %127, align 4 + %.fca.0.extract179.2.i = extractvalue { i1, i64, i1 } %128, 0 + br i1 %.fca.0.extract179.2.i, label %cond_390_case_1.2.i, label %cond_exit_87.thread.2.i + +cond_390_case_1.2.i: ; preds = %__barray_mask_borrow.exit278.2.i + %.fca.1.extract.2.i = extractvalue { i1, i64, i1 } %128, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2.i) + %.pre303.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.2.i + +cond_exit_87.thread.2.i: ; preds = %cond_390_case_1.2.i, %__barray_mask_borrow.exit278.2.i, %cond_exit_87.thread.1.i + %129 = phi i64 [ %.pre303.i, %cond_390_case_1.2.i ], [ %126, %__barray_mask_borrow.exit278.2.i ], [ %124, %cond_exit_87.thread.1.i ] + %130 = and i64 %129, 8 + %.not313.i = icmp eq i64 %130, 0 + br i1 %.not313.i, label %__barray_mask_borrow.exit278.3.i, label %cond_exit_87.thread.3.i + +__barray_mask_borrow.exit278.3.i: ; preds = %cond_exit_87.thread.2.i + %131 = or disjoint i64 %129, 8 + store i64 %131, ptr %72, align 4 + %132 = getelementptr inbounds nuw i8, ptr %71, i64 72 + %133 = load { i1, i64, i1 }, ptr %132, align 4 + %.fca.0.extract179.3.i = extractvalue { i1, i64, i1 } %133, 0 + br i1 %.fca.0.extract179.3.i, label %cond_390_case_1.3.i, label %cond_exit_87.thread.3.i + +cond_390_case_1.3.i: ; preds = %__barray_mask_borrow.exit278.3.i + %.fca.1.extract.3.i = extractvalue { i1, i64, i1 } %133, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3.i) + %.pre304.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.3.i + +cond_exit_87.thread.3.i: ; preds = %cond_390_case_1.3.i, %__barray_mask_borrow.exit278.3.i, %cond_exit_87.thread.2.i + %134 = phi i64 [ %.pre304.i, %cond_390_case_1.3.i ], [ %131, %__barray_mask_borrow.exit278.3.i ], [ %129, %cond_exit_87.thread.2.i ] + %135 = and i64 %134, 16 + %.not314.i = icmp eq i64 %135, 0 + br i1 %.not314.i, label %__barray_mask_borrow.exit278.4.i, label %cond_exit_87.thread.4.i + +__barray_mask_borrow.exit278.4.i: ; preds = %cond_exit_87.thread.3.i + %136 = or disjoint i64 %134, 16 + store i64 %136, ptr %72, align 4 + %137 = getelementptr inbounds nuw i8, ptr %71, i64 96 + %138 = load { i1, i64, i1 }, ptr %137, align 4 + %.fca.0.extract179.4.i = extractvalue { i1, i64, i1 } %138, 0 + br i1 %.fca.0.extract179.4.i, label %cond_390_case_1.4.i, label %cond_exit_87.thread.4.i + +cond_390_case_1.4.i: ; preds = %__barray_mask_borrow.exit278.4.i + %.fca.1.extract.4.i = extractvalue { i1, i64, i1 } %138, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4.i) + %.pre305.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.4.i + +cond_exit_87.thread.4.i: ; preds = %cond_390_case_1.4.i, %__barray_mask_borrow.exit278.4.i, %cond_exit_87.thread.3.i + %139 = phi i64 [ %.pre305.i, %cond_390_case_1.4.i ], [ %136, %__barray_mask_borrow.exit278.4.i ], [ %134, %cond_exit_87.thread.3.i ] + %140 = and i64 %139, 32 + %.not315.i = icmp eq i64 %140, 0 + br i1 %.not315.i, label %__barray_mask_borrow.exit278.5.i, label %cond_exit_87.thread.5.i + +__barray_mask_borrow.exit278.5.i: ; preds = %cond_exit_87.thread.4.i + %141 = or disjoint i64 %139, 32 + store i64 %141, ptr %72, align 4 + %142 = getelementptr inbounds nuw i8, ptr %71, i64 120 + %143 = load { i1, i64, i1 }, ptr %142, align 4 + %.fca.0.extract179.5.i = extractvalue { i1, i64, i1 } %143, 0 + br i1 %.fca.0.extract179.5.i, label %cond_390_case_1.5.i, label %cond_exit_87.thread.5.i + +cond_390_case_1.5.i: ; preds = %__barray_mask_borrow.exit278.5.i + %.fca.1.extract.5.i = extractvalue { i1, i64, i1 } %143, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5.i) + %.pre306.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.5.i + +cond_exit_87.thread.5.i: ; preds = %cond_390_case_1.5.i, %__barray_mask_borrow.exit278.5.i, %cond_exit_87.thread.4.i + %144 = phi i64 [ %.pre306.i, %cond_390_case_1.5.i ], [ %141, %__barray_mask_borrow.exit278.5.i ], [ %139, %cond_exit_87.thread.4.i ] + %145 = and i64 %144, 64 + %.not316.i = icmp eq i64 %145, 0 + br i1 %.not316.i, label %__barray_mask_borrow.exit278.6.i, label %cond_exit_87.thread.6.i + +__barray_mask_borrow.exit278.6.i: ; preds = %cond_exit_87.thread.5.i + %146 = or disjoint i64 %144, 64 + store i64 %146, ptr %72, align 4 + %147 = getelementptr inbounds nuw i8, ptr %71, i64 144 + %148 = load { i1, i64, i1 }, ptr %147, align 4 + %.fca.0.extract179.6.i = extractvalue { i1, i64, i1 } %148, 0 + br i1 %.fca.0.extract179.6.i, label %cond_390_case_1.6.i, label %cond_exit_87.thread.6.i + +cond_390_case_1.6.i: ; preds = %__barray_mask_borrow.exit278.6.i + %.fca.1.extract.6.i = extractvalue { i1, i64, i1 } %148, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6.i) + %.pre307.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.6.i + +cond_exit_87.thread.6.i: ; preds = %cond_390_case_1.6.i, %__barray_mask_borrow.exit278.6.i, %cond_exit_87.thread.5.i + %149 = phi i64 [ %.pre307.i, %cond_390_case_1.6.i ], [ %146, %__barray_mask_borrow.exit278.6.i ], [ %144, %cond_exit_87.thread.5.i ] + %150 = and i64 %149, 128 + %.not317.i = icmp eq i64 %150, 0 + br i1 %.not317.i, label %__barray_mask_borrow.exit278.7.i, label %cond_exit_87.thread.7.i + +__barray_mask_borrow.exit278.7.i: ; preds = %cond_exit_87.thread.6.i + %151 = or disjoint i64 %149, 128 + store i64 %151, ptr %72, align 4 + %152 = getelementptr inbounds nuw i8, ptr %71, i64 168 + %153 = load { i1, i64, i1 }, ptr %152, align 4 + %.fca.0.extract179.7.i = extractvalue { i1, i64, i1 } %153, 0 + br i1 %.fca.0.extract179.7.i, label %cond_390_case_1.7.i, label %cond_exit_87.thread.7.i + +cond_390_case_1.7.i: ; preds = %__barray_mask_borrow.exit278.7.i + %.fca.1.extract.7.i = extractvalue { i1, i64, i1 } %153, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7.i) + %.pre308.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.7.i + +cond_exit_87.thread.7.i: ; preds = %cond_390_case_1.7.i, %__barray_mask_borrow.exit278.7.i, %cond_exit_87.thread.6.i + %154 = phi i64 [ %.pre308.i, %cond_390_case_1.7.i ], [ %151, %__barray_mask_borrow.exit278.7.i ], [ %149, %cond_exit_87.thread.6.i ] + %155 = and i64 %154, 256 + %.not318.i = icmp eq i64 %155, 0 + br i1 %.not318.i, label %__barray_mask_borrow.exit278.8.i, label %cond_exit_87.thread.8.i + +__barray_mask_borrow.exit278.8.i: ; preds = %cond_exit_87.thread.7.i + %156 = or disjoint i64 %154, 256 + store i64 %156, ptr %72, align 4 + %157 = getelementptr inbounds nuw i8, ptr %71, i64 192 + %158 = load { i1, i64, i1 }, ptr %157, align 4 + %.fca.0.extract179.8.i = extractvalue { i1, i64, i1 } %158, 0 + br i1 %.fca.0.extract179.8.i, label %cond_390_case_1.8.i, label %cond_exit_87.thread.8.i + +cond_390_case_1.8.i: ; preds = %__barray_mask_borrow.exit278.8.i + %.fca.1.extract.8.i = extractvalue { i1, i64, i1 } %158, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8.i) + %.pre309.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.8.i + +cond_exit_87.thread.8.i: ; preds = %cond_390_case_1.8.i, %__barray_mask_borrow.exit278.8.i, %cond_exit_87.thread.7.i + %159 = phi i64 [ %.pre309.i, %cond_390_case_1.8.i ], [ %156, %__barray_mask_borrow.exit278.8.i ], [ %154, %cond_exit_87.thread.7.i ] + %160 = and i64 %159, 512 + %.not319.i = icmp eq i64 %160, 0 + br i1 %.not319.i, label %__barray_mask_borrow.exit278.9.i, label %cond_exit_87.thread.9.i + +__barray_mask_borrow.exit278.9.i: ; preds = %cond_exit_87.thread.8.i + %161 = or disjoint i64 %159, 512 + store i64 %161, ptr %72, align 4 + %162 = getelementptr inbounds nuw i8, ptr %71, i64 216 + %163 = load { i1, i64, i1 }, ptr %162, align 4 + %.fca.0.extract179.9.i = extractvalue { i1, i64, i1 } %163, 0 + br i1 %.fca.0.extract179.9.i, label %cond_390_case_1.9.i, label %cond_exit_87.thread.9.i + +cond_390_case_1.9.i: ; preds = %__barray_mask_borrow.exit278.9.i + %.fca.1.extract.9.i = extractvalue { i1, i64, i1 } %163, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9.i) + %.pre310.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.9.i + +cond_exit_87.thread.9.i: ; preds = %cond_390_case_1.9.i, %__barray_mask_borrow.exit278.9.i, %cond_exit_87.thread.8.i + %164 = phi i64 [ %.pre310.i, %cond_390_case_1.9.i ], [ %161, %__barray_mask_borrow.exit278.9.i ], [ %159, %cond_exit_87.thread.8.i ] + %165 = or i64 %164, -1024 + store i64 %165, ptr %72, align 4 + %166 = icmp eq i64 %165, -1 + br i1 %166, label %__hugr__.main.1.exit, label %mask_block_err.i.i + +cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit278.i + %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - br label %cond_exit_87.i - -__hugr__.main.1.exit: ; preds = %cond_87_case_0.i - tail call void @heap_free(i8* %49) - tail call void @heap_free(i8* nonnull %51) - %83 = tail call i64 @teardown() - ret i64 %83 + %.pre.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.i + +__hugr__.main.1.exit: ; preds = %cond_exit_87.thread.9.i + tail call void @heap_free(ptr %71) + tail call void @heap_free(ptr nonnull %72) + %167 = tail call i64 @teardown() + ret i64 %167 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-no_results/no_results_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-no_results/no_results_x86_64-unknown-linux-gnu index 798877d60..970d19465 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-no_results/no_results_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-no_results/no_results_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." @@ -16,7 +16,7 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -26,32 +26,22 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_18_case_0.i.i, label %__hugr__.bar.1.exit -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.bar.1.exit, label %cond_18_case_0.i.i - -cond_18_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_18_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.bar.1.exit: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.bar.1.exit: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - %3 = tail call i64 @teardown() - ret i64 %3 + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_exit/postselect_exit_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_exit/postselect_exit_x86_64-unknown-linux-gnu index bd17cb1d4..adda0f836 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_exit/postselect_exit_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_exit/postselect_exit_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 42, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 42, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_panic/postselect_panic_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_panic/postselect_panic_x86_64-unknown-linux-gnu index fed135763..a673fa439 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_panic/postselect_panic_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-postselect_panic/postselect_panic_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 1001, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-print_current_shot/print_current_shot_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-print_current_shot/print_current_shot_x86_64-unknown-linux-gnu index 8f36109c0..eac1eb476 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-print_current_shot/print_current_shot_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-print_current_shot/print_current_shot_x86_64-unknown-linux-gnu @@ -1,19 +1,19 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" declare i64 @get_current_shot() local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_shot.6D86EAF7.0, i64 0, i64 0), i64 13, i64 %shot.i) + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) %1 = tail call i64 @teardown() ret i64 %1 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rng/rng_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rng/rng_x86_64-unknown-linux-gnu index a9ff4d595..3292c11e6 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rng/rng_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rng/rng_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @res_rint.B928E41E.0 = private constant [14 x i8] c"\0DUSER:INT:rint" @@ -17,9 +17,9 @@ declare double @random_float() local_unnamed_addr declare i32 @random_rng(i32) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr @@ -34,19 +34,19 @@ entry: %1 = sext i32 %rintb.i to i64 %2 = sext i32 %rint20.i to i64 %3 = sext i32 %rint.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_rint.B928E41E.0, i64 0, i64 0), i64 13, i64 %3) - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint1.0884EC03.0, i64 0, i64 0), i64 14, i64 %2) - tail call void @print_float(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rfloat.F0E4DD2C.0, i64 0, i64 0), i64 17, double %rfloat.i) - tail call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rint_bnd.CB1E6B0D.0, i64 0, i64 0), i64 17, i64 %1) + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %3) + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %2) + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat.i) + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %1) tail call void @random_seed(i64 84) %rint53.i = tail call i32 @random_int() %rfloat55.i = tail call double @random_float() %rintb58.i = tail call i32 @random_rng(i32 200) %4 = sext i32 %rintb58.i to i64 %5 = sext i32 %rint53.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint2.F0335598.0, i64 0, i64 0), i64 14, i64 %5) - tail call void @print_float(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rfloat2.4DAB941F.0, i64 0, i64 0), i64 18, double %rfloat55.i) - tail call void @print_int(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rint_bnd2.169DE399.0, i64 0, i64 0), i64 18, i64 %4) + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %5) + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat55.i) + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %4) %6 = tail call i64 @teardown() ret i64 %6 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rus/rus_x86_64-unknown-linux-gnu b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rus/rus_x86_64-unknown-linux-gnu index f02c48787..ed9940c71 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rus/rus_x86_64-unknown-linux-gnu +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-unknown-linux-gnu-rus/rus_x86_64-unknown-linux-gnu @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @@ -14,14 +14,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -33,119 +33,89 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_87_case_0.i.i, label %__hugr__.__tk2_qalloc.83.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.83.exit.i, label %cond_87_case_0.i.i - -cond_87_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_87_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.83.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - br label %cond_242_case_1.i.i - -cond_242_case_1.i.i: ; preds = %cond_242_case_1.i.i.backedge, %__hugr__.__tk2_qalloc.83.exit.i - %qalloc.i.i.i = tail call i64 @___qalloc() - %not_max.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 - br i1 %not_max.not.i.i.i, label %id_bb.i.i.i, label %reset_bb.i.i.i - -reset_bb.i.i.i: ; preds = %cond_242_case_1.i.i - tail call void @___reset(i64 %qalloc.i.i.i) - br label %id_bb.i.i.i - -id_bb.i.i.i: ; preds = %reset_bb.i.i.i, %cond_242_case_1.i.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i.i, 1 - %4 = select i1 %not_max.not.i.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i.i.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i, label %cond_101_case_0.i.i.i +__hugr__.__tk2_qalloc.83.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %qalloc.i132.i.i = tail call i64 @___qalloc() + %not_max.not.not.i133.i.i = icmp eq i64 %qalloc.i132.i.i, -1 + br i1 %not_max.not.not.i133.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i -cond_101_case_0.i.i.i: ; preds = %id_bb.i.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_101_case_0.i.i.i: ; preds = %cond_242_case_1.backedge.i.i, %__hugr__.__tk2_qalloc.83.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %id_bb.i.i.i - %.fca.1.extract.i.i.i = extractvalue { i1, i64 } %4, 1 +__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.83.exit.i, %cond_242_case_1.backedge.i.i + %qalloc.i134.i.i = phi i64 [ %qalloc.i.i.i, %cond_242_case_1.backedge.i.i ], [ %qalloc.i132.i.i, %__hugr__.__tk2_qalloc.83.exit.i ] + tail call void @___reset(i64 %qalloc.i134.i.i) %qalloc.i128.i.i = tail call i64 @___qalloc() - %not_max.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 - br i1 %not_max.not.i129.i.i, label %id_bb.i132.i.i, label %reset_bb.i130.i.i + %not_max.not.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 + br i1 %not_max.not.not.i129.i.i, label %cond_115_case_0.i.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i -reset_bb.i130.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i - tail call void @___reset(i64 %qalloc.i128.i.i) - br label %id_bb.i132.i.i - -id_bb.i132.i.i: ; preds = %reset_bb.i130.i.i, %__hugr__.__tk2_qalloc.97.exit.i.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i128.i.i, 1 - %6 = select i1 %not_max.not.i129.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i131.i.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i131.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i, label %cond_115_case_0.i.i.i - -cond_115_case_0.i.i.i: ; preds = %id_bb.i132.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_115_case_0.i.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %id_bb.i132.i.i - %.fca.1.extract.i133.i.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFE921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i133.i.i, i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x3FE921FB54442D18) - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i.i) +__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @___reset(i64 %qalloc.i128.i.i) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFE921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i128.i.i, i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x3FE921FB54442D18) + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i.i) + tail call void @___qfree(i64 %qalloc.i134.i.i) %read_bool.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i.i) - br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %7 + br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %1 -7: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) - br label %cond_242_case_1.i.i.backedge +1: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i + tail call void @___qfree(i64 %qalloc.i128.i.i) + br label %cond_242_case_1.backedge.i.i + +cond_242_case_1.backedge.i.i: ; preds = %2, %1 + %qalloc.i.i.i = tail call i64 @___qalloc() + %not_max.not.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 + br i1 %not_max.not.not.i.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i cond_256_case_1.i.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x3FE921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i.i, i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x3FE921FB54442D18) - %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i133.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) + tail call void @___rz(i64 %qalloc.i.i, double 0x3FE921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i.i, i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x3FE921FB54442D18) + %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i.i) + tail call void @___qfree(i64 %qalloc.i128.i.i) %read_bool80.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i.i) - br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %8 - -8: ; preds = %cond_256_case_1.i.i - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) - br label %cond_242_case_1.i.i.backedge + br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %2 -cond_242_case_1.i.i.backedge: ; preds = %8, %7 - br label %cond_242_case_1.i.i +2: ; preds = %cond_256_case_1.i.i + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) + br label %cond_242_case_1.backedge.i.i __hugr__.main.1.exit: ; preds = %cond_256_case_1.i.i - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @res_result.457DE32D.0, i64 0, i64 0), i64 16, i1 %read_bool.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) + %3 = tail call i64 @teardown() + ret i64 %3 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-discard_qb_array/discard_qb_array_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-discard_qb_array/discard_qb_array_x86_64-windows-msvc index c7a4dc926..9b53ca4b0 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-discard_qb_array/discard_qb_array_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-discard_qb_array/discard_qb_array_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,14 +8,14 @@ target triple = "x86_64-windows-msvc" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___qfree(i64) local_unnamed_addr -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -24,194 +24,264 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0114.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0114.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_211_case_0.i.i - -cond_211_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_211_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0114.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0114.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0114.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.preheader.preheader.i, label %cond_20_case_1.i - -loop_out.preheader.preheader.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i99.i.i.i = icmp eq i64 %16, 0 - br i1 %.not.i99.i.i.i, label %cond_380_case_1.i.i, label %panic.i.i.i.i - -mask_block_err.i.i.i.i: ; preds = %cond_380_case_1.i.9.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_211_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"120.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"120.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.0.insert.i", ptr %2, 1 + %"120.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"120.fca.1.insert.i", i64 0, 2 + %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"120.fca.2.insert.i", 0 + br label %__barray_check_bounds.exit.i.i.i + +43: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + %44 = lshr i64 %.fca.1.0.0.2.extract.i.i.i, 6 + %45 = getelementptr i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %44 + %46 = load i64, ptr %45, align 4 + %47 = and i64 %.fca.1.0.0.2.extract.i.i.i, 63 + %48 = sub nuw nsw i64 64, %47 + %49 = lshr i64 -1, %48 + %50 = icmp eq i64 %47, 0 + %51 = select i1 %50, i64 0, i64 %49 + %52 = or i64 %46, %51 + store i64 %52, ptr %45, align 4 + %last_valid.i.i.i.i = add i64 %.fca.1.0.0.2.extract.i.i.i, 9 + %53 = lshr i64 %last_valid.i.i.i.i, 6 + %54 = getelementptr inbounds nuw i64, ptr %.fca.1.0.0.1.extract.i.i.i, i64 %53 + %55 = load i64, ptr %54, align 4 + %56 = and i64 %last_valid.i.i.i.i, 63 + %57 = shl nsw i64 -2, %56 + %58 = icmp eq i64 %56, 63 + %59 = select i1 %58, i64 0, i64 %57 + %60 = or i64 %55, %59 + store i64 %60, ptr %54, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %53, %44 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +61: ; preds = %mask_block_ok.i.i.i.i + %62 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %__hugr__.main.1.exit, label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %43, %61 + %.02.i.i.i.i = phi i64 [ %62, %61 ], [ 0, %43 ] + %gep.i.i.i.i = getelementptr i64, ptr %45, i64 %.02.i.i.i.i + %63 = load i64, ptr %gep.i.i.i.i, align 4 + %64 = icmp eq i64 %63, -1 + br i1 %64, label %61, label %mask_block_err.i.i.i.i + +mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -panic.i.i.i.i: ; preds = %cond_380_case_1.i.8.i, %cond_380_case_1.i.7.i, %cond_380_case_1.i.6.i, %cond_380_case_1.i.5.i, %cond_380_case_1.i.4.i, %cond_380_case_1.i.3.i, %cond_380_case_1.i.2.i, %cond_380_case_1.i.1.i, %cond_380_case_1.i.i, %loop_out.preheader.preheader.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i", %cond_exit_20.i.9 + %.fca.2.extract83.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.1.extract82.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.fca.0.extract81.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %"291_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" ] + %65 = add i64 %"291_0.0182.i.i", %.fca.2.extract83.i185.i.i + %66 = lshr i64 %65, 6 + %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i184.i.i, i64 %66 + %68 = load i64, ptr %67, align 4 + %69 = and i64 %65, 63 + %70 = lshr i64 %68, %69 + %71 = trunc i64 %70 to i1 + br i1 %71, label %panic.i.i.i.i, label %"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i" + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -cond_380_case_1.i.i: ; preds = %loop_out.preheader.preheader.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___qfree(i64 %18) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 2 - %.not.i99.i.i.1.i = icmp eq i64 %20, 0 - br i1 %.not.i99.i.i.1.i, label %cond_380_case_1.i.1.i, label %panic.i.i.i.i - -cond_380_case_1.i.1.i: ; preds = %cond_380_case_1.i.i - %21 = xor i64 %19, 2 - store i64 %21, i64* %4, align 4 - %22 = getelementptr inbounds i8, i8* %1, i64 8 - %23 = bitcast i8* %22 to i64* - %24 = load i64, i64* %23, align 4 - tail call void @___qfree(i64 %24) - %25 = load i64, i64* %4, align 4 - %26 = and i64 %25, 4 - %.not.i99.i.i.2.i = icmp eq i64 %26, 0 - br i1 %.not.i99.i.i.2.i, label %cond_380_case_1.i.2.i, label %panic.i.i.i.i - -cond_380_case_1.i.2.i: ; preds = %cond_380_case_1.i.1.i - %27 = xor i64 %25, 4 - store i64 %27, i64* %4, align 4 - %28 = getelementptr inbounds i8, i8* %1, i64 16 - %29 = bitcast i8* %28 to i64* - %30 = load i64, i64* %29, align 4 - tail call void @___qfree(i64 %30) - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i99.i.i.3.i = icmp eq i64 %32, 0 - br i1 %.not.i99.i.i.3.i, label %cond_380_case_1.i.3.i, label %panic.i.i.i.i - -cond_380_case_1.i.3.i: ; preds = %cond_380_case_1.i.2.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___qfree(i64 %36) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 16 - %.not.i99.i.i.4.i = icmp eq i64 %38, 0 - br i1 %.not.i99.i.i.4.i, label %cond_380_case_1.i.4.i, label %panic.i.i.i.i - -cond_380_case_1.i.4.i: ; preds = %cond_380_case_1.i.3.i - %39 = xor i64 %37, 16 - store i64 %39, i64* %4, align 4 - %40 = getelementptr inbounds i8, i8* %1, i64 32 - %41 = bitcast i8* %40 to i64* - %42 = load i64, i64* %41, align 4 - tail call void @___qfree(i64 %42) - %43 = load i64, i64* %4, align 4 - %44 = and i64 %43, 32 - %.not.i99.i.i.5.i = icmp eq i64 %44, 0 - br i1 %.not.i99.i.i.5.i, label %cond_380_case_1.i.5.i, label %panic.i.i.i.i - -cond_380_case_1.i.5.i: ; preds = %cond_380_case_1.i.4.i - %45 = xor i64 %43, 32 - store i64 %45, i64* %4, align 4 - %46 = getelementptr inbounds i8, i8* %1, i64 40 - %47 = bitcast i8* %46 to i64* - %48 = load i64, i64* %47, align 4 - tail call void @___qfree(i64 %48) - %49 = load i64, i64* %4, align 4 - %50 = and i64 %49, 64 - %.not.i99.i.i.6.i = icmp eq i64 %50, 0 - br i1 %.not.i99.i.i.6.i, label %cond_380_case_1.i.6.i, label %panic.i.i.i.i - -cond_380_case_1.i.6.i: ; preds = %cond_380_case_1.i.5.i - %51 = xor i64 %49, 64 - store i64 %51, i64* %4, align 4 - %52 = getelementptr inbounds i8, i8* %1, i64 48 - %53 = bitcast i8* %52 to i64* - %54 = load i64, i64* %53, align 4 - tail call void @___qfree(i64 %54) - %55 = load i64, i64* %4, align 4 - %56 = and i64 %55, 128 - %.not.i99.i.i.7.i = icmp eq i64 %56, 0 - br i1 %.not.i99.i.i.7.i, label %cond_380_case_1.i.7.i, label %panic.i.i.i.i - -cond_380_case_1.i.7.i: ; preds = %cond_380_case_1.i.6.i - %57 = xor i64 %55, 128 - store i64 %57, i64* %4, align 4 - %58 = getelementptr inbounds i8, i8* %1, i64 56 - %59 = bitcast i8* %58 to i64* - %60 = load i64, i64* %59, align 4 - tail call void @___qfree(i64 %60) - %61 = load i64, i64* %4, align 4 - %62 = and i64 %61, 256 - %.not.i99.i.i.8.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.8.i, label %cond_380_case_1.i.8.i, label %panic.i.i.i.i - -cond_380_case_1.i.8.i: ; preds = %cond_380_case_1.i.7.i - %63 = xor i64 %61, 256 - store i64 %63, i64* %4, align 4 - %64 = getelementptr inbounds i8, i8* %1, i64 64 - %65 = bitcast i8* %64 to i64* - %66 = load i64, i64* %65, align 4 - tail call void @___qfree(i64 %66) - %67 = load i64, i64* %4, align 4 - %68 = and i64 %67, 512 - %.not.i99.i.i.9.i = icmp eq i64 %68, 0 - br i1 %.not.i99.i.i.9.i, label %cond_380_case_1.i.9.i, label %panic.i.i.i.i - -cond_380_case_1.i.9.i: ; preds = %cond_380_case_1.i.8.i - %69 = xor i64 %67, 512 - store i64 %69, i64* %4, align 4 - %70 = getelementptr inbounds i8, i8* %1, i64 72 - %71 = bitcast i8* %70 to i64* - %72 = load i64, i64* %71, align 4 - tail call void @___qfree(i64 %72) - %73 = load i64, i64* %4, align 4 - %74 = or i64 %73, -1024 - store i64 %74, i64* %4, align 4 - %75 = icmp eq i64 %74, -1 - br i1 %75, label %__hugr__.main.1.exit, label %mask_block_err.i.i.i.i - -__hugr__.main.1.exit: ; preds = %cond_380_case_1.i.9.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - %76 = tail call i64 @teardown() - ret i64 %76 +"__hugr__.$__next__$$t(qubit)$n(10).299.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i + %72 = add nuw nsw i64 %"291_0.0182.i.i", 1 + %73 = shl nuw i64 1, %69 + %74 = xor i64 %73, %68 + store i64 %74, ptr %67, align 4 + %75 = getelementptr inbounds i64, ptr %.fca.0.extract81.i183.i.i, i64 %65 + %76 = load i64, ptr %75, align 4 + %.fca.1.0.0.0.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 0 + %.fca.1.0.0.1.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 1 + %.fca.1.0.0.2.extract.i.i.i = extractvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, 0, 2 + %77 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn181.i.i, i64 %72, 1 + %78 = insertvalue { { ptr, ptr, i64 }, i64 } %77, ptr %.fca.1.0.0.0.extract.i.i.i, 0, 0 + %79 = insertvalue { { ptr, ptr, i64 }, i64 } %78, ptr %.fca.1.0.0.1.extract.i.i.i, 0, 1 + %80 = insertvalue { { ptr, ptr, i64 }, i64 } %79, i64 %.fca.1.0.0.2.extract.i.i.i, 0, 2 + tail call void @___qfree(i64 %76) + %.not.i.i = icmp eq i64 %"291_0.0182.i.i", 9 + br i1 %.not.i.i, label %43, label %__barray_check_bounds.exit.i.i.i + +__hugr__.main.1.exit: ; preds = %61, %43 + tail call void @heap_free(ptr %.fca.1.0.0.0.extract.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.0.0.1.extract.i.i.i) + %81 = tail call i64 @teardown() + ret i64 %81 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-flip_some/flip_some_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-flip_some/flip_some_x86_64-windows-msvc index ed0a6e2b5..9806d626b 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-flip_some/flip_some_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-flip_some/flip_some_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @res_c0.7C14CD6E.0 = private constant [13 x i8] c"\0CUSER:BOOL:c0" @@ -17,14 +17,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -32,110 +32,70 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_40_case_0.i.i, label %__hugr__.__tk2_qalloc.36.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.36.exit.i, label %cond_40_case_0.i.i - -cond_40_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_40_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.36.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) +__hugr__.__tk2_qalloc.36.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) %qalloc.i101.i = tail call i64 @___qalloc() - %not_max.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 - br i1 %not_max.not.i102.i, label %id_bb.i105.i, label %reset_bb.i103.i - -reset_bb.i103.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i - tail call void @___reset(i64 %qalloc.i101.i) - br label %id_bb.i105.i + %not_max.not.not.i102.i = icmp eq i64 %qalloc.i101.i, -1 + br i1 %not_max.not.not.i102.i, label %cond_54_case_0.i.i, label %__hugr__.__tk2_qalloc.50.exit.i -id_bb.i105.i: ; preds = %reset_bb.i103.i, %__hugr__.__tk2_qalloc.36.exit.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i101.i, 1 - %4 = select i1 %not_max.not.i102.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i104.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i104.i, label %__hugr__.__tk2_qalloc.50.exit.i, label %cond_54_case_0.i.i - -cond_54_case_0.i.i: ; preds = %id_bb.i105.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_54_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.50.exit.i: ; preds = %id_bb.i105.i - %.fca.1.extract.i106.i = extractvalue { i1, i64 } %4, 1 - %qalloc.i107.i = tail call i64 @___qalloc() - %not_max.not.i108.i = icmp eq i64 %qalloc.i107.i, -1 - br i1 %not_max.not.i108.i, label %id_bb.i111.i, label %reset_bb.i109.i - -reset_bb.i109.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i - tail call void @___reset(i64 %qalloc.i107.i) - br label %id_bb.i111.i - -id_bb.i111.i: ; preds = %reset_bb.i109.i, %__hugr__.__tk2_qalloc.50.exit.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i107.i, 1 - %6 = select i1 %not_max.not.i108.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i110.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i110.i, label %__hugr__.__tk2_qalloc.64.exit.i, label %cond_68_case_0.i.i +__hugr__.__tk2_qalloc.50.exit.i: ; preds = %__hugr__.__tk2_qalloc.36.exit.i + tail call void @___reset(i64 %qalloc.i101.i) + %qalloc.i103.i = tail call i64 @___qalloc() + %not_max.not.not.i104.i = icmp eq i64 %qalloc.i103.i, -1 + br i1 %not_max.not.not.i104.i, label %cond_68_case_0.i.i, label %__hugr__.__tk2_qalloc.64.exit.i -cond_68_case_0.i.i: ; preds = %id_bb.i111.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_68_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.64.exit.i: ; preds = %id_bb.i111.i - %.fca.1.extract.i112.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i112.i, double 0x400921FB54442D18, double 0.000000e+00) - %qalloc.i113.i = tail call i64 @___qalloc() - %not_max.not.i114.i = icmp eq i64 %qalloc.i113.i, -1 - br i1 %not_max.not.i114.i, label %id_bb.i117.i, label %reset_bb.i115.i - -reset_bb.i115.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i - tail call void @___reset(i64 %qalloc.i113.i) - br label %id_bb.i117.i - -id_bb.i117.i: ; preds = %reset_bb.i115.i, %__hugr__.__tk2_qalloc.64.exit.i - %7 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i113.i, 1 - %8 = select i1 %not_max.not.i114.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %7 - %.fca.0.extract.i116.i = extractvalue { i1, i64 } %8, 0 - br i1 %.fca.0.extract.i116.i, label %__hugr__.main.1.exit, label %cond_82_case_0.i.i - -cond_82_case_0.i.i: ; preds = %id_bb.i117.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +__hugr__.__tk2_qalloc.64.exit.i: ; preds = %__hugr__.__tk2_qalloc.50.exit.i + tail call void @___reset(i64 %qalloc.i103.i) + tail call void @___rxy(i64 %qalloc.i103.i, double 0x400921FB54442D18, double 0.000000e+00) + %qalloc.i105.i = tail call i64 @___qalloc() + %not_max.not.not.i106.i = icmp eq i64 %qalloc.i105.i, -1 + br i1 %not_max.not.not.i106.i, label %cond_82_case_0.i.i, label %__hugr__.main.1.exit + +cond_82_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.main.1.exit: ; preds = %id_bb.i117.i - %.fca.1.extract.i118.i = extractvalue { i1, i64 } %8, 1 - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit.i + tail call void @___reset(i64 %qalloc.i105.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c0.7C14CD6E.0, i64 0, i64 0), i64 12, i1 %read_bool.i) - %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i106.i) - tail call void @___qfree(i64 %.fca.1.extract.i106.i) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool.i) + %lazy_measure22.i = tail call i64 @___lazy_measure(i64 %qalloc.i101.i) + tail call void @___qfree(i64 %qalloc.i101.i) %read_bool35.i = tail call i1 @___read_future_bool(i64 %lazy_measure22.i) tail call void @___dec_future_refcount(i64 %lazy_measure22.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c1.1F7A6571.0, i64 0, i64 0), i64 12, i1 %read_bool35.i) - %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i112.i) - tail call void @___qfree(i64 %.fca.1.extract.i112.i) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35.i) + %lazy_measure44.i = tail call i64 @___lazy_measure(i64 %qalloc.i103.i) + tail call void @___qfree(i64 %qalloc.i103.i) %read_bool57.i = tail call i1 @___read_future_bool(i64 %lazy_measure44.i) tail call void @___dec_future_refcount(i64 %lazy_measure44.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c2.60825383.0, i64 0, i64 0), i64 12, i1 %read_bool57.i) - tail call void @___rxy(i64 %.fca.1.extract.i118.i, double 0x400921FB54442D18, double 0.000000e+00) - %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i118.i) - tail call void @___qfree(i64 %.fca.1.extract.i118.i) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57.i) + tail call void @___rxy(i64 %qalloc.i105.i, double 0x400921FB54442D18, double 0.000000e+00) + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i105.i) + tail call void @___qfree(i64 %qalloc.i105.i) %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i) - tail call void @print_bool(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @res_c3.B223E16D.0, i64 0, i64 0), i64 12, i1 %read_bool80.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-measure_qb_array/measure_qb_array_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-measure_qb_array/measure_qb_array_x86_64-windows-msvc index 897d7f3af..e574e3ae1 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-measure_qb_array/measure_qb_array_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-measure_qb_array/measure_qb_array_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @"e_Array alre.5A300C2A.0" = private constant [57 x i8] c"8EXIT:INT:Array already contains an element at this index" @@ -8,12 +8,12 @@ target triple = "x86_64-windows-msvc" @"e_Array cont.EFA5AC45.0" = private constant [70 x i8] c"EEXIT:INT:Array contains non-borrowed elements and cannot be discarded" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." -declare i8* @heap_alloc(i64) local_unnamed_addr +declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @heap_free(i8*) local_unnamed_addr +declare void @heap_free(ptr) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr @@ -30,279 +30,600 @@ declare void @___reset(i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) - %1 = tail call i8* @heap_alloc(i64 80) - %2 = bitcast i8* %1 to i64* - %3 = tail call i8* @heap_alloc(i64 8) - %4 = bitcast i8* %3 to i64* - store i64 -1, i64* %4, align 1 - br label %cond_20_case_1.i - -cond_20_case_1.i: ; preds = %cond_exit_20.i, %entry - %"15_0.sroa.0.0294.i" = phi i64 [ 0, %entry ], [ %5, %cond_exit_20.i ] - %5 = add nuw nsw i64 %"15_0.sroa.0.0294.i", 1 + %1 = tail call ptr @heap_alloc(i64 80) + %2 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %2, align 1 %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i -reset_bb.i.i: ; preds = %cond_20_case_1.i - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %cond_20_case_1.i - %6 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %7 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %6 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %7, 0 - br i1 %.fca.0.extract.i.i, label %__barray_check_bounds.exit.i, label %cond_236_case_0.i.i - -cond_236_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_236_case_0.i.i: ; preds = %cond_exit_20.i.8, %cond_exit_20.i.7, %cond_exit_20.i.6, %cond_exit_20.i.5, %cond_exit_20.i.4, %cond_exit_20.i.3, %cond_exit_20.i.2, %cond_exit_20.i.1, %cond_exit_20.i, %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__barray_check_bounds.exit.i: ; preds = %id_bb.i.i - %8 = lshr i64 %"15_0.sroa.0.0294.i", 6 - %9 = getelementptr inbounds i64, i64* %4, i64 %8 - %10 = load i64, i64* %9, align 4 - %11 = shl nuw nsw i64 1, %"15_0.sroa.0.0294.i" - %12 = and i64 %10, %11 - %.not.i.i = icmp eq i64 %12, 0 - br i1 %.not.i.i, label %panic.i.i, label %cond_exit_20.i - -panic.i.i: ; preds = %__barray_check_bounds.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_check_bounds.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %3 = load i64, ptr %2, align 4 + %4 = trunc i64 %3 to i1 + br i1 %4, label %cond_exit_20.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i.9, %__barray_check_bounds.exit.i.8, %__barray_check_bounds.exit.i.7, %__barray_check_bounds.exit.i.6, %__barray_check_bounds.exit.i.5, %__barray_check_bounds.exit.i.4, %__barray_check_bounds.exit.i.3, %__barray_check_bounds.exit.i.2, %__barray_check_bounds.exit.i.1, %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable cond_exit_20.i: ; preds = %__barray_check_bounds.exit.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %7, 1 - %13 = xor i64 %10, %11 - store i64 %13, i64* %9, align 4 - %14 = getelementptr inbounds i64, i64* %2, i64 %"15_0.sroa.0.0294.i" - store i64 %.fca.1.extract.i.i, i64* %14, align 4 - %exitcond.not.i = icmp eq i64 %5, 10 - br i1 %exitcond.not.i, label %loop_out.i, label %cond_20_case_1.i - -loop_out.i: ; preds = %cond_exit_20.i - %15 = load i64, i64* %4, align 4 - %16 = and i64 %15, 1 - %.not.i258.i = icmp eq i64 %16, 0 - br i1 %.not.i258.i, label %__barray_mask_borrow.exit.i, label %panic.i259.i - -panic.i259.i: ; preds = %loop_out.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) + %5 = and i64 %3, -2 + store i64 %5, ptr %2, align 4 + store i64 %qalloc.i.i, ptr %1, align 4 + %qalloc.i.i.1 = tail call i64 @___qalloc() + %not_max.not.not.i.i.1 = icmp eq i64 %qalloc.i.i.1, -1 + br i1 %not_max.not.not.i.i.1, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.1 + +__barray_check_bounds.exit.i.1: ; preds = %cond_exit_20.i + tail call void @___reset(i64 %qalloc.i.i.1) + %6 = load i64, ptr %2, align 4 + %7 = and i64 %6, 2 + %.not = icmp eq i64 %7, 0 + br i1 %.not, label %panic.i.i, label %cond_exit_20.i.1 + +cond_exit_20.i.1: ; preds = %__barray_check_bounds.exit.i.1 + %8 = and i64 %6, -3 + store i64 %8, ptr %2, align 4 + %9 = getelementptr inbounds nuw i8, ptr %1, i64 8 + store i64 %qalloc.i.i.1, ptr %9, align 4 + %qalloc.i.i.2 = tail call i64 @___qalloc() + %not_max.not.not.i.i.2 = icmp eq i64 %qalloc.i.i.2, -1 + br i1 %not_max.not.not.i.i.2, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.2 + +__barray_check_bounds.exit.i.2: ; preds = %cond_exit_20.i.1 + tail call void @___reset(i64 %qalloc.i.i.2) + %10 = load i64, ptr %2, align 4 + %11 = and i64 %10, 4 + %.not1 = icmp eq i64 %11, 0 + br i1 %.not1, label %panic.i.i, label %cond_exit_20.i.2 + +cond_exit_20.i.2: ; preds = %__barray_check_bounds.exit.i.2 + %12 = and i64 %10, -5 + store i64 %12, ptr %2, align 4 + %13 = getelementptr inbounds nuw i8, ptr %1, i64 16 + store i64 %qalloc.i.i.2, ptr %13, align 4 + %qalloc.i.i.3 = tail call i64 @___qalloc() + %not_max.not.not.i.i.3 = icmp eq i64 %qalloc.i.i.3, -1 + br i1 %not_max.not.not.i.i.3, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.3 + +__barray_check_bounds.exit.i.3: ; preds = %cond_exit_20.i.2 + tail call void @___reset(i64 %qalloc.i.i.3) + %14 = load i64, ptr %2, align 4 + %15 = and i64 %14, 8 + %.not2 = icmp eq i64 %15, 0 + br i1 %.not2, label %panic.i.i, label %cond_exit_20.i.3 + +cond_exit_20.i.3: ; preds = %__barray_check_bounds.exit.i.3 + %16 = and i64 %14, -9 + store i64 %16, ptr %2, align 4 + %17 = getelementptr inbounds nuw i8, ptr %1, i64 24 + store i64 %qalloc.i.i.3, ptr %17, align 4 + %qalloc.i.i.4 = tail call i64 @___qalloc() + %not_max.not.not.i.i.4 = icmp eq i64 %qalloc.i.i.4, -1 + br i1 %not_max.not.not.i.i.4, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.4 + +__barray_check_bounds.exit.i.4: ; preds = %cond_exit_20.i.3 + tail call void @___reset(i64 %qalloc.i.i.4) + %18 = load i64, ptr %2, align 4 + %19 = and i64 %18, 16 + %.not3 = icmp eq i64 %19, 0 + br i1 %.not3, label %panic.i.i, label %cond_exit_20.i.4 + +cond_exit_20.i.4: ; preds = %__barray_check_bounds.exit.i.4 + %20 = and i64 %18, -17 + store i64 %20, ptr %2, align 4 + %21 = getelementptr inbounds nuw i8, ptr %1, i64 32 + store i64 %qalloc.i.i.4, ptr %21, align 4 + %qalloc.i.i.5 = tail call i64 @___qalloc() + %not_max.not.not.i.i.5 = icmp eq i64 %qalloc.i.i.5, -1 + br i1 %not_max.not.not.i.i.5, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.5 + +__barray_check_bounds.exit.i.5: ; preds = %cond_exit_20.i.4 + tail call void @___reset(i64 %qalloc.i.i.5) + %22 = load i64, ptr %2, align 4 + %23 = and i64 %22, 32 + %.not4 = icmp eq i64 %23, 0 + br i1 %.not4, label %panic.i.i, label %cond_exit_20.i.5 + +cond_exit_20.i.5: ; preds = %__barray_check_bounds.exit.i.5 + %24 = and i64 %22, -33 + store i64 %24, ptr %2, align 4 + %25 = getelementptr inbounds nuw i8, ptr %1, i64 40 + store i64 %qalloc.i.i.5, ptr %25, align 4 + %qalloc.i.i.6 = tail call i64 @___qalloc() + %not_max.not.not.i.i.6 = icmp eq i64 %qalloc.i.i.6, -1 + br i1 %not_max.not.not.i.i.6, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.6 + +__barray_check_bounds.exit.i.6: ; preds = %cond_exit_20.i.5 + tail call void @___reset(i64 %qalloc.i.i.6) + %26 = load i64, ptr %2, align 4 + %27 = and i64 %26, 64 + %.not5 = icmp eq i64 %27, 0 + br i1 %.not5, label %panic.i.i, label %cond_exit_20.i.6 + +cond_exit_20.i.6: ; preds = %__barray_check_bounds.exit.i.6 + %28 = and i64 %26, -65 + store i64 %28, ptr %2, align 4 + %29 = getelementptr inbounds nuw i8, ptr %1, i64 48 + store i64 %qalloc.i.i.6, ptr %29, align 4 + %qalloc.i.i.7 = tail call i64 @___qalloc() + %not_max.not.not.i.i.7 = icmp eq i64 %qalloc.i.i.7, -1 + br i1 %not_max.not.not.i.i.7, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.7 + +__barray_check_bounds.exit.i.7: ; preds = %cond_exit_20.i.6 + tail call void @___reset(i64 %qalloc.i.i.7) + %30 = load i64, ptr %2, align 4 + %31 = and i64 %30, 128 + %.not6 = icmp eq i64 %31, 0 + br i1 %.not6, label %panic.i.i, label %cond_exit_20.i.7 + +cond_exit_20.i.7: ; preds = %__barray_check_bounds.exit.i.7 + %32 = and i64 %30, -129 + store i64 %32, ptr %2, align 4 + %33 = getelementptr inbounds nuw i8, ptr %1, i64 56 + store i64 %qalloc.i.i.7, ptr %33, align 4 + %qalloc.i.i.8 = tail call i64 @___qalloc() + %not_max.not.not.i.i.8 = icmp eq i64 %qalloc.i.i.8, -1 + br i1 %not_max.not.not.i.i.8, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.8 + +__barray_check_bounds.exit.i.8: ; preds = %cond_exit_20.i.7 + tail call void @___reset(i64 %qalloc.i.i.8) + %34 = load i64, ptr %2, align 4 + %35 = and i64 %34, 256 + %.not7 = icmp eq i64 %35, 0 + br i1 %.not7, label %panic.i.i, label %cond_exit_20.i.8 + +cond_exit_20.i.8: ; preds = %__barray_check_bounds.exit.i.8 + %36 = and i64 %34, -257 + store i64 %36, ptr %2, align 4 + %37 = getelementptr inbounds nuw i8, ptr %1, i64 64 + store i64 %qalloc.i.i.8, ptr %37, align 4 + %qalloc.i.i.9 = tail call i64 @___qalloc() + %not_max.not.not.i.i.9 = icmp eq i64 %qalloc.i.i.9, -1 + br i1 %not_max.not.not.i.i.9, label %cond_236_case_0.i.i, label %__barray_check_bounds.exit.i.9 + +__barray_check_bounds.exit.i.9: ; preds = %cond_exit_20.i.8 + tail call void @___reset(i64 %qalloc.i.i.9) + %38 = load i64, ptr %2, align 4 + %39 = and i64 %38, 512 + %.not8 = icmp eq i64 %39, 0 + br i1 %.not8, label %panic.i.i, label %cond_exit_20.i.9 + +cond_exit_20.i.9: ; preds = %__barray_check_bounds.exit.i.9 + %40 = and i64 %38, -513 + store i64 %40, ptr %2, align 4 + %41 = getelementptr inbounds nuw i8, ptr %1, i64 72 + store i64 %qalloc.i.i.9, ptr %41, align 4 + %"128.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 + %"128.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.0.insert.i", ptr %2, 1 + %"128.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"128.fca.1.insert.i", i64 0, 2 + %42 = load i64, ptr %2, align 4 + %43 = trunc i64 %42 to i1 + br i1 %43, label %panic.i257.i, label %__barray_mask_borrow.exit.i + +panic.i257.i: ; preds = %cond_exit_20.i.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_borrow.exit.i: ; preds = %loop_out.i - %17 = xor i64 %15, 1 - store i64 %17, i64* %4, align 4 - %18 = load i64, i64* %2, align 4 - tail call void @___rxy(i64 %18, double 0x400921FB54442D18, double 0.000000e+00) - %19 = load i64, i64* %4, align 4 - %20 = and i64 %19, 1 - %.not.i260.i = icmp eq i64 %20, 0 - br i1 %.not.i260.i, label %panic.i261.i, label %__barray_mask_return.exit262.i - -panic.i261.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) - unreachable +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.i.9 + %44 = or disjoint i64 %42, 1 + store i64 %44, ptr %2, align 4 + %45 = load i64, ptr %1, align 4 + tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) + %46 = load i64, ptr %2, align 4 + %47 = trunc i64 %46 to i1 + br i1 %47, label %__barray_mask_return.exit259.i, label %panic.i258.i -__barray_mask_return.exit262.i: ; preds = %__barray_mask_borrow.exit.i - %21 = xor i64 %19, 1 - store i64 %21, i64* %4, align 4 - store i64 %18, i64* %2, align 4 - %22 = load i64, i64* %4, align 4 - %23 = and i64 %22, 4 - %.not.i263.i = icmp eq i64 %23, 0 - br i1 %.not.i263.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i - -panic.i264.i: ; preds = %__barray_mask_return.exit262.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +panic.i258.i: ; preds = %__barray_mask_borrow.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit262.i - %24 = xor i64 %22, 4 - store i64 %24, i64* %4, align 4 - %25 = getelementptr inbounds i8, i8* %1, i64 16 - %26 = bitcast i8* %25 to i64* - %27 = load i64, i64* %26, align 4 - tail call void @___rxy(i64 %27, double 0x400921FB54442D18, double 0.000000e+00) - %28 = load i64, i64* %4, align 4 - %29 = and i64 %28, 4 - %.not.i266.i = icmp eq i64 %29, 0 - br i1 %.not.i266.i, label %panic.i267.i, label %__barray_mask_return.exit268.i - -panic.i267.i: ; preds = %__barray_mask_borrow.exit265.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit259.i: ; preds = %__barray_mask_borrow.exit.i + %48 = and i64 %46, -2 + store i64 %48, ptr %2, align 4 + store i64 %45, ptr %1, align 4 + %49 = load i64, ptr %2, align 4 + %50 = and i64 %49, 4 + %.not.i = icmp eq i64 %50, 0 + br i1 %.not.i, label %__barray_mask_borrow.exit261.i, label %panic.i260.i + +panic.i260.i: ; preds = %__barray_mask_return.exit259.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit268.i: ; preds = %__barray_mask_borrow.exit265.i - %30 = xor i64 %28, 4 - store i64 %30, i64* %4, align 4 - store i64 %27, i64* %26, align 4 - %31 = load i64, i64* %4, align 4 - %32 = and i64 %31, 8 - %.not.i269.i = icmp eq i64 %32, 0 - br i1 %.not.i269.i, label %__barray_mask_borrow.exit271.i, label %panic.i270.i - -panic.i270.i: ; preds = %__barray_mask_return.exit268.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit261.i: ; preds = %__barray_mask_return.exit259.i + %51 = or disjoint i64 %49, 4 + store i64 %51, ptr %2, align 4 + %52 = load i64, ptr %13, align 4 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00) + %53 = load i64, ptr %2, align 4 + %54 = and i64 %53, 4 + %.not289.i = icmp eq i64 %54, 0 + br i1 %.not289.i, label %panic.i262.i, label %__barray_mask_return.exit263.i + +panic.i262.i: ; preds = %__barray_mask_borrow.exit261.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit271.i: ; preds = %__barray_mask_return.exit268.i - %33 = xor i64 %31, 8 - store i64 %33, i64* %4, align 4 - %34 = getelementptr inbounds i8, i8* %1, i64 24 - %35 = bitcast i8* %34 to i64* - %36 = load i64, i64* %35, align 4 - tail call void @___rxy(i64 %36, double 0x400921FB54442D18, double 0.000000e+00) - %37 = load i64, i64* %4, align 4 - %38 = and i64 %37, 8 - %.not.i272.i = icmp eq i64 %38, 0 - br i1 %.not.i272.i, label %panic.i273.i, label %__barray_mask_return.exit274.i - -panic.i273.i: ; preds = %__barray_mask_borrow.exit271.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_return.exit263.i: ; preds = %__barray_mask_borrow.exit261.i + %55 = and i64 %53, -5 + store i64 %55, ptr %2, align 4 + store i64 %52, ptr %13, align 4 + %56 = load i64, ptr %2, align 4 + %57 = and i64 %56, 8 + %.not290.i = icmp eq i64 %57, 0 + br i1 %.not290.i, label %__barray_mask_borrow.exit265.i, label %panic.i264.i + +panic.i264.i: ; preds = %__barray_mask_return.exit263.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_mask_return.exit274.i: ; preds = %__barray_mask_borrow.exit271.i - %39 = xor i64 %37, 8 - store i64 %39, i64* %4, align 4 - store i64 %36, i64* %35, align 4 - %40 = load i64, i64* %4, align 4 - %41 = and i64 %40, 512 - %.not.i275.i = icmp eq i64 %41, 0 - br i1 %.not.i275.i, label %__barray_mask_borrow.exit277.i, label %panic.i276.i - -panic.i276.i: ; preds = %__barray_mask_return.exit274.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_mask_borrow.exit265.i: ; preds = %__barray_mask_return.exit263.i + %58 = or disjoint i64 %56, 8 + store i64 %58, ptr %2, align 4 + %59 = load i64, ptr %17, align 4 + tail call void @___rxy(i64 %59, double 0x400921FB54442D18, double 0.000000e+00) + %60 = load i64, ptr %2, align 4 + %61 = and i64 %60, 8 + %.not291.i = icmp eq i64 %61, 0 + br i1 %.not291.i, label %panic.i266.i, label %__barray_mask_return.exit267.i + +panic.i266.i: ; preds = %__barray_mask_borrow.exit265.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_borrow.exit277.i: ; preds = %__barray_mask_return.exit274.i - %42 = xor i64 %40, 512 - store i64 %42, i64* %4, align 4 - %43 = getelementptr inbounds i8, i8* %1, i64 72 - %44 = bitcast i8* %43 to i64* - %45 = load i64, i64* %44, align 4 - tail call void @___rxy(i64 %45, double 0x400921FB54442D18, double 0.000000e+00) - %46 = load i64, i64* %4, align 4 - %47 = and i64 %46, 512 - %.not.i278.i = icmp eq i64 %47, 0 - br i1 %.not.i278.i, label %panic.i279.i, label %__barray_mask_return.exit280.i +__barray_mask_return.exit267.i: ; preds = %__barray_mask_borrow.exit265.i + %62 = and i64 %60, -9 + store i64 %62, ptr %2, align 4 + store i64 %59, ptr %17, align 4 + %63 = load i64, ptr %2, align 4 + %64 = and i64 %63, 512 + %.not292.i = icmp eq i64 %64, 0 + br i1 %.not292.i, label %__barray_mask_borrow.exit269.i, label %panic.i268.i + +panic.i268.i: ; preds = %__barray_mask_return.exit267.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") + unreachable -panic.i279.i: ; preds = %__barray_mask_borrow.exit277.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) +__barray_mask_borrow.exit269.i: ; preds = %__barray_mask_return.exit267.i + %65 = or disjoint i64 %63, 512 + store i64 %65, ptr %2, align 4 + %66 = load i64, ptr %41, align 4 + tail call void @___rxy(i64 %66, double 0x400921FB54442D18, double 0.000000e+00) + %67 = load i64, ptr %2, align 4 + %68 = and i64 %67, 512 + %.not293.i = icmp eq i64 %68, 0 + br i1 %.not293.i, label %panic.i270.i, label %__barray_mask_return.exit271.i + +panic.i270.i: ; preds = %__barray_mask_borrow.exit269.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -__barray_mask_return.exit280.i: ; preds = %__barray_mask_borrow.exit277.i - %48 = xor i64 %46, 512 - store i64 %48, i64* %4, align 4 - store i64 %45, i64* %44, align 4 - %49 = tail call i8* @heap_alloc(i64 240) - %50 = bitcast i8* %49 to { i1, i64, i1 }* - %51 = tail call i8* @heap_alloc(i64 8) - %52 = bitcast i8* %51 to i64* - store i64 -1, i64* %52, align 1 - br label %56 - -mask_block_ok.i.i.i.i: ; preds = %cond_exit_353.i.i - %53 = load i64, i64* %4, align 4 - %54 = or i64 %53, -1024 - store i64 %54, i64* %4, align 4 - %55 = icmp eq i64 %54, -1 - br i1 %55, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_err.i.i.i.i - -"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %mask_block_ok.i.i.i.i - tail call void @heap_free(i8* nonnull %1) - tail call void @heap_free(i8* nonnull %3) - br label %__barray_check_bounds.exit283.i +__barray_mask_return.exit271.i: ; preds = %__barray_mask_borrow.exit269.i + %69 = and i64 %67, -513 + store i64 %69, ptr %2, align 4 + store i64 %66, ptr %41, align 4 + %70 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"128.fca.2.insert.i", 0 + %71 = tail call ptr @heap_alloc(i64 240) + %72 = tail call ptr @heap_alloc(i64 8) + store i64 -1, ptr %72, align 1 + br label %__barray_check_bounds.exit.i.i.i + +73: ; preds = %loop_body.i.i + %74 = lshr i64 %.fca.2.extract83.i.i.i, 6 + %75 = getelementptr i64, ptr %.fca.1.extract82.i.i.i, i64 %74 + %76 = load i64, ptr %75, align 4 + %77 = and i64 %.fca.2.extract83.i.i.i, 63 + %78 = sub nuw nsw i64 64, %77 + %79 = lshr i64 -1, %78 + %80 = icmp eq i64 %77, 0 + %81 = select i1 %80, i64 0, i64 %79 + %82 = or i64 %76, %81 + store i64 %82, ptr %75, align 4 + %last_valid.i.i.i.i = add i64 %.fca.2.extract83.i.i.i, 9 + %83 = lshr i64 %last_valid.i.i.i.i, 6 + %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i.i.i, i64 %83 + %85 = load i64, ptr %84, align 4 + %86 = and i64 %last_valid.i.i.i.i, 63 + %87 = shl nsw i64 -2, %86 + %88 = icmp eq i64 %86, 63 + %89 = select i1 %88, i64 0, i64 %87 + %90 = or i64 %85, %89 + store i64 %90, ptr %84, align 4 + %reass.sub.i.i.i.i = sub nsw i64 %83, %74 + %.not.i.i.i.i = icmp eq i64 %reass.sub.i.i.i.i, -1 + br i1 %.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +91: ; preds = %mask_block_ok.i.i.i.i + %92 = add nuw i64 %.02.i.i.i.i, 1 + %exitcond.not.i.i.i.i = icmp eq i64 %.02.i.i.i.i, %reass.sub.i.i.i.i + br i1 %exitcond.not.i.i.i.i, label %"__hugr__.$measure_array$$n(10).277.exit.i", label %mask_block_ok.i.i.i.i + +mask_block_ok.i.i.i.i: ; preds = %73, %91 + %.02.i.i.i.i = phi i64 [ %92, %91 ], [ 0, %73 ] + %gep.i.i.i.i = getelementptr i64, ptr %75, i64 %.02.i.i.i.i + %93 = load i64, ptr %gep.i.i.i.i, align 4 + %94 = icmp eq i64 %93, -1 + br i1 %94, label %91, label %mask_block_err.i.i.i.i mask_block_err.i.i.i.i: ; preds = %mask_block_ok.i.i.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -56: ; preds = %cond_exit_353.i.i, %__barray_mask_return.exit280.i - %"303_0.sroa.15.0.i296.i" = phi i64 [ 0, %__barray_mask_return.exit280.i ], [ %57, %cond_exit_353.i.i ] - %57 = add nuw nsw i64 %"303_0.sroa.15.0.i296.i", 1 - %58 = lshr i64 %"303_0.sroa.15.0.i296.i", 6 - %59 = getelementptr inbounds i64, i64* %4, i64 %58 - %60 = load i64, i64* %59, align 4 - %61 = shl nuw nsw i64 1, %"303_0.sroa.15.0.i296.i" - %62 = and i64 %60, %61 - %.not.i99.i.i.i = icmp eq i64 %62, 0 - br i1 %.not.i99.i.i.i, label %__barray_check_bounds.exit.i.i, label %panic.i.i.i.i - -panic.i.i.i.i: ; preds = %56 - tail call void @panic(i32 1002, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @"e_Array elem.E746B1A3.0", i64 0, i64 0)) +__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit271.i + %.fca.2.extract83.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %.fca.2.extract83.i.i.i, %loop_body.i.i ] + %.fca.1.extract82.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit271.i ], [ %.fca.1.extract82.i.i.i, %loop_body.i.i ] + %.fca.0.extract81.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit271.i ], [ %.fca.0.extract81.i.i.i, %loop_body.i.i ] + %"303_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit271.i ], [ %95, %loop_body.i.i ] + %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit271.i ], [ %110, %loop_body.i.i ] + %95 = add nuw nsw i64 %"303_0.sroa.15.0184.i.i", 1 + %96 = add i64 %"303_0.sroa.15.0184.i.i", %.fca.2.extract83.i187.i.i + %97 = lshr i64 %96, 6 + %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract82.i186.i.i, i64 %97 + %99 = load i64, ptr %98, align 4 + %100 = and i64 %96, 63 + %101 = lshr i64 %99, %100 + %102 = trunc i64 %101 to i1 + br i1 %102, label %panic.i.i.i.i, label %__barray_check_bounds.exit.i.i + +panic.i.i.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") unreachable -__barray_check_bounds.exit.i.i: ; preds = %56 - %63 = xor i64 %60, %61 - store i64 %63, i64* %59, align 4 - %64 = getelementptr inbounds i64, i64* %2, i64 %"303_0.sroa.15.0.i296.i" - %65 = load i64, i64* %64, align 4 - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %65) - tail call void @___qfree(i64 %65) - %66 = getelementptr inbounds i64, i64* %52, i64 %58 - %67 = load i64, i64* %66, align 4 - %68 = and i64 %67, %61 - %.not.i.i.i = icmp eq i64 %68, 0 - br i1 %.not.i.i.i, label %panic.i.i.i, label %cond_exit_353.i.i +__barray_check_bounds.exit.i.i: ; preds = %__barray_check_bounds.exit.i.i.i + %103 = shl nuw i64 1, %100 + %104 = xor i64 %103, %99 + store i64 %104, ptr %98, align 4 + %105 = getelementptr inbounds i64, ptr %.fca.0.extract81.i185.i.i, i64 %96 + %106 = load i64, ptr %105, align 4 + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %106) + tail call void @___qfree(i64 %106) + %107 = load i64, ptr %72, align 4 + %108 = lshr i64 %107, %"303_0.sroa.15.0184.i.i" + %109 = trunc i64 %108 to i1 + br i1 %109, label %loop_body.i.i, label %panic.i.i.i panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @"e_Array alre.5A300C2A.0", i64 0, i64 0)) + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") unreachable -cond_exit_353.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure.i.i, 1 - %69 = xor i64 %67, %61 - store i64 %69, i64* %66, align 4 - %70 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"303_0.sroa.15.0.i296.i" - store { i1, i64, i1 } %"367_054.fca.1.insert.i.i", { i1, i64, i1 }* %70, align 4 - %exitcond297.not.i = icmp eq i64 %57, 10 - br i1 %exitcond297.not.i, label %mask_block_ok.i.i.i.i, label %56 - -cond_87_case_0.i: ; preds = %cond_exit_87.i - %71 = load i64, i64* %52, align 4 - %72 = or i64 %71, -1024 - store i64 %72, i64* %52, align 4 - %73 = icmp eq i64 %72, -1 - br i1 %73, label %__hugr__.main.1.exit, label %mask_block_err.i.i - -mask_block_err.i.i: ; preds = %cond_87_case_0.i - tail call void @panic(i32 1002, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @"e_Array cont.EFA5AC45.0", i64 0, i64 0)) +loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i + %"367_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 + %"367_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"367_054.fca.1.insert.i.i", i1 undef, 2 + %110 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, i64 %95, 1 + %111 = shl nuw nsw i64 1, %"303_0.sroa.15.0184.i.i" + %112 = xor i64 %107, %111 + store i64 %112, ptr %72, align 4 + %113 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"303_0.sroa.15.0184.i.i" + store { i1, i64, i1 } %"367_054.fca.2.insert.i.i", ptr %113, align 4 + %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 + %.fca.0.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 + %.fca.1.extract82.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 + %.fca.2.extract83.i.i.i = extractvalue { ptr, ptr, i64 } %114, 2 + %exitcond.not.i.i = icmp eq i64 %95, 10 + br i1 %exitcond.not.i.i, label %73, label %__barray_check_bounds.exit.i.i.i + +"__hugr__.$measure_array$$n(10).277.exit.i": ; preds = %91, %73 + tail call void @heap_free(ptr %.fca.0.extract81.i.i.i) + tail call void @heap_free(ptr nonnull %.fca.1.extract82.i.i.i) + %115 = load i64, ptr %72, align 4 + %116 = trunc i64 %115 to i1 + br i1 %116, label %cond_exit_87.thread.i, label %__barray_mask_borrow.exit278.i + +mask_block_err.i.i: ; preds = %cond_exit_87.thread.9.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") unreachable -__barray_check_bounds.exit283.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i", %cond_exit_87.i - %"90_0.0.i1" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).277.exit.i" ], [ %74, %cond_exit_87.i ] - %74 = add nuw nsw i64 %"90_0.0.i1", 1 - %75 = lshr i64 %"90_0.0.i1", 6 - %76 = getelementptr inbounds i64, i64* %52, i64 %75 - %77 = load i64, i64* %76, align 4 - %78 = shl nuw nsw i64 1, %"90_0.0.i1" - %79 = and i64 %77, %78 - %.not.i = icmp eq i64 %79, 0 - br i1 %.not.i, label %__barray_mask_borrow.exit288.i, label %cond_exit_87.i - -__barray_mask_borrow.exit288.i: ; preds = %__barray_check_bounds.exit283.i - %80 = xor i64 %77, %78 - store i64 %80, i64* %76, align 4 - %81 = getelementptr inbounds { i1, i64, i1 }, { i1, i64, i1 }* %50, i64 %"90_0.0.i1" - %82 = load { i1, i64, i1 }, { i1, i64, i1 }* %81, align 4 - %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %82, 0 - br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.i - -cond_exit_87.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit288.i, %__barray_check_bounds.exit283.i - %exitcond.not = icmp eq i64 %74, 10 - br i1 %exitcond.not, label %cond_87_case_0.i, label %__barray_check_bounds.exit283.i - -cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit288.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %82, 1 +__barray_mask_borrow.exit278.i: ; preds = %"__hugr__.$measure_array$$n(10).277.exit.i" + %117 = or disjoint i64 %115, 1 + store i64 %117, ptr %72, align 4 + %118 = load { i1, i64, i1 }, ptr %71, align 4 + %.fca.0.extract179.i = extractvalue { i1, i64, i1 } %118, 0 + br i1 %.fca.0.extract179.i, label %cond_390_case_1.i, label %cond_exit_87.thread.i + +cond_exit_87.thread.i: ; preds = %cond_390_case_1.i, %__barray_mask_borrow.exit278.i, %"__hugr__.$measure_array$$n(10).277.exit.i" + %119 = phi i64 [ %.pre.i, %cond_390_case_1.i ], [ %117, %__barray_mask_borrow.exit278.i ], [ %115, %"__hugr__.$measure_array$$n(10).277.exit.i" ] + %120 = and i64 %119, 2 + %.not311.i = icmp eq i64 %120, 0 + br i1 %.not311.i, label %__barray_mask_borrow.exit278.1.i, label %cond_exit_87.thread.1.i + +__barray_mask_borrow.exit278.1.i: ; preds = %cond_exit_87.thread.i + %121 = or disjoint i64 %119, 2 + store i64 %121, ptr %72, align 4 + %122 = getelementptr inbounds nuw i8, ptr %71, i64 24 + %123 = load { i1, i64, i1 }, ptr %122, align 4 + %.fca.0.extract179.1.i = extractvalue { i1, i64, i1 } %123, 0 + br i1 %.fca.0.extract179.1.i, label %cond_390_case_1.1.i, label %cond_exit_87.thread.1.i + +cond_390_case_1.1.i: ; preds = %__barray_mask_borrow.exit278.1.i + %.fca.1.extract.1.i = extractvalue { i1, i64, i1 } %123, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1.i) + %.pre302.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.1.i + +cond_exit_87.thread.1.i: ; preds = %cond_390_case_1.1.i, %__barray_mask_borrow.exit278.1.i, %cond_exit_87.thread.i + %124 = phi i64 [ %.pre302.i, %cond_390_case_1.1.i ], [ %121, %__barray_mask_borrow.exit278.1.i ], [ %119, %cond_exit_87.thread.i ] + %125 = and i64 %124, 4 + %.not312.i = icmp eq i64 %125, 0 + br i1 %.not312.i, label %__barray_mask_borrow.exit278.2.i, label %cond_exit_87.thread.2.i + +__barray_mask_borrow.exit278.2.i: ; preds = %cond_exit_87.thread.1.i + %126 = or disjoint i64 %124, 4 + store i64 %126, ptr %72, align 4 + %127 = getelementptr inbounds nuw i8, ptr %71, i64 48 + %128 = load { i1, i64, i1 }, ptr %127, align 4 + %.fca.0.extract179.2.i = extractvalue { i1, i64, i1 } %128, 0 + br i1 %.fca.0.extract179.2.i, label %cond_390_case_1.2.i, label %cond_exit_87.thread.2.i + +cond_390_case_1.2.i: ; preds = %__barray_mask_borrow.exit278.2.i + %.fca.1.extract.2.i = extractvalue { i1, i64, i1 } %128, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2.i) + %.pre303.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.2.i + +cond_exit_87.thread.2.i: ; preds = %cond_390_case_1.2.i, %__barray_mask_borrow.exit278.2.i, %cond_exit_87.thread.1.i + %129 = phi i64 [ %.pre303.i, %cond_390_case_1.2.i ], [ %126, %__barray_mask_borrow.exit278.2.i ], [ %124, %cond_exit_87.thread.1.i ] + %130 = and i64 %129, 8 + %.not313.i = icmp eq i64 %130, 0 + br i1 %.not313.i, label %__barray_mask_borrow.exit278.3.i, label %cond_exit_87.thread.3.i + +__barray_mask_borrow.exit278.3.i: ; preds = %cond_exit_87.thread.2.i + %131 = or disjoint i64 %129, 8 + store i64 %131, ptr %72, align 4 + %132 = getelementptr inbounds nuw i8, ptr %71, i64 72 + %133 = load { i1, i64, i1 }, ptr %132, align 4 + %.fca.0.extract179.3.i = extractvalue { i1, i64, i1 } %133, 0 + br i1 %.fca.0.extract179.3.i, label %cond_390_case_1.3.i, label %cond_exit_87.thread.3.i + +cond_390_case_1.3.i: ; preds = %__barray_mask_borrow.exit278.3.i + %.fca.1.extract.3.i = extractvalue { i1, i64, i1 } %133, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3.i) + %.pre304.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.3.i + +cond_exit_87.thread.3.i: ; preds = %cond_390_case_1.3.i, %__barray_mask_borrow.exit278.3.i, %cond_exit_87.thread.2.i + %134 = phi i64 [ %.pre304.i, %cond_390_case_1.3.i ], [ %131, %__barray_mask_borrow.exit278.3.i ], [ %129, %cond_exit_87.thread.2.i ] + %135 = and i64 %134, 16 + %.not314.i = icmp eq i64 %135, 0 + br i1 %.not314.i, label %__barray_mask_borrow.exit278.4.i, label %cond_exit_87.thread.4.i + +__barray_mask_borrow.exit278.4.i: ; preds = %cond_exit_87.thread.3.i + %136 = or disjoint i64 %134, 16 + store i64 %136, ptr %72, align 4 + %137 = getelementptr inbounds nuw i8, ptr %71, i64 96 + %138 = load { i1, i64, i1 }, ptr %137, align 4 + %.fca.0.extract179.4.i = extractvalue { i1, i64, i1 } %138, 0 + br i1 %.fca.0.extract179.4.i, label %cond_390_case_1.4.i, label %cond_exit_87.thread.4.i + +cond_390_case_1.4.i: ; preds = %__barray_mask_borrow.exit278.4.i + %.fca.1.extract.4.i = extractvalue { i1, i64, i1 } %138, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4.i) + %.pre305.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.4.i + +cond_exit_87.thread.4.i: ; preds = %cond_390_case_1.4.i, %__barray_mask_borrow.exit278.4.i, %cond_exit_87.thread.3.i + %139 = phi i64 [ %.pre305.i, %cond_390_case_1.4.i ], [ %136, %__barray_mask_borrow.exit278.4.i ], [ %134, %cond_exit_87.thread.3.i ] + %140 = and i64 %139, 32 + %.not315.i = icmp eq i64 %140, 0 + br i1 %.not315.i, label %__barray_mask_borrow.exit278.5.i, label %cond_exit_87.thread.5.i + +__barray_mask_borrow.exit278.5.i: ; preds = %cond_exit_87.thread.4.i + %141 = or disjoint i64 %139, 32 + store i64 %141, ptr %72, align 4 + %142 = getelementptr inbounds nuw i8, ptr %71, i64 120 + %143 = load { i1, i64, i1 }, ptr %142, align 4 + %.fca.0.extract179.5.i = extractvalue { i1, i64, i1 } %143, 0 + br i1 %.fca.0.extract179.5.i, label %cond_390_case_1.5.i, label %cond_exit_87.thread.5.i + +cond_390_case_1.5.i: ; preds = %__barray_mask_borrow.exit278.5.i + %.fca.1.extract.5.i = extractvalue { i1, i64, i1 } %143, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5.i) + %.pre306.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.5.i + +cond_exit_87.thread.5.i: ; preds = %cond_390_case_1.5.i, %__barray_mask_borrow.exit278.5.i, %cond_exit_87.thread.4.i + %144 = phi i64 [ %.pre306.i, %cond_390_case_1.5.i ], [ %141, %__barray_mask_borrow.exit278.5.i ], [ %139, %cond_exit_87.thread.4.i ] + %145 = and i64 %144, 64 + %.not316.i = icmp eq i64 %145, 0 + br i1 %.not316.i, label %__barray_mask_borrow.exit278.6.i, label %cond_exit_87.thread.6.i + +__barray_mask_borrow.exit278.6.i: ; preds = %cond_exit_87.thread.5.i + %146 = or disjoint i64 %144, 64 + store i64 %146, ptr %72, align 4 + %147 = getelementptr inbounds nuw i8, ptr %71, i64 144 + %148 = load { i1, i64, i1 }, ptr %147, align 4 + %.fca.0.extract179.6.i = extractvalue { i1, i64, i1 } %148, 0 + br i1 %.fca.0.extract179.6.i, label %cond_390_case_1.6.i, label %cond_exit_87.thread.6.i + +cond_390_case_1.6.i: ; preds = %__barray_mask_borrow.exit278.6.i + %.fca.1.extract.6.i = extractvalue { i1, i64, i1 } %148, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6.i) + %.pre307.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.6.i + +cond_exit_87.thread.6.i: ; preds = %cond_390_case_1.6.i, %__barray_mask_borrow.exit278.6.i, %cond_exit_87.thread.5.i + %149 = phi i64 [ %.pre307.i, %cond_390_case_1.6.i ], [ %146, %__barray_mask_borrow.exit278.6.i ], [ %144, %cond_exit_87.thread.5.i ] + %150 = and i64 %149, 128 + %.not317.i = icmp eq i64 %150, 0 + br i1 %.not317.i, label %__barray_mask_borrow.exit278.7.i, label %cond_exit_87.thread.7.i + +__barray_mask_borrow.exit278.7.i: ; preds = %cond_exit_87.thread.6.i + %151 = or disjoint i64 %149, 128 + store i64 %151, ptr %72, align 4 + %152 = getelementptr inbounds nuw i8, ptr %71, i64 168 + %153 = load { i1, i64, i1 }, ptr %152, align 4 + %.fca.0.extract179.7.i = extractvalue { i1, i64, i1 } %153, 0 + br i1 %.fca.0.extract179.7.i, label %cond_390_case_1.7.i, label %cond_exit_87.thread.7.i + +cond_390_case_1.7.i: ; preds = %__barray_mask_borrow.exit278.7.i + %.fca.1.extract.7.i = extractvalue { i1, i64, i1 } %153, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7.i) + %.pre308.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.7.i + +cond_exit_87.thread.7.i: ; preds = %cond_390_case_1.7.i, %__barray_mask_borrow.exit278.7.i, %cond_exit_87.thread.6.i + %154 = phi i64 [ %.pre308.i, %cond_390_case_1.7.i ], [ %151, %__barray_mask_borrow.exit278.7.i ], [ %149, %cond_exit_87.thread.6.i ] + %155 = and i64 %154, 256 + %.not318.i = icmp eq i64 %155, 0 + br i1 %.not318.i, label %__barray_mask_borrow.exit278.8.i, label %cond_exit_87.thread.8.i + +__barray_mask_borrow.exit278.8.i: ; preds = %cond_exit_87.thread.7.i + %156 = or disjoint i64 %154, 256 + store i64 %156, ptr %72, align 4 + %157 = getelementptr inbounds nuw i8, ptr %71, i64 192 + %158 = load { i1, i64, i1 }, ptr %157, align 4 + %.fca.0.extract179.8.i = extractvalue { i1, i64, i1 } %158, 0 + br i1 %.fca.0.extract179.8.i, label %cond_390_case_1.8.i, label %cond_exit_87.thread.8.i + +cond_390_case_1.8.i: ; preds = %__barray_mask_borrow.exit278.8.i + %.fca.1.extract.8.i = extractvalue { i1, i64, i1 } %158, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8.i) + %.pre309.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.8.i + +cond_exit_87.thread.8.i: ; preds = %cond_390_case_1.8.i, %__barray_mask_borrow.exit278.8.i, %cond_exit_87.thread.7.i + %159 = phi i64 [ %.pre309.i, %cond_390_case_1.8.i ], [ %156, %__barray_mask_borrow.exit278.8.i ], [ %154, %cond_exit_87.thread.7.i ] + %160 = and i64 %159, 512 + %.not319.i = icmp eq i64 %160, 0 + br i1 %.not319.i, label %__barray_mask_borrow.exit278.9.i, label %cond_exit_87.thread.9.i + +__barray_mask_borrow.exit278.9.i: ; preds = %cond_exit_87.thread.8.i + %161 = or disjoint i64 %159, 512 + store i64 %161, ptr %72, align 4 + %162 = getelementptr inbounds nuw i8, ptr %71, i64 216 + %163 = load { i1, i64, i1 }, ptr %162, align 4 + %.fca.0.extract179.9.i = extractvalue { i1, i64, i1 } %163, 0 + br i1 %.fca.0.extract179.9.i, label %cond_390_case_1.9.i, label %cond_exit_87.thread.9.i + +cond_390_case_1.9.i: ; preds = %__barray_mask_borrow.exit278.9.i + %.fca.1.extract.9.i = extractvalue { i1, i64, i1 } %163, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9.i) + %.pre310.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.9.i + +cond_exit_87.thread.9.i: ; preds = %cond_390_case_1.9.i, %__barray_mask_borrow.exit278.9.i, %cond_exit_87.thread.8.i + %164 = phi i64 [ %.pre310.i, %cond_390_case_1.9.i ], [ %161, %__barray_mask_borrow.exit278.9.i ], [ %159, %cond_exit_87.thread.8.i ] + %165 = or i64 %164, -1024 + store i64 %165, ptr %72, align 4 + %166 = icmp eq i64 %165, -1 + br i1 %166, label %__hugr__.main.1.exit, label %mask_block_err.i.i + +cond_390_case_1.i: ; preds = %__barray_mask_borrow.exit278.i + %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - br label %cond_exit_87.i - -__hugr__.main.1.exit: ; preds = %cond_87_case_0.i - tail call void @heap_free(i8* %49) - tail call void @heap_free(i8* nonnull %51) - %83 = tail call i64 @teardown() - ret i64 %83 + %.pre.i = load i64, ptr %72, align 4 + br label %cond_exit_87.thread.i + +__hugr__.main.1.exit: ; preds = %cond_exit_87.thread.9.i + tail call void @heap_free(ptr %71) + tail call void @heap_free(ptr nonnull %72) + %167 = tail call i64 @teardown() + ret i64 %167 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-no_results/no_results_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-no_results/no_results_x86_64-windows-msvc index a3f4b02aa..a85084143 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-no_results/no_results_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-no_results/no_results_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." @@ -16,7 +16,7 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -26,32 +26,22 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_18_case_0.i.i, label %__hugr__.bar.1.exit -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.bar.1.exit, label %cond_18_case_0.i.i - -cond_18_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_18_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.bar.1.exit: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.bar.1.exit: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - %3 = tail call i64 @teardown() - ret i64 %3 + %1 = tail call i64 @teardown() + ret i64 %1 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_exit/postselect_exit_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_exit/postselect_exit_x86_64-windows-msvc index b0ed5b6ba..3fe6d1753 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_exit/postselect_exit_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_exit/postselect_exit_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 42, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 42, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_panic/postselect_panic_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_panic/postselect_panic_x86_64-windows-msvc index 481cd7577..ebe1633f8 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_panic/postselect_panic_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-postselect_panic/postselect_panic_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @e_Postselect.558881BF.0 = private constant [30 x i8] c"\1DEXIT:INT:Postselection failed" @@ -18,9 +18,9 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr @@ -34,44 +34,34 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_39_case_0.i.i, label %__hugr__.__tk2_qalloc.35.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.35.exit.i, label %cond_39_case_0.i.i - -cond_39_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_39_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.35.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) +__hugr__.__tk2_qalloc.35.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + tail call void @___rxy(i64 %qalloc.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) tail call void @___inc_future_refcount(i64 %lazy_measure.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - br i1 %read_bool.i, label %3, label %__hugr__.main.1.exit + br i1 %read_bool.i, label %1, label %__hugr__.main.1.exit -3: ; preds = %__hugr__.__tk2_qalloc.35.exit.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @e_Postselect.558881BF.0, i64 0, i64 0)) +1: ; preds = %__hugr__.__tk2_qalloc.35.exit.i + tail call void @panic(i32 1001, ptr nonnull @e_Postselect.558881BF.0) unreachable __hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.35.exit.i %read_bool63.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @res_c.1C9EF4D1.0, i64 0, i64 0), i64 11, i1 %read_bool63.i) - %4 = tail call i64 @teardown() - ret i64 %4 + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool63.i) + %2 = tail call i64 @teardown() + ret i64 %2 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-print_current_shot/print_current_shot_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-print_current_shot/print_current_shot_x86_64-windows-msvc index 4d6d33224..8b23d24de 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-print_current_shot/print_current_shot_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-print_current_shot/print_current_shot_x86_64-windows-msvc @@ -1,19 +1,19 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" declare i64 @get_current_shot() local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_shot.6D86EAF7.0, i64 0, i64 0), i64 13, i64 %shot.i) + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) %1 = tail call i64 @teardown() ret i64 %1 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rng/rng_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rng/rng_x86_64-windows-msvc index c2c5d790c..a17a58b3d 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rng/rng_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rng/rng_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @res_rint.B928E41E.0 = private constant [14 x i8] c"\0DUSER:INT:rint" @@ -17,9 +17,9 @@ declare double @random_float() local_unnamed_addr declare i32 @random_rng(i32) local_unnamed_addr -declare void @print_int(i8*, i64, i64) local_unnamed_addr +declare void @print_int(ptr, i64, i64) local_unnamed_addr -declare void @print_float(i8*, i64, double) local_unnamed_addr +declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr @@ -34,19 +34,19 @@ entry: %1 = sext i32 %rintb.i to i64 %2 = sext i32 %rint20.i to i64 %3 = sext i32 %rint.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @res_rint.B928E41E.0, i64 0, i64 0), i64 13, i64 %3) - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint1.0884EC03.0, i64 0, i64 0), i64 14, i64 %2) - tail call void @print_float(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rfloat.F0E4DD2C.0, i64 0, i64 0), i64 17, double %rfloat.i) - tail call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_rint_bnd.CB1E6B0D.0, i64 0, i64 0), i64 17, i64 %1) + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %3) + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %2) + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat.i) + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %1) tail call void @random_seed(i64 84) %rint53.i = tail call i32 @random_int() %rfloat55.i = tail call double @random_float() %rintb58.i = tail call i32 @random_rng(i32 200) %4 = sext i32 %rintb58.i to i64 %5 = sext i32 %rint53.i to i64 - tail call void @print_int(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @res_rint2.F0335598.0, i64 0, i64 0), i64 14, i64 %5) - tail call void @print_float(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rfloat2.4DAB941F.0, i64 0, i64 0), i64 18, double %rfloat55.i) - tail call void @print_int(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_rint_bnd2.169DE399.0, i64 0, i64 0), i64 18, i64 %4) + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %5) + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat55.i) + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %4) %6 = tail call i64 @teardown() ret i64 %6 } diff --git a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rus/rus_x86_64-windows-msvc b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rus/rus_x86_64-windows-msvc index ad7d56709..d9e8e4d01 100644 --- a/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rus/rus_x86_64-windows-msvc +++ b/qis-compiler/python/tests/snapshots/test_basic_generation/test_llvm/x86_64-windows-msvc-rus/rus_x86_64-windows-msvc @@ -1,6 +1,6 @@ ; ModuleID = 'hugr' source_filename = "hugr" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-windows-msvc" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @@ -14,14 +14,14 @@ declare i1 @___read_future_bool(i64) local_unnamed_addr declare void @___dec_future_refcount(i64) local_unnamed_addr -declare void @print_bool(i8*, i64, i1) local_unnamed_addr +declare void @print_bool(ptr, i64, i1) local_unnamed_addr declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr ; Function Attrs: noreturn -declare void @panic(i32, i8*) local_unnamed_addr #0 +declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr @@ -33,119 +33,89 @@ define i64 @qmain(i64 %0) local_unnamed_addr { entry: tail call void @setup(i64 %0) %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.i.i, label %id_bb.i.i, label %reset_bb.i.i + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 + br i1 %not_max.not.not.i.i, label %cond_87_case_0.i.i, label %__hugr__.__tk2_qalloc.83.exit.i -reset_bb.i.i: ; preds = %entry - tail call void @___reset(i64 %qalloc.i.i) - br label %id_bb.i.i - -id_bb.i.i: ; preds = %reset_bb.i.i, %entry - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i, 1 - %2 = select i1 %not_max.not.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %1 - %.fca.0.extract.i.i = extractvalue { i1, i64 } %2, 0 - br i1 %.fca.0.extract.i.i, label %__hugr__.__tk2_qalloc.83.exit.i, label %cond_87_case_0.i.i - -cond_87_case_0.i.i: ; preds = %id_bb.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_87_case_0.i.i: ; preds = %entry + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.83.exit.i: ; preds = %id_bb.i.i - %.fca.1.extract.i.i = extractvalue { i1, i64 } %2, 1 - br label %cond_242_case_1.i.i - -cond_242_case_1.i.i: ; preds = %cond_242_case_1.i.i.backedge, %__hugr__.__tk2_qalloc.83.exit.i - %qalloc.i.i.i = tail call i64 @___qalloc() - %not_max.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 - br i1 %not_max.not.i.i.i, label %id_bb.i.i.i, label %reset_bb.i.i.i - -reset_bb.i.i.i: ; preds = %cond_242_case_1.i.i - tail call void @___reset(i64 %qalloc.i.i.i) - br label %id_bb.i.i.i - -id_bb.i.i.i: ; preds = %reset_bb.i.i.i, %cond_242_case_1.i.i - %3 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i.i.i, 1 - %4 = select i1 %not_max.not.i.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %3 - %.fca.0.extract.i.i.i = extractvalue { i1, i64 } %4, 0 - br i1 %.fca.0.extract.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i, label %cond_101_case_0.i.i.i +__hugr__.__tk2_qalloc.83.exit.i: ; preds = %entry + tail call void @___reset(i64 %qalloc.i.i) + %qalloc.i132.i.i = tail call i64 @___qalloc() + %not_max.not.not.i133.i.i = icmp eq i64 %qalloc.i132.i.i, -1 + br i1 %not_max.not.not.i133.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i -cond_101_case_0.i.i.i: ; preds = %id_bb.i.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_101_case_0.i.i.i: ; preds = %cond_242_case_1.backedge.i.i, %__hugr__.__tk2_qalloc.83.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %id_bb.i.i.i - %.fca.1.extract.i.i.i = extractvalue { i1, i64 } %4, 1 +__hugr__.__tk2_qalloc.97.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.83.exit.i, %cond_242_case_1.backedge.i.i + %qalloc.i134.i.i = phi i64 [ %qalloc.i.i.i, %cond_242_case_1.backedge.i.i ], [ %qalloc.i132.i.i, %__hugr__.__tk2_qalloc.83.exit.i ] + tail call void @___reset(i64 %qalloc.i134.i.i) %qalloc.i128.i.i = tail call i64 @___qalloc() - %not_max.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 - br i1 %not_max.not.i129.i.i, label %id_bb.i132.i.i, label %reset_bb.i130.i.i + %not_max.not.not.i129.i.i = icmp eq i64 %qalloc.i128.i.i, -1 + br i1 %not_max.not.not.i129.i.i, label %cond_115_case_0.i.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i -reset_bb.i130.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i - tail call void @___reset(i64 %qalloc.i128.i.i) - br label %id_bb.i132.i.i - -id_bb.i132.i.i: ; preds = %reset_bb.i130.i.i, %__hugr__.__tk2_qalloc.97.exit.i.i - %5 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc.i128.i.i, 1 - %6 = select i1 %not_max.not.i129.i.i, { i1, i64 } { i1 false, i64 poison }, { i1, i64 } %5 - %.fca.0.extract.i131.i.i = extractvalue { i1, i64 } %6, 0 - br i1 %.fca.0.extract.i131.i.i, label %__hugr__.__tk2_qalloc.111.exit.i.i, label %cond_115_case_0.i.i.i - -cond_115_case_0.i.i.i: ; preds = %id_bb.i132.i.i - tail call void @panic(i32 1001, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @"e_No more qu.3B2EEBF0.0", i64 0, i64 0)) +cond_115_case_0.i.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") unreachable -__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %id_bb.i132.i.i - %.fca.1.extract.i133.i.i = extractvalue { i1, i64 } %6, 1 - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFE921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i133.i.i, i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i.i, double 0x3FE921FB54442D18) - %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i.i) +__hugr__.__tk2_qalloc.111.exit.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i.i + tail call void @___reset(i64 %qalloc.i128.i.i) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFE921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i128.i.i, i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i134.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i134.i.i, double 0x3FE921FB54442D18) + %lazy_measure.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i.i) + tail call void @___qfree(i64 %qalloc.i134.i.i) %read_bool.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i.i) - br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %7 + br i1 %read_bool.i.i, label %cond_256_case_1.i.i, label %1 -7: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) - br label %cond_242_case_1.i.i.backedge +1: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i + tail call void @___qfree(i64 %qalloc.i128.i.i) + br label %cond_242_case_1.backedge.i.i + +cond_242_case_1.backedge.i.i: ; preds = %2, %1 + %qalloc.i.i.i = tail call i64 @___qalloc() + %not_max.not.not.i.i.i = icmp eq i64 %qalloc.i.i.i, -1 + br i1 %not_max.not.not.i.i.i, label %cond_101_case_0.i.i.i, label %__hugr__.__tk2_qalloc.97.exit.i.i cond_256_case_1.i.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i.i - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x3FE921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) - tail call void @___rzz(i64 %.fca.1.extract.i.i, i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i.i, double 0xBFF921FB54442D18) - tail call void @___rxy(i64 %.fca.1.extract.i133.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0xBFF921FB54442D18) - tail call void @___rz(i64 %.fca.1.extract.i133.i.i, double 0x3FE921FB54442D18) - %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i133.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i133.i.i) + tail call void @___rz(i64 %qalloc.i.i, double 0x3FE921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0x400921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18) + tail call void @___rzz(i64 %qalloc.i.i, i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18) + tail call void @___rz(i64 %qalloc.i.i, double 0xBFF921FB54442D18) + tail call void @___rxy(i64 %qalloc.i128.i.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0xBFF921FB54442D18) + tail call void @___rz(i64 %qalloc.i128.i.i, double 0x3FE921FB54442D18) + %lazy_measure67.i.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i.i) + tail call void @___qfree(i64 %qalloc.i128.i.i) %read_bool80.i.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i.i) tail call void @___dec_future_refcount(i64 %lazy_measure67.i.i) - br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %8 - -8: ; preds = %cond_256_case_1.i.i - tail call void @___rxy(i64 %.fca.1.extract.i.i, double 0x400921FB54442D18, double 0.000000e+00) - br label %cond_242_case_1.i.i.backedge + br i1 %read_bool80.i.i, label %__hugr__.main.1.exit, label %2 -cond_242_case_1.i.i.backedge: ; preds = %8, %7 - br label %cond_242_case_1.i.i +2: ; preds = %cond_256_case_1.i.i + tail call void @___rxy(i64 %qalloc.i.i, double 0x400921FB54442D18, double 0.000000e+00) + br label %cond_242_case_1.backedge.i.i __hugr__.main.1.exit: ; preds = %cond_256_case_1.i.i - %lazy_measure.i = tail call i64 @___lazy_measure(i64 %.fca.1.extract.i.i) - tail call void @___qfree(i64 %.fca.1.extract.i.i) + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i.i) + tail call void @___qfree(i64 %qalloc.i.i) %read_bool.i = tail call i1 @___read_future_bool(i64 %lazy_measure.i) tail call void @___dec_future_refcount(i64 %lazy_measure.i) - tail call void @print_bool(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @res_result.457DE32D.0, i64 0, i64 0), i64 16, i1 %read_bool.i) - %9 = tail call i64 @teardown() - ret i64 %9 + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) + %3 = tail call i64 @teardown() + ret i64 %3 } declare void @setup(i64) local_unnamed_addr diff --git a/qis-compiler/rust/array.rs b/qis-compiler/rust/array.rs index ab442b1ad..a60fbeb10 100644 --- a/qis-compiler/rust/array.rs +++ b/qis-compiler/rust/array.rs @@ -24,7 +24,6 @@ impl ArrayCodegen for SeleneHeapArrayCodegen { ) -> Result> { let iw_ctx = ctx.typing_session().iw_context(); let malloc_sig = iw_ctx - .i8_type() .ptr_type(AddressSpace::default()) .fn_type(&[iw_ctx.i64_type().into()], false); let malloc = ctx.get_extern_func("heap_alloc", malloc_sig)?; @@ -42,7 +41,7 @@ impl ArrayCodegen for SeleneHeapArrayCodegen { ptr: PointerValue<'c>, ) -> Result<()> { let iw_ctx = ctx.typing_session().iw_context(); - let ptr_ty = iw_ctx.i8_type().ptr_type(AddressSpace::default()); + let ptr_ty = iw_ctx.ptr_type(AddressSpace::default()); let ptr = ctx.builder().build_bit_cast(ptr, ptr_ty, "")?; let free_sig = iw_ctx.void_type().fn_type(&[ptr_ty.into()], false); @@ -69,7 +68,6 @@ impl BorrowArrayCodegen for SeleneHeapBorrowArrayCodegen Result> { let iw_ctx = ctx.typing_session().iw_context(); let malloc_sig = iw_ctx - .i8_type() .ptr_type(AddressSpace::default()) .fn_type(&[iw_ctx.i64_type().into()], false); let malloc = ctx.get_extern_func("heap_alloc", malloc_sig)?; @@ -87,7 +85,7 @@ impl BorrowArrayCodegen for SeleneHeapBorrowArrayCodegen, ) -> Result<()> { let iw_ctx = ctx.typing_session().iw_context(); - let ptr_ty = iw_ctx.i8_type().ptr_type(AddressSpace::default()); + let ptr_ty = iw_ctx.ptr_type(AddressSpace::default()); let ptr = ctx.builder().build_bit_cast(ptr, ptr_ty, "")?; let free_sig = iw_ctx.void_type().fn_type(&[ptr_ty.into()], false); diff --git a/qis-compiler/rust/gpu.rs b/qis-compiler/rust/gpu.rs index 65eed5516..1c5bdc716 100644 --- a/qis-compiler/rust/gpu.rs +++ b/qis-compiler/rust/gpu.rs @@ -88,7 +88,7 @@ //! to other result types in future. use crate::selene_specific; -use anyhow::{Result, bail}; +use anyhow::{Result, bail, ensure}; use hugr::extension::prelude::option_type; use hugr::llvm::{CodegenExtension, CodegenExtsBuilder, inkwell}; use hugr::std_extensions::arithmetic::int_types::int_type; @@ -167,7 +167,7 @@ impl GpuCodegen { iwc.i8_type().fn_type( &[ iwc.i64_type().into(), - iwc.i64_type().ptr_type(AddressSpace::default()).into(), + iwc.ptr_type(AddressSpace::default()).into(), ], false, ), @@ -187,8 +187,8 @@ impl GpuCodegen { .into_int_value(); verify_gpu_call(ctx, success, "gpu_init")?; - let gpu_ref = builder.build_load(gpu_ref_ptr, "gpu_ref")?; - let result_t = ts.llvm_sum_type(option_type(int_type(6)))?; + let gpu_ref = builder.build_load(iwc.i64_type(), gpu_ref_ptr, "gpu_ref")?; + let result_t = ts.llvm_sum_type(option_type(vec![int_type(6)]))?; // Although the result is an option type, we always return true // in this lowering: failure is already handled. let pair = result_t.build_tag(builder, 1, vec![gpu_ref])?; @@ -271,7 +271,7 @@ impl GpuCodegen { // Grab the set flag to check if it is initialized. let is_set = ctx .builder() - .build_load(set_flag.as_pointer_value(), "function_id")? + .build_load(iwc.i8_type(), set_flag.as_pointer_value(), "function_id")? .into_int_value(); let needs_lookup = ctx.builder().build_int_compare( inkwell::IntPredicate::EQ, @@ -291,7 +291,7 @@ impl GpuCodegen { ctx.builder().position_at_end(read_cache_block); let stored_func_id = ctx .builder() - .build_load(stored_id.as_pointer_value(), "function_id")? + .build_load(iwc.i64_type(), stored_id.as_pointer_value(), "function_id")? .into_int_value(); ctx.builder().build_return(Some(&stored_func_id))?; @@ -304,8 +304,8 @@ impl GpuCodegen { "gpu_get_function_id", iwc.i8_type().fn_type( &[ - iwc.i8_type().ptr_type(AddressSpace::default()).into(), - iwc.i64_type().ptr_type(AddressSpace::default()).into(), + iwc.ptr_type(AddressSpace::default()).into(), + iwc.ptr_type(AddressSpace::default()).into(), ], false, ), @@ -331,7 +331,7 @@ impl GpuCodegen { // Otherwise, store the function id and set the flag let func_id = ctx .builder() - .build_load(function_id_ptr, "function_id")? + .build_load(iwc.i64_type(), function_id_ptr, "function_id")? .into_int_value(); ctx.builder() .build_store(stored_id.as_pointer_value(), func_id)?; @@ -396,8 +396,6 @@ impl GpuCodegen { let gpu_ref = gpu_ref.into_int_value(); let func = fn_id.into_int_value(); - let builder = ctx.builder(); - let gpu_call = ctx.get_extern_func( "gpu_call", iwc.i8_type().fn_type( @@ -405,12 +403,8 @@ impl GpuCodegen { gpu_ref.get_type().into(), func.get_type().into(), iwc.i64_type().into(), - iwc.i8_type() - .ptr_type(inkwell::AddressSpace::default()) - .into(), - iwc.i8_type() - .ptr_type(inkwell::AddressSpace::default()) - .into(), + iwc.ptr_type(inkwell::AddressSpace::default()).into(), + iwc.ptr_type(inkwell::AddressSpace::default()).into(), ], false, ), @@ -422,11 +416,7 @@ impl GpuCodegen { // create an i8 array of length blob_size and populate it with // the packed arguments - let (blob, blob_size) = pack_arguments(ctx, fn_args)?; - let i64_zero = iwc.i64_type().const_zero(); - let blob_ptr = unsafe { - builder.build_in_bounds_gep(blob, &[i64_zero, i64_zero], "gpu_input_blob_ptr")? - }; + let (blob_ptr, blob_size) = pack_arguments(ctx, fn_args)?; // pass the blob size, blob pointer, and signature string to gpu_call as // arguments @@ -467,7 +457,7 @@ impl GpuCodegen { let i8_t = iwc.i8_type().as_basic_type_enum(); let i64_t = iwc.i64_type().as_basic_type_enum(); let f64_t = iwc.f64_type().as_basic_type_enum(); - let result_ptr_t = iwc.i8_type().ptr_type(AddressSpace::default()); + let result_ptr_t = iwc.ptr_type(AddressSpace::default()); // Results can currently come in as ints or floats. // When this expands we can allocate an appropriate buffer @@ -507,54 +497,19 @@ impl GpuCodegen { // Check status and handle error if needed verify_gpu_call(ctx, call, "gpu_get_result_64bits")?; - match ctx.llvm_type(single_result)? { - i if i == i64_t => { - // The result type is an integer, so we can just load - // it directly. - let int_result = ctx - .builder() - .build_load(int_result_ptr, "int_result")? - .into_int_value(); - op.outputs.finish( - ctx.builder(), - [ - gpu_ref.as_basic_value_enum(), - int_result.as_basic_value_enum(), - ], - )?; - } - f if f == f64_t => { - // The result type is a float, so we need to reinterpret - // the result pointer from a pointer to int to a pointer - // to float, then load it. - let float_result_ptr = ctx - .builder() - .build_bit_cast( - int_result_ptr, - iwc.f64_type().ptr_type(AddressSpace::default()), - "float_result_ptr", - )? - .into_pointer_value(); + // load the result from the result pointer + let result_ty = ctx.llvm_type(single_result)?; + ensure!( + result_ty == i64_t || result_ty == f64_t, + "ReadResult operation with a single output expects either \ + i64 or f64, got: {result_ty:?}" + ); - let float_result = ctx - .builder() - .build_load(float_result_ptr, "float_result")? - .into_float_value(); - op.outputs.finish( - ctx.builder(), - [ - gpu_ref.as_basic_value_enum(), - float_result.as_basic_value_enum(), - ], - )?; - } - _ => { - bail!( - "ReadResult operation with a single output expects either i64 or f64, got: {:?}", - ctx.llvm_type(single_result)? - ); - } - } + let result = ctx.builder().build_load(result_ty, result_ptr, "result")?; + op.outputs.finish( + ctx.builder(), + [gpu_ref.as_basic_value_enum(), result.as_basic_value_enum()], + )?; } other => { bail!("ReadResult operation expects either zero or one, got: {other:?}") @@ -660,7 +615,7 @@ fn emit_api_validation<'c, H: HugrView>( let already_validated = builder.build_int_compare( inkwell::IntPredicate::NE, builder - .build_load(stored.as_pointer_value(), "validated")? + .build_load(iwc.i8_type(), stored.as_pointer_value(), "validated")? .into_int_value(), iwc.i8_type().const_zero(), "already_validated", @@ -744,9 +699,7 @@ fn emit_panic_with_gpu_error<'c, H: HugrView>( // Try to get the error message from the GPU library. let gpu_get_error = ctx.get_extern_func( "gpu_get_error", - iwc.i8_type() - .ptr_type(AddressSpace::default()) - .fn_type(&[], false), + iwc.ptr_type(AddressSpace::default()).fn_type(&[], false), )?; let error_message = ctx @@ -761,7 +714,7 @@ fn emit_panic_with_gpu_error<'c, H: HugrView>( ctx.builder().build_int_compare( inkwell::IntPredicate::EQ, error_message, - iwc.i8_type().ptr_type(AddressSpace::default()).const_null(), + iwc.ptr_type(AddressSpace::default()).const_null(), "is_null", )?, ctx.builder() @@ -948,6 +901,7 @@ fn pack_arguments<'c, H: HugrView>( for &arg in fn_args { let dest_ptr = unsafe { builder.build_in_bounds_gep( + blob_ty, blob, &[ iwc.i64_type().const_zero(), @@ -966,32 +920,18 @@ fn pack_arguments<'c, H: HugrView>( } BasicTypeEnum::IntType(i) if i.get_bit_width() == 64 => { // Store the integer into an aligned i64 temporary, - // then copy its bytes into the blob in an unaligned manner. + // then copy its bytes into the blob with 1-byte alignment let tmp = builder.build_alloca(iwc.i64_type(), "arg_i64_tmp")?; builder.build_store(tmp, arg)?; - let src_i8 = builder.build_pointer_cast( - tmp, - iwc.i8_type() - .array_type(8) - .ptr_type(AddressSpace::default()), - "arg_i8_ptr", - )?; - builder.build_memcpy(dest_ptr, 1, src_i8, 1, iwc.i64_type().const_int(8, false))?; + builder.build_memcpy(dest_ptr, 1, tmp, 1, iwc.i64_type().const_int(8, false))?; offset += 8; } BasicTypeEnum::FloatType(_) => { // Store the float into an aligned f64 temporary, - // then copy its bytes into the blob in an unaligned manner. + // then copy its bytes into the blob with 1-byte alginment let tmp = builder.build_alloca(iwc.f64_type(), "arg_f64_tmp")?; builder.build_store(tmp, arg)?; - let src_i8 = builder.build_pointer_cast( - tmp, - iwc.i8_type() - .array_type(8) - .ptr_type(AddressSpace::default()), - "arg_i8_ptr", - )?; - builder.build_memcpy(dest_ptr, 1, src_i8, 1, iwc.i64_type().const_int(8, false))?; + builder.build_memcpy(dest_ptr, 1, tmp, 1, iwc.i64_type().const_int(8, false))?; offset += 8; } // We have already validated types when sizing the blob, @@ -1040,17 +980,17 @@ mod test { })] #[case::call_ret_int(GpuOp::Call { inputs: type_row![], - outputs: TypeRow::from(usize_t()), + outputs: TypeRow::from(vec![usize_t()]), })] #[case::call_ret_float(GpuOp::Call { inputs: type_row![], - outputs: TypeRow::from(float64_type()), + outputs: TypeRow::from(vec![float64_type()]), })] #[case::read_result_int(GpuOp::ReadResult { - outputs: TypeRow::from(usize_t()), + outputs: TypeRow::from(vec![usize_t()]), })] #[case::read_result_float(GpuOp::ReadResult { - outputs: TypeRow::from(float64_type()), + outputs: TypeRow::from(vec![float64_type()]), })] fn gpu_codegen(#[context] ctx: Context, mut llvm_ctx: TestContext, #[case] op: GpuOp) { let _g = { diff --git a/qis-compiler/rust/selene_specific.rs b/qis-compiler/rust/selene_specific.rs index 790f15690..e10ef32bf 100644 --- a/qis-compiler/rust/selene_specific.rs +++ b/qis-compiler/rust/selene_specific.rs @@ -22,7 +22,7 @@ pub fn panic_str_fn<'c>( let panic_str_type = iwc.void_type().fn_type( &[ iwc.i32_type().into(), - iwc.i8_type().ptr_type(AddressSpace::default()).into(), + iwc.ptr_type(AddressSpace::default()).into(), ], false, ); diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_args.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_args.snap deleted file mode 100644 index 98a1ae2ec..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_args.snap +++ /dev/null @@ -1,80 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@arg_types = private unnamed_addr constant [7 x i8] c"iifb:v\00", align 1 -@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 - -define private i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %gpu_input_blob = alloca [25 x i8], align 1 - %dest_ptr = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 0 - %arg_i64_tmp = alloca i64, align 8 - store i64 %2, i64* %arg_i64_tmp, align 4 - %arg_i8_ptr = bitcast i64* %arg_i64_tmp to [8 x i8]* - %6 = bitcast [8 x i8]* %arg_i8_ptr to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr, i8* align 1 %6, i64 8, i1 false) - %dest_ptr7 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 8 - %arg_i64_tmp8 = alloca i64, align 8 - store i64 %3, i64* %arg_i64_tmp8, align 4 - %arg_i8_ptr9 = bitcast i64* %arg_i64_tmp8 to [8 x i8]* - %7 = bitcast [8 x i8]* %arg_i8_ptr9 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr7, i8* align 1 %7, i64 8, i1 false) - %dest_ptr10 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 16 - %arg_f64_tmp = alloca double, align 8 - store double %4, double* %arg_f64_tmp, align 8 - %arg_i8_ptr11 = bitcast double* %arg_f64_tmp to [8 x i8]* - %8 = bitcast [8 x i8]* %arg_i8_ptr11 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr10, i8* align 1 %8, i64 8, i1 false) - %dest_ptr12 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 24 - %arg_i8 = zext i1 %5 to i8 - store i8 %arg_i8, i8* %dest_ptr12, align 1 - %gpu_input_blob_ptr = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 0 - %9 = call i8 @gpu_call(i64 %0, i64 %1, i64 25, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arg_types, i32 0, i32 0)) - call void @validate_gpu_response(i8 %9) - ret i64 %0 -} - -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) - -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 - -; Function Attrs: noinline -define void @validate_gpu_response(i8 %0) #1 { -entry: - %success = icmp ne i8 %0, 0 - br i1 %success, label %ok, label %err - -ok: ; preds = %entry - ret void - -err: ; preds = %entry - call void @gpu_error_handler() - unreachable -} - -; Function Attrs: noinline -define void @gpu_error_handler() #1 { -entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) - unreachable -} - -declare i8* @gpu_get_error() - -; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #2 - -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { noinline } -attributes #2 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_id.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_id.snap deleted file mode 100644 index 6468af749..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_id.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -define private i64 @_hl.main.1({} %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - ret i64 42 -} diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_args.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_args.snap new file mode 100644 index 000000000..0ff4f43aa --- /dev/null +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_args.snap @@ -0,0 +1,73 @@ +--- +source: qis-compiler/rust/gpu.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@arg_types = private unnamed_addr constant [7 x i8] c"iifb:v\00", align 1 +@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 + +define internal i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %gpu_input_blob = alloca [25 x i8], align 1 + %dest_ptr = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 0 + %arg_i64_tmp = alloca i64, align 8 + store i64 %2, ptr %arg_i64_tmp, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr, ptr align 1 %arg_i64_tmp, i64 8, i1 false) + %dest_ptr7 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 8 + %arg_i64_tmp8 = alloca i64, align 8 + store i64 %3, ptr %arg_i64_tmp8, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr7, ptr align 1 %arg_i64_tmp8, i64 8, i1 false) + %dest_ptr9 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 16 + %arg_f64_tmp = alloca double, align 8 + store double %4, ptr %arg_f64_tmp, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr9, ptr align 1 %arg_f64_tmp, i64 8, i1 false) + %dest_ptr10 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 24 + %arg_i8 = zext i1 %5 to i8 + store i8 %arg_i8, ptr %dest_ptr10, align 1 + %6 = call i8 @gpu_call(i64 %0, i64 %1, i64 25, ptr %gpu_input_blob, ptr @arg_types) + call void @validate_gpu_response(i8 %6) + ret i64 %0 +} + +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) + +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 + +; Function Attrs: noinline +define void @validate_gpu_response(i8 %0) #1 { +entry: + %success = icmp ne i8 %0, 0 + br i1 %success, label %ok, label %err + +ok: ; preds = %entry + ret void + +err: ; preds = %entry + call void @gpu_error_handler() + unreachable +} + +; Function Attrs: noinline +define void @gpu_error_handler() #1 { +entry: + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) + unreachable +} + +declare ptr @gpu_get_error() + +; Function Attrs: noreturn +declare void @panic_str(i32, ptr) #2 + +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { noinline } +attributes #2 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap similarity index 59% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_float.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap index 85ffc5c72..fd16e5f37 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_float.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap @@ -8,19 +8,18 @@ source_filename = "test_context" @arg_types = private unnamed_addr constant [3 x i8] c":f\00", align 1 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %gpu_input_blob = alloca [0 x i8], align 1 - %gpu_input_blob_ptr = getelementptr inbounds [0 x i8], [0 x i8]* %gpu_input_blob, i64 0, i64 0 - %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @arg_types, i32 0, i32 0)) + %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, ptr %gpu_input_blob, ptr @arg_types) call void @validate_gpu_response(i8 %2) ret i64 %0 } -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -39,17 +38,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap similarity index 59% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_int.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap index 7b0cc8b75..7ce1e98ad 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_call_ret_int.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap @@ -8,19 +8,18 @@ source_filename = "test_context" @arg_types = private unnamed_addr constant [3 x i8] c":i\00", align 1 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %gpu_input_blob = alloca [0 x i8], align 1 - %gpu_input_blob_ptr = getelementptr inbounds [0 x i8], [0 x i8]* %gpu_input_blob, i64 0, i64 0 - %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @arg_types, i32 0, i32 0)) + %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, ptr %gpu_input_blob, ptr @arg_types) call void @validate_gpu_response(i8 %2) ret i64 %0 } -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -39,17 +38,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_dispose_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap similarity index 70% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_dispose_context.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap index 7ba4c6376..25efa7d01 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_dispose_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap @@ -7,7 +7,7 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block @@ -36,17 +36,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_get_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap similarity index 71% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_get_context.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap index cad6348bb..7398e3bdf 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_get_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap @@ -8,16 +8,16 @@ source_filename = "test_context" @gpu_validated = thread_local global i8 0 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private { i1, i64 } @_hl.main.1(i64 %0) { +define internal { i1, i64 } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block call void @run_gpu_validation() %gpu_ref_ptr = alloca i64, align 8 - %gpu_ref_call = call i8 @gpu_init(i64 %0, i64* %gpu_ref_ptr) + %gpu_ref_call = call i8 @gpu_init(i64 %0, ptr %gpu_ref_ptr) call void @validate_gpu_response(i8 %gpu_ref_call) - %gpu_ref = load i64, i64* %gpu_ref_ptr, align 4 + %gpu_ref = load i64, ptr %gpu_ref_ptr, align 4 %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %gpu_ref, 1 ret { i1, i64 } %1 } @@ -25,7 +25,7 @@ entry_block: ; preds = %alloca_block ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated = icmp ne i8 %validated, 0 br i1 %already_validated, label %done, label %validate @@ -35,7 +35,7 @@ done: ; preds = %entry validate: ; preds = %entry %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0) call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 ret void } @@ -58,19 +58,19 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 -declare i8 @gpu_init(i64, i64*) +declare i8 @gpu_init(i64, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap similarity index 85% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap index 6468af749..16374dfb8 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) { alloca_block: br label %entry_block diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_name.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap similarity index 68% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_name.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap index b878a95a5..0f69bb55d 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_lookup_by_name.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap @@ -11,7 +11,7 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 @function_name = private unnamed_addr constant [17 x i8] c"example_function\00", align 1 -define private i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) { alloca_block: br label %entry_block @@ -23,29 +23,29 @@ entry_block: ; preds = %alloca_block ; Function Attrs: noinline define i64 @gpu_function_id_example_function() #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_example_function, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_example_function, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache lookup: ; preds = %entry call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name, i32 0, i32 0), i64* %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr @function_name, ptr %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 4 - store i64 %function_id2, i64* @gpu_cache_function_id_example_function, align 4 - store i8 1, i8* @gpu_cache_is_set_function_id_example_function, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 4 + store i64 %function_id2, ptr @gpu_cache_function_id_example_function, align 4 + store i8 1, ptr @gpu_cache_is_set_function_id_example_function, align 1 ret i64 %function_id2 read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_example_function, align 4 + %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4 ret i64 %function_id1 } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated = icmp ne i8 %validated, 0 br i1 %already_validated, label %done, label %validate @@ -55,7 +55,7 @@ done: ; preds = %entry validate: ; preds = %entry %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0) call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 ret void } @@ -78,19 +78,19 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 -declare i8 @gpu_get_function_id(i8*, i64*) +declare i8 @gpu_get_function_id(ptr, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap similarity index 55% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_int.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap index 9cce5d931..48745fbc6 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_int.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap @@ -7,22 +7,21 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, double } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %int_result = alloca i64, align 8 - %result_ptr = bitcast i64* %int_result to i8* - %read_status = call i8 @gpu_get_result(i64 %0, i64 8, i8* %result_ptr) + %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result) call void @validate_gpu_response(i8 %read_status) - %int_result2 = load i64, i64* %int_result, align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %0, 0 - %mrv7 = insertvalue { i64, i64 } %mrv, i64 %int_result2, 1 - ret { i64, i64 } %mrv7 + %result = load double, ptr %int_result, align 8 + %mrv = insertvalue { i64, double } poison, i64 %0, 0 + %mrv6 = insertvalue { i64, double } %mrv, double %result, 1 + ret { i64, double } %mrv6 } -declare i8 @gpu_get_result(i64, i64, i8*) +declare i8 @gpu_get_result(i64, i64, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -41,17 +40,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap similarity index 52% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_float.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap index eedc05542..6d22a6ce3 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm14_read_result_float.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap @@ -7,23 +7,21 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private { i64, double } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %int_result = alloca i64, align 8 - %result_ptr = bitcast i64* %int_result to i8* - %read_status = call i8 @gpu_get_result(i64 %0, i64 8, i8* %result_ptr) + %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result) call void @validate_gpu_response(i8 %read_status) - %float_result_ptr = bitcast i64* %int_result to double* - %float_result = load double, double* %float_result_ptr, align 8 - %mrv = insertvalue { i64, double } undef, i64 %0, 0 - %mrv6 = insertvalue { i64, double } %mrv, double %float_result, 1 - ret { i64, double } %mrv6 + %result = load i64, ptr %int_result, align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 + %mrv6 = insertvalue { i64, i64 } %mrv, i64 %result, 1 + ret { i64, i64 } %mrv6 } -declare i8 @gpu_get_result(i64, i64, i8*) +declare i8 @gpu_get_result(i64, i64, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -42,17 +40,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_args.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_args.snap deleted file mode 100644 index e2b7b72a3..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_args.snap +++ /dev/null @@ -1,104 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@arg_types = private unnamed_addr constant [7 x i8] c"iifb:v\00", align 1 -@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 - -define private i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) { -alloca_block: - %"0" = alloca i64, align 8 - %"2_0" = alloca i64, align 8 - %"2_1" = alloca i64, align 8 - %"2_2" = alloca i64, align 8 - %"2_3" = alloca i64, align 8 - %"2_4" = alloca double, align 8 - %"2_5" = alloca i1, align 1 - %"4_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - store i64 %2, i64* %"2_2", align 4 - store i64 %3, i64* %"2_3", align 4 - store double %4, double* %"2_4", align 8 - store i1 %5, i1* %"2_5", align 1 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load i64, i64* %"2_1", align 4 - %"2_23" = load i64, i64* %"2_2", align 4 - %"2_34" = load i64, i64* %"2_3", align 4 - %"2_45" = load double, double* %"2_4", align 8 - %"2_56" = load i1, i1* %"2_5", align 1 - %gpu_input_blob = alloca [25 x i8], align 1 - %dest_ptr = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 0 - %arg_i64_tmp = alloca i64, align 8 - store i64 %"2_23", i64* %arg_i64_tmp, align 4 - %arg_i8_ptr = bitcast i64* %arg_i64_tmp to [8 x i8]* - %6 = bitcast [8 x i8]* %arg_i8_ptr to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr, i8* align 1 %6, i64 8, i1 false) - %dest_ptr7 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 8 - %arg_i64_tmp8 = alloca i64, align 8 - store i64 %"2_34", i64* %arg_i64_tmp8, align 4 - %arg_i8_ptr9 = bitcast i64* %arg_i64_tmp8 to [8 x i8]* - %7 = bitcast [8 x i8]* %arg_i8_ptr9 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr7, i8* align 1 %7, i64 8, i1 false) - %dest_ptr10 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 16 - %arg_f64_tmp = alloca double, align 8 - store double %"2_45", double* %arg_f64_tmp, align 8 - %arg_i8_ptr11 = bitcast double* %arg_f64_tmp to [8 x i8]* - %8 = bitcast [8 x i8]* %arg_i8_ptr11 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %dest_ptr10, i8* align 1 %8, i64 8, i1 false) - %dest_ptr12 = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 24 - %arg_i8 = zext i1 %"2_56" to i8 - store i8 %arg_i8, i8* %dest_ptr12, align 1 - %gpu_input_blob_ptr = getelementptr inbounds [25 x i8], [25 x i8]* %gpu_input_blob, i64 0, i64 0 - %9 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 25, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arg_types, i32 0, i32 0)) - call void @validate_gpu_response(i8 %9) - store i64 %"2_01", i64* %"4_0", align 4 - %"4_013" = load i64, i64* %"4_0", align 4 - store i64 %"4_013", i64* %"0", align 4 - %"014" = load i64, i64* %"0", align 4 - ret i64 %"014" -} - -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) - -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 - -; Function Attrs: noinline -define void @validate_gpu_response(i8 %0) #1 { -entry: - %success = icmp ne i8 %0, 0 - br i1 %success, label %ok, label %err - -ok: ; preds = %entry - ret void - -err: ; preds = %entry - call void @gpu_error_handler() - unreachable -} - -; Function Attrs: noinline -define void @gpu_error_handler() #1 { -entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) - unreachable -} - -declare i8* @gpu_get_error() - -; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #2 - -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { noinline } -attributes #2 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_id.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_id.snap deleted file mode 100644 index 19c0b4ee3..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_id.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -define private i64 @_hl.main.1({} %0) { -alloca_block: - %"0" = alloca i64, align 8 - %"2_0" = alloca {}, align 8 - %"4_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 - store i64 42, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 - ret i64 %"03" -} diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_float.snap deleted file mode 100644 index 989b067db..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_float.snap +++ /dev/null @@ -1,73 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 - -define private { i64, double } @_hl.main.1(i64 %0) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca double, align 8 - %"2_0" = alloca i64, align 8 - %"4_0" = alloca i64, align 8 - %"4_1" = alloca double, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %int_result = alloca i64, align 8 - %result_ptr = bitcast i64* %int_result to i8* - %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, i8* %result_ptr) - call void @validate_gpu_response(i8 %read_status) - %float_result_ptr = bitcast i64* %int_result to double* - %float_result = load double, double* %float_result_ptr, align 8 - store i64 %"2_01", i64* %"4_0", align 4 - store double %float_result, double* %"4_1", align 8 - %"4_02" = load i64, i64* %"4_0", align 4 - %"4_13" = load double, double* %"4_1", align 8 - store i64 %"4_02", i64* %"0", align 4 - store double %"4_13", double* %"1", align 8 - %"04" = load i64, i64* %"0", align 4 - %"15" = load double, double* %"1", align 8 - %mrv = insertvalue { i64, double } undef, i64 %"04", 0 - %mrv6 = insertvalue { i64, double } %mrv, double %"15", 1 - ret { i64, double } %mrv6 -} - -declare i8 @gpu_get_result(i64, i64, i8*) - -; Function Attrs: noinline -define void @validate_gpu_response(i8 %0) #0 { -entry: - %success = icmp ne i8 %0, 0 - br i1 %success, label %ok, label %err - -ok: ; preds = %entry - ret void - -err: ; preds = %entry - call void @gpu_error_handler() - unreachable -} - -; Function Attrs: noinline -define void @gpu_error_handler() #0 { -entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) - unreachable -} - -declare i8* @gpu_get_error() - -; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 - -attributes #0 = { noinline } -attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_int.snap deleted file mode 100644 index 973b00862..000000000 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_read_result_int.snap +++ /dev/null @@ -1,72 +0,0 @@ ---- -source: qis-compiler/rust/gpu.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 - -define private { i64, i64 } @_hl.main.1(i64 %0) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca i64, align 8 - %"2_0" = alloca i64, align 8 - %"4_0" = alloca i64, align 8 - %"4_1" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %int_result = alloca i64, align 8 - %result_ptr = bitcast i64* %int_result to i8* - %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, i8* %result_ptr) - call void @validate_gpu_response(i8 %read_status) - %int_result2 = load i64, i64* %int_result, align 4 - store i64 %"2_01", i64* %"4_0", align 4 - store i64 %int_result2, i64* %"4_1", align 4 - %"4_03" = load i64, i64* %"4_0", align 4 - %"4_14" = load i64, i64* %"4_1", align 4 - store i64 %"4_03", i64* %"0", align 4 - store i64 %"4_14", i64* %"1", align 4 - %"05" = load i64, i64* %"0", align 4 - %"16" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"05", 0 - %mrv7 = insertvalue { i64, i64 } %mrv, i64 %"16", 1 - ret { i64, i64 } %mrv7 -} - -declare i8 @gpu_get_result(i64, i64, i8*) - -; Function Attrs: noinline -define void @validate_gpu_response(i8 %0) #0 { -entry: - %success = icmp ne i8 %0, 0 - br i1 %success, label %ok, label %err - -ok: ; preds = %entry - ret void - -err: ; preds = %entry - call void @gpu_error_handler() - unreachable -} - -; Function Attrs: noinline -define void @gpu_error_handler() #0 { -entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) - unreachable -} - -declare i8* @gpu_get_error() - -; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 - -attributes #0 = { noinline } -attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_args.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_args.snap new file mode 100644 index 000000000..468dcebaf --- /dev/null +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_args.snap @@ -0,0 +1,97 @@ +--- +source: qis-compiler/rust/gpu.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@arg_types = private unnamed_addr constant [7 x i8] c"iifb:v\00", align 1 +@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 + +define internal i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) { +alloca_block: + %"0" = alloca i64, align 8 + %"2_0" = alloca i64, align 8 + %"2_1" = alloca i64, align 8 + %"2_2" = alloca i64, align 8 + %"2_3" = alloca i64, align 8 + %"2_4" = alloca double, align 8 + %"2_5" = alloca i1, align 1 + %"4_0" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + store i64 %2, ptr %"2_2", align 4 + store i64 %3, ptr %"2_3", align 4 + store double %4, ptr %"2_4", align 8 + store i1 %5, ptr %"2_5", align 1 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load i64, ptr %"2_1", align 4 + %"2_23" = load i64, ptr %"2_2", align 4 + %"2_34" = load i64, ptr %"2_3", align 4 + %"2_45" = load double, ptr %"2_4", align 8 + %"2_56" = load i1, ptr %"2_5", align 1 + %gpu_input_blob = alloca [25 x i8], align 1 + %dest_ptr = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 0 + %arg_i64_tmp = alloca i64, align 8 + store i64 %"2_23", ptr %arg_i64_tmp, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr, ptr align 1 %arg_i64_tmp, i64 8, i1 false) + %dest_ptr7 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 8 + %arg_i64_tmp8 = alloca i64, align 8 + store i64 %"2_34", ptr %arg_i64_tmp8, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr7, ptr align 1 %arg_i64_tmp8, i64 8, i1 false) + %dest_ptr9 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 16 + %arg_f64_tmp = alloca double, align 8 + store double %"2_45", ptr %arg_f64_tmp, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr9, ptr align 1 %arg_f64_tmp, i64 8, i1 false) + %dest_ptr10 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 24 + %arg_i8 = zext i1 %"2_56" to i8 + store i8 %arg_i8, ptr %dest_ptr10, align 1 + %6 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 25, ptr %gpu_input_blob, ptr @arg_types) + call void @validate_gpu_response(i8 %6) + store i64 %"2_01", ptr %"4_0", align 4 + %"4_011" = load i64, ptr %"4_0", align 4 + store i64 %"4_011", ptr %"0", align 4 + %"012" = load i64, ptr %"0", align 4 + ret i64 %"012" +} + +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) + +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 + +; Function Attrs: noinline +define void @validate_gpu_response(i8 %0) #1 { +entry: + %success = icmp ne i8 %0, 0 + br i1 %success, label %ok, label %err + +ok: ; preds = %entry + ret void + +err: ; preds = %entry + call void @gpu_error_handler() + unreachable +} + +; Function Attrs: noinline +define void @gpu_error_handler() #1 { +entry: + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) + unreachable +} + +declare ptr @gpu_get_error() + +; Function Attrs: noreturn +declare void @panic_str(i32, ptr) #2 + +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { noinline } +attributes #2 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_float.snap similarity index 52% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_float.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_float.snap index e2e6fcab2..b7607bcd1 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_float.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_float.snap @@ -8,7 +8,7 @@ source_filename = "test_context" @arg_types = private unnamed_addr constant [3 x i8] c":f\00", align 1 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -17,22 +17,21 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load i64, i64* %"2_1", align 4 + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load i64, ptr %"2_1", align 4 %gpu_input_blob = alloca [0 x i8], align 1 - %gpu_input_blob_ptr = getelementptr inbounds [0 x i8], [0 x i8]* %gpu_input_blob, i64 0, i64 0 - %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @arg_types, i32 0, i32 0)) + %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, ptr %gpu_input_blob, ptr @arg_types) call void @validate_gpu_response(i8 %2) - store i64 %"2_01", i64* %"4_0", align 4 - %"4_03" = load i64, i64* %"4_0", align 4 - store i64 %"4_03", i64* %"0", align 4 - %"04" = load i64, i64* %"0", align 4 + store i64 %"2_01", ptr %"4_0", align 4 + %"4_03" = load i64, ptr %"4_0", align 4 + store i64 %"4_03", ptr %"0", align 4 + %"04" = load i64, ptr %"0", align 4 ret i64 %"04" } -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -51,17 +50,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_int.snap similarity index 52% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_int.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_int.snap index 1a9c2f702..887dcc397 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_call_ret_int.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_int.snap @@ -8,7 +8,7 @@ source_filename = "test_context" @arg_types = private unnamed_addr constant [3 x i8] c":i\00", align 1 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -17,22 +17,21 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load i64, i64* %"2_1", align 4 + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load i64, ptr %"2_1", align 4 %gpu_input_blob = alloca [0 x i8], align 1 - %gpu_input_blob_ptr = getelementptr inbounds [0 x i8], [0 x i8]* %gpu_input_blob, i64 0, i64 0 - %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, i8* %gpu_input_blob_ptr, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @arg_types, i32 0, i32 0)) + %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, ptr %gpu_input_blob, ptr @arg_types) call void @validate_gpu_response(i8 %2) - store i64 %"2_01", i64* %"4_0", align 4 - %"4_03" = load i64, i64* %"4_0", align 4 - store i64 %"4_03", i64* %"0", align 4 - %"04" = load i64, i64* %"0", align 4 + store i64 %"2_01", ptr %"4_0", align 4 + %"4_03" = load i64, ptr %"4_0", align 4 + store i64 %"4_03", ptr %"0", align 4 + %"04" = load i64, ptr %"0", align 4 ret i64 %"04" } -declare i8 @gpu_call(i64, i64, i64, i8*, i8*) +declare i8 @gpu_call(i64, i64, i64, ptr, ptr) ; Function Attrs: noinline define void @validate_gpu_response(i8 %0) #0 { @@ -51,17 +50,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_dispose_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap similarity index 67% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_dispose_context.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap index 777cfa6ce..493e89095 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_dispose_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap @@ -7,14 +7,14 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 %1 = call i8 @gpu_discard(i64 %"2_01") call void @validate_gpu_response(i8 %1) ret void @@ -39,17 +39,17 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_get_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_get_context.snap similarity index 64% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_get_context.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_get_context.snap index 8f769cc48..246127c30 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_get_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_get_context.snap @@ -8,7 +8,7 @@ source_filename = "test_context" @gpu_validated = thread_local global i8 0 @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define private { i1, i64 } @_hl.main.1(i64 %0) { +define internal { i1, i64 } @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca { i1, i64 }, align 8 %"2_0" = alloca i64, align 8 @@ -16,25 +16,25 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @run_gpu_validation() %gpu_ref_ptr = alloca i64, align 8 - %gpu_ref_call = call i8 @gpu_init(i64 %"2_01", i64* %gpu_ref_ptr) + %gpu_ref_call = call i8 @gpu_init(i64 %"2_01", ptr %gpu_ref_ptr) call void @validate_gpu_response(i8 %gpu_ref_call) - %gpu_ref = load i64, i64* %gpu_ref_ptr, align 4 + %gpu_ref = load i64, ptr %gpu_ref_ptr, align 4 %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %gpu_ref, 1 - store { i1, i64 } %1, { i1, i64 }* %"4_0", align 4 - %"4_02" = load { i1, i64 }, { i1, i64 }* %"4_0", align 4 - store { i1, i64 } %"4_02", { i1, i64 }* %"0", align 4 - %"03" = load { i1, i64 }, { i1, i64 }* %"0", align 4 + store { i1, i64 } %1, ptr %"4_0", align 4 + %"4_02" = load { i1, i64 }, ptr %"4_0", align 4 + store { i1, i64 } %"4_02", ptr %"0", align 4 + %"03" = load { i1, i64 }, ptr %"0", align 4 ret { i1, i64 } %"03" } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated = icmp ne i8 %validated, 0 br i1 %already_validated, label %done, label %validate @@ -44,7 +44,7 @@ done: ; preds = %entry validate: ; preds = %entry %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0) call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 ret void } @@ -67,19 +67,19 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 -declare i8 @gpu_init(i64, i64*) +declare i8 @gpu_init(i64, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.snap similarity index 55% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.snap index 19c0b4ee3..6404ffa44 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca {}, align 8 @@ -13,11 +13,11 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 - store i64 42, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store {} %0, ptr %"2_0", align 1 + %"2_01" = load {}, ptr %"2_0", align 1 + store i64 42, ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_name.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_name.snap similarity index 64% rename from qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_name.snap rename to qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_name.snap index c376790f4..4eeaf454f 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm14_lookup_by_name.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_name.snap @@ -11,7 +11,7 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 @function_name = private unnamed_addr constant [17 x i8] c"example_function\00", align 1 -define private i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca {}, align 8 @@ -19,42 +19,42 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 + store {} %0, ptr %"2_0", align 1 + %"2_01" = load {}, ptr %"2_0", align 1 %function_id_call = call i64 @gpu_function_id_example_function() - store i64 %function_id_call, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store i64 %function_id_call, ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } ; Function Attrs: noinline define i64 @gpu_function_id_example_function() #0 { entry: - %function_id = load i8, i8* @gpu_cache_is_set_function_id_example_function, align 1 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_example_function, align 1 %needs_lookup = icmp eq i8 %function_id, 0 br i1 %needs_lookup, label %lookup, label %read_cache lookup: ; preds = %entry call void @run_gpu_validation() %function_id_ptr = alloca i64, align 8 - %function_id_call = call i8 @gpu_get_function_id(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @function_name, i32 0, i32 0), i64* %function_id_ptr) + %function_id_call = call i8 @gpu_get_function_id(ptr @function_name, ptr %function_id_ptr) call void @validate_gpu_response(i8 %function_id_call) - %function_id2 = load i64, i64* %function_id_ptr, align 4 - store i64 %function_id2, i64* @gpu_cache_function_id_example_function, align 4 - store i8 1, i8* @gpu_cache_is_set_function_id_example_function, align 1 + %function_id2 = load i64, ptr %function_id_ptr, align 4 + store i64 %function_id2, ptr @gpu_cache_function_id_example_function, align 4 + store i8 1, ptr @gpu_cache_is_set_function_id_example_function, align 1 ret i64 %function_id2 read_cache: ; preds = %entry - %function_id1 = load i64, i64* @gpu_cache_function_id_example_function, align 4 + %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4 ret i64 %function_id1 } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, i8* @gpu_validated, align 1 + %validated = load i8, ptr @gpu_validated, align 1 %already_validated = icmp ne i8 %validated, 0 br i1 %already_validated, label %done, label %validate @@ -64,7 +64,7 @@ done: ; preds = %entry validate: ; preds = %entry %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0) call void @validate_gpu_response(i8 %validate_call) - store i8 1, i8* @gpu_validated, align 1 + store i8 1, ptr @gpu_validated, align 1 ret void } @@ -87,19 +87,19 @@ err: ; preds = %entry ; Function Attrs: noinline define void @gpu_error_handler() #0 { entry: - %error_message = call i8* @gpu_get_error() - %is_null = icmp eq i8* %error_message, null - %error_message_nonnull = select i1 %is_null, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @no_gpu_error, i32 0, i32 0), i8* %error_message - call void @panic_str(i32 70002, i8* %error_message_nonnull) + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) unreachable } -declare i8* @gpu_get_error() +declare ptr @gpu_get_error() ; Function Attrs: noreturn -declare void @panic_str(i32, i8*) #1 +declare void @panic_str(i32, ptr) #1 -declare i8 @gpu_get_function_id(i8*, i64*) +declare i8 @gpu_get_function_id(ptr, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_float.snap new file mode 100644 index 000000000..54c895b5a --- /dev/null +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_float.snap @@ -0,0 +1,71 @@ +--- +source: qis-compiler/rust/gpu.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 + +define internal { i64, double } @_hl.main.1(i64 %0) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca double, align 8 + %"2_0" = alloca i64, align 8 + %"4_0" = alloca i64, align 8 + %"4_1" = alloca double, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %int_result = alloca i64, align 8 + %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, ptr %int_result) + call void @validate_gpu_response(i8 %read_status) + %result = load double, ptr %int_result, align 8 + store i64 %"2_01", ptr %"4_0", align 4 + store double %result, ptr %"4_1", align 8 + %"4_02" = load i64, ptr %"4_0", align 4 + %"4_13" = load double, ptr %"4_1", align 8 + store i64 %"4_02", ptr %"0", align 4 + store double %"4_13", ptr %"1", align 8 + %"04" = load i64, ptr %"0", align 4 + %"15" = load double, ptr %"1", align 8 + %mrv = insertvalue { i64, double } poison, i64 %"04", 0 + %mrv6 = insertvalue { i64, double } %mrv, double %"15", 1 + ret { i64, double } %mrv6 +} + +declare i8 @gpu_get_result(i64, i64, ptr) + +; Function Attrs: noinline +define void @validate_gpu_response(i8 %0) #0 { +entry: + %success = icmp ne i8 %0, 0 + br i1 %success, label %ok, label %err + +ok: ; preds = %entry + ret void + +err: ; preds = %entry + call void @gpu_error_handler() + unreachable +} + +; Function Attrs: noinline +define void @gpu_error_handler() #0 { +entry: + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) + unreachable +} + +declare ptr @gpu_get_error() + +; Function Attrs: noreturn +declare void @panic_str(i32, ptr) #1 + +attributes #0 = { noinline } +attributes #1 = { noreturn } diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_int.snap new file mode 100644 index 000000000..1583dfee4 --- /dev/null +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_read_result_int.snap @@ -0,0 +1,71 @@ +--- +source: qis-compiler/rust/gpu.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 + +define internal { i64, i64 } @_hl.main.1(i64 %0) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca i64, align 8 + %"2_0" = alloca i64, align 8 + %"4_0" = alloca i64, align 8 + %"4_1" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %int_result = alloca i64, align 8 + %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, ptr %int_result) + call void @validate_gpu_response(i8 %read_status) + %result = load i64, ptr %int_result, align 4 + store i64 %"2_01", ptr %"4_0", align 4 + store i64 %result, ptr %"4_1", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + %"4_13" = load i64, ptr %"4_1", align 4 + store i64 %"4_02", ptr %"0", align 4 + store i64 %"4_13", ptr %"1", align 4 + %"04" = load i64, ptr %"0", align 4 + %"15" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"04", 0 + %mrv6 = insertvalue { i64, i64 } %mrv, i64 %"15", 1 + ret { i64, i64 } %mrv6 +} + +declare i8 @gpu_get_result(i64, i64, ptr) + +; Function Attrs: noinline +define void @validate_gpu_response(i8 %0) #0 { +entry: + %success = icmp ne i8 %0, 0 + br i1 %success, label %ok, label %err + +ok: ; preds = %entry + ret void + +err: ; preds = %entry + call void @gpu_error_handler() + unreachable +} + +; Function Attrs: noinline +define void @gpu_error_handler() #0 { +entry: + %error_message = call ptr @gpu_get_error() + %is_null = icmp eq ptr %error_message, null + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message + call void @panic_str(i32 70002, ptr %error_message_nonnull) + unreachable +} + +declare ptr @gpu_get_error() + +; Function Attrs: noreturn +declare void @panic_str(i32, ptr) #1 + +attributes #0 = { noinline } +attributes #1 = { noreturn } diff --git a/tket-py/Cargo.toml b/tket-py/Cargo.toml index 832701822..4ee2ac2fc 100644 --- a/tket-py/Cargo.toml +++ b/tket-py/Cargo.toml @@ -29,6 +29,7 @@ tket1-passes = { path = "../tket1-passes", version = "0.0.0" } derive_more = { workspace = true, features = ["into", "from"] } hugr = { workspace = true } +hugr-passes = { workspace = true } itertools = { workspace = true } num_cpus = { workspace = true } portmatching = { workspace = true } diff --git a/tket-py/src/circuit/tk2circuit.rs b/tket-py/src/circuit/tk2circuit.rs index 84df7677a..537eb698a 100644 --- a/tket-py/src/circuit/tk2circuit.rs +++ b/tket-py/src/circuit/tk2circuit.rs @@ -8,7 +8,6 @@ use std::num::{NonZero, NonZeroU8}; use std::sync::LazyLock; use anyhow::Context; -use hugr::algorithms::ComposablePass; use hugr::builder::{CircuitBuilder, DFGBuilder, Dataflow, DataflowHugr}; use hugr::envelope::{EnvelopeConfig, EnvelopeFormat, ZstdConfig}; use hugr::extension::prelude::qb_t; @@ -17,6 +16,7 @@ use hugr::ops::handle::NodeHandle; use hugr::ops::{ExtensionOp, OpType}; use hugr::package::Package; use hugr::types::Type; +use hugr_passes::composable::ComposablePass; use itertools::Itertools; use pyo3::exceptions::{PyAttributeError, PyValueError}; use pyo3::types::{PyAnyMethods, PyModule, PyString, PyTypeMethods}; diff --git a/tket-py/src/passes.rs b/tket-py/src/passes.rs index da357ada2..9b2679830 100644 --- a/tket-py/src/passes.rs +++ b/tket-py/src/passes.rs @@ -5,7 +5,7 @@ pub mod tket1; use std::{cmp::min, convert::TryInto, fs, num::NonZeroUsize, path::PathBuf}; -use hugr::algorithms::ComposablePass; +use hugr_passes::composable::ComposablePass; use pyo3::{prelude::*, types::IntoPyDict}; use tket::optimiser::badger::BadgerOptions; use tket::passes; diff --git a/tket-qsystem/Cargo.toml b/tket-qsystem/Cargo.toml index 0b610cf1b..0bd978448 100644 --- a/tket-qsystem/Cargo.toml +++ b/tket-qsystem/Cargo.toml @@ -25,6 +25,7 @@ required-features = ["cli"] [dependencies] hugr.workspace = true hugr-core.workspace = true +hugr-passes.workspace = true tket = { path = "../tket", version = "0.17.0" } tket-json-rs = { workspace = true } lazy_static.workspace = true diff --git a/tket-qsystem/src/extension/classical_compute.rs b/tket-qsystem/src/extension/classical_compute.rs index e077c78fc..f1281ad17 100644 --- a/tket-qsystem/src/extension/classical_compute.rs +++ b/tket-qsystem/src/extension/classical_compute.rs @@ -298,23 +298,23 @@ macro_rules! compute_opdef { match self { // [usize] -> [Context] Self::get_context => Signature::new( - usize_t(), - Type::from(ComputeOp::<$ext>::get_context_return_type( + vec![usize_t()], + vec![Type::from(ComputeOp::<$ext>::get_context_return_type( self.extension(), extension_ref, - )), + ))], ) .into(), // [Context] -> [] - Self::dispose_context => Signature::new(context_type, type_row![]).into(), + Self::dispose_context => Signature::new(vec![context_type], type_row![]).into(), // [Module] -> [ComputeType::Func { inputs, outputs }] Self::lookup_by_id => { let inputs = TypeRV::new_row_var_use(1, TypeBound::Copyable); let outputs = TypeRV::new_row_var_use(2, TypeBound::Copyable); let func_type = ComputeType::<$ext>::func_custom_type( - inputs, - outputs, + vec![inputs], + vec![outputs], self.extension(), extension_ref, ) @@ -335,8 +335,8 @@ macro_rules! compute_opdef { let outputs = TypeRV::new_row_var_use(2, TypeBound::Copyable); let func_type = ComputeType::<$ext>::func_custom_type( - inputs, - outputs, + vec![inputs], + vec![outputs], self.extension(), extension_ref, ) @@ -357,14 +357,14 @@ macro_rules! compute_opdef { let inputs = TypeRV::new_row_var_use(0, TypeBound::Copyable); let outputs = TypeRV::new_row_var_use(1, TypeBound::Copyable); let func_type = Type::new_extension(ComputeType::<$ext>::func_custom_type( - inputs.clone(), - outputs.clone(), + vec![inputs.clone()], + vec![outputs.clone()], self.extension(), extension_ref, )); let result_type = TypeRV::new_extension(ComputeType::<$ext>::result_custom_type( - outputs, + vec![outputs], self.extension(), extension_ref, )); @@ -383,7 +383,7 @@ macro_rules! compute_opdef { let outputs = TypeRV::new_row_var_use(0, TypeBound::Copyable); let result_type = TypeRV::new_extension(ComputeType::<$ext>::result_custom_type( - outputs.clone(), + vec![outputs.clone()], self.extension(), extension_ref, )); @@ -590,7 +590,9 @@ macro_rules! compute_opdef { extension_id: ExtensionId, extension_ref: &Weak, ) -> SumType { - option_type(ComputeType::<$ext>::Context.get_type(extension_id, extension_ref)) + option_type(vec![ + ComputeType::<$ext>::Context.get_type(extension_id, extension_ref), + ]) } } diff --git a/tket-qsystem/src/extension/classical_compute/gpu.rs b/tket-qsystem/src/extension/classical_compute/gpu.rs index 7fb02e0ce..8ee936c48 100644 --- a/tket-qsystem/src/extension/classical_compute/gpu.rs +++ b/tket-qsystem/src/extension/classical_compute/gpu.rs @@ -338,7 +338,7 @@ mod test { )); assert_eq!( op.to_extension_op().unwrap().signature(), - Signature::new(module_ty, func_ty) + Signature::new(vec![module_ty], vec![func_ty]) ); } diff --git a/tket-qsystem/src/extension/classical_compute/wasm.rs b/tket-qsystem/src/extension/classical_compute/wasm.rs index 91b5e22bf..ed5869e77 100644 --- a/tket-qsystem/src/extension/classical_compute/wasm.rs +++ b/tket-qsystem/src/extension/classical_compute/wasm.rs @@ -319,7 +319,7 @@ mod test { )); assert_eq!( op.to_extension_op().unwrap().signature(), - Signature::new(module_ty, func_ty) + Signature::new(vec![module_ty], vec![func_ty]) ); } diff --git a/tket-qsystem/src/extension/futures.rs b/tket-qsystem/src/extension/futures.rs index 67e386e8c..17ce320a4 100644 --- a/tket-qsystem/src/extension/futures.rs +++ b/tket-qsystem/src/extension/futures.rs @@ -108,15 +108,19 @@ impl MakeOpDef for FutureOpDef { let future_type = Type::new_extension(future_custom_type(t_type.clone(), extension_ref)); match self { FutureOpDef::Read => { - PolyFuncType::new([t_param], Signature::new(future_type, t_type)).into() + PolyFuncType::new([t_param], Signature::new(vec![future_type], vec![t_type])).into() } FutureOpDef::Dup => PolyFuncType::new( [t_param], - Signature::new(future_type.clone(), vec![future_type.clone(), future_type]), + Signature::new( + vec![future_type.clone()], + vec![future_type.clone(), future_type], + ), ) .into(), FutureOpDef::Free => { - PolyFuncType::new([t_param], Signature::new(future_type.clone(), vec![])).into() + PolyFuncType::new([t_param], Signature::new(vec![future_type.clone()], vec![])) + .into() } } } @@ -307,7 +311,10 @@ pub(crate) mod test { let hugr = { let mut func_builder = FunctionBuilder::new( "circuit", - PolyFuncType::new(vec![t_param], Signature::new(future_type, t.clone())), + PolyFuncType::new( + vec![t_param], + Signature::new(vec![future_type], vec![t.clone()]), + ), ) .unwrap(); let [future_w] = func_builder.input_wires_arr(); diff --git a/tket-qsystem/src/extension/qsystem.rs b/tket-qsystem/src/extension/qsystem.rs index 40d29719a..8a19498dc 100644 --- a/tket-qsystem/src/extension/qsystem.rs +++ b/tket-qsystem/src/extension/qsystem.rs @@ -120,17 +120,25 @@ impl MakeOpDef for QSystemOp { let one_qb_row = TypeRow::from(vec![qb_t()]); let two_qb_row = TypeRow::from(vec![qb_t(), qb_t()]); match self { - LazyMeasure => Signature::new(qb_t(), future_type(bool_t())), - LazyMeasureLeaked => Signature::new(qb_t(), future_type(int_type(6))), - LazyMeasureReset => Signature::new(qb_t(), vec![qb_t(), future_type(bool_t())]), - Reset => Signature::new(one_qb_row.clone(), one_qb_row), + LazyMeasure => Signature::new(one_qb_row.clone(), vec![future_type(bool_t())]), + LazyMeasureLeaked => Signature::new(one_qb_row.clone(), vec![future_type(int_type(6))]), + LazyMeasureReset => { + Signature::new(one_qb_row.clone(), vec![qb_t(), future_type(bool_t())]) + } + Reset => Signature::new(one_qb_row.clone(), one_qb_row.clone()), ZZPhase => Signature::new(vec![qb_t(), qb_t(), float64_type()], two_qb_row), - Measure => Signature::new(one_qb_row, bool_type()), - Rz => Signature::new(vec![qb_t(), float64_type()], one_qb_row), - PhasedX => Signature::new(vec![qb_t(), float64_type(), float64_type()], one_qb_row), - TryQAlloc => Signature::new(type_row![], Type::from(option_type(one_qb_row))), - QFree => Signature::new(one_qb_row, type_row![]), - MeasureReset => Signature::new(one_qb_row.clone(), vec![qb_t(), bool_type()]), + Measure => Signature::new(one_qb_row.clone(), vec![bool_type()]), + Rz => Signature::new(vec![qb_t(), float64_type()], one_qb_row.clone()), + PhasedX => Signature::new( + vec![qb_t(), float64_type(), float64_type()], + one_qb_row.clone(), + ), + TryQAlloc => Signature::new( + type_row![], + vec![Type::from(option_type(one_qb_row.clone()))], + ), + QFree => Signature::new(one_qb_row.clone(), type_row![]), + MeasureReset => Signature::new(one_qb_row, vec![qb_t(), bool_type()]), } .into() } @@ -217,10 +225,10 @@ impl MakeOpDef for RuntimeBarrierDef { fn init_signature(&self, _extension_ref: &Weak) -> SignatureFunc { PolyFuncType::new( [TypeParam::max_nat_type()], - Signature::new_endo( + Signature::new_endo(vec![ array_type_parametric(TypeArg::new_var_use(0, TypeParam::max_nat_type()), qb_t()) .unwrap(), - ), + ]), ) .into() } @@ -514,7 +522,7 @@ pub trait QSystemOpBuilder: Dataflow + UnwrapBuilder + ArrayOpBuilder { /// Build a qalloc operation that panics on failure. fn build_qalloc(&mut self) -> Result { let maybe_qb = self.add_try_alloc()?; - let [qb] = self.build_expect_sum(1, option_type(qb_t()), maybe_qb, |_| { + let [qb] = self.build_expect_sum(1, option_type(vec![qb_t()]), maybe_qb, |_| { "No more qubits available to allocate.".to_string() })?; Ok(qb) @@ -579,9 +587,11 @@ mod test { #[test] fn lazy_circuit() { let hugr = { - let mut func_builder = - FunctionBuilder::new("circuit", Signature::new(qb_t(), vec![qb_t(), bool_t()])) - .unwrap(); + let mut func_builder = FunctionBuilder::new( + "circuit", + Signature::new(vec![qb_t()], vec![qb_t(), bool_t()]), + ) + .unwrap(); let [qb] = func_builder.input_wires_arr(); let [qb, lazy_b] = func_builder.add_lazy_measure_reset(qb).unwrap(); let [b] = func_builder.add_read(lazy_b, bool_t()).unwrap(); @@ -594,7 +604,8 @@ mod test { fn leaked() { let hugr = { let mut func_builder = - FunctionBuilder::new("leaked", Signature::new(qb_t(), vec![int_type(6)])).unwrap(); + FunctionBuilder::new("leaked", Signature::new(vec![qb_t()], vec![int_type(6)])) + .unwrap(); let [qb] = func_builder.input_wires_arr(); let lazy_i = func_builder.add_lazy_measure_leaked(qb).unwrap(); let [i] = func_builder.add_read(lazy_i, int_type(6)).unwrap(); diff --git a/tket-qsystem/src/extension/qsystem/barrier.rs b/tket-qsystem/src/extension/qsystem/barrier.rs index 13990b906..408a46ea0 100644 --- a/tket-qsystem/src/extension/qsystem/barrier.rs +++ b/tket-qsystem/src/extension/qsystem/barrier.rs @@ -20,7 +20,7 @@ mod test { use rstest::rstest; fn opt_q_arr(size: u64) -> hugr::types::Type { - array_type(size, option_type(qb_t()).into()) + array_type(size, option_type(vec![qb_t()]).into()) } #[rstest] @@ -29,7 +29,7 @@ mod test { // special case, array of option qubit is unwrapped and unpacked #[case(vec![qb_t(), opt_q_arr(2)], 3, false)] // bare option of qubit is ignored - #[case(vec![qb_t(), option_type(qb_t()).into()], 1, false)] + #[case(vec![qb_t(), option_type(vec![qb_t()]).into()], 1, false)] #[case(vec![array_type(2, bool_t())], 0, false)] #[case(vec![borrow_array_type(2, qb_t())], 2, false)] // special case, single array of qubits is passed directly to op without unpacking diff --git a/tket-qsystem/src/extension/qsystem/barrier/barrier_inserter.rs b/tket-qsystem/src/extension/qsystem/barrier/barrier_inserter.rs index f195d2646..cf7d7d49b 100644 --- a/tket-qsystem/src/extension/qsystem/barrier/barrier_inserter.rs +++ b/tket-qsystem/src/extension/qsystem/barrier/barrier_inserter.rs @@ -5,7 +5,6 @@ use hugr::std_extensions::collections::array::ArrayKind; use hugr::types::{Signature, Type}; use hugr::{ Hugr, HugrView, IncomingPort, Node, OutgoingPort, Wire, - algorithms::replace_types::ReplaceTypes, builder::{DFGBuilder, Dataflow}, extension::prelude::Barrier, hugr::{ @@ -13,6 +12,7 @@ use hugr::{ patch::{PatchHugrMut, insert_cut::InsertCut}, }, }; +use hugr_passes::replace_types::ReplaceTypes; use tket::passes::unpack_container::type_unpack::{TypeUnpacker, is_array_of}; use crate::extension::qsystem::{ diff --git a/tket-qsystem/src/extension/qsystem/barrier/wrapped_barrier.rs b/tket-qsystem/src/extension/qsystem/barrier/wrapped_barrier.rs index 460dc22e8..5523dd91c 100644 --- a/tket-qsystem/src/extension/qsystem/barrier/wrapped_barrier.rs +++ b/tket-qsystem/src/extension/qsystem/barrier/wrapped_barrier.rs @@ -35,7 +35,7 @@ static TEMP_BARRIER_EXT: LazyLock> = LazyLock::new(|| { Default::default(), PolyFuncTypeRV::new( vec![TypeParam::new_list_type(TypeBound::Linear)], - FuncValueType::new_endo(TypeRV::new_row_var_use(0, TypeBound::Linear)), + FuncValueType::new_endo(vec![TypeRV::new_row_var_use(0, TypeBound::Linear)]), ), ext_ref, ) @@ -100,7 +100,8 @@ impl Default for WrappedBarrierBuilder { /// Build a runtime barrier operation for an array of qubits pub(super) fn build_runtime_barrier_op(array_size: u64) -> Result { - let mut barr_builder = DFGBuilder::new(Signature::new_endo(array_type(array_size, qb_t())))?; + let mut barr_builder = + DFGBuilder::new(Signature::new_endo(vec![array_type(array_size, qb_t())]))?; let array_wire = barr_builder.input().out_wire(0); let out = barr_builder.add_runtime_barrier(array_wire, array_size)?; barr_builder.finish_hugr_with_outputs([out]) diff --git a/tket-qsystem/src/extension/qsystem/lower.rs b/tket-qsystem/src/extension/qsystem/lower.rs index 25beb8af2..9aa5e2fc4 100644 --- a/tket-qsystem/src/extension/qsystem/lower.rs +++ b/tket-qsystem/src/extension/qsystem/lower.rs @@ -1,6 +1,4 @@ use derive_more::{Display, Error, From}; -use hugr::algorithms::replace_types::{NodeTemplate, ReplaceTypesError}; -use hugr::algorithms::{ComposablePass, ReplaceTypes}; use hugr::builder::{Container, HugrBuilder}; use hugr::core::Visibility; use hugr::extension::prelude::Barrier; @@ -18,6 +16,9 @@ use hugr::{ std_extensions::arithmetic::{float_ops::FloatOps, float_types::ConstF64}, types::Signature, }; +use hugr_passes::composable::WithScope; +use hugr_passes::replace_types::{NodeTemplate, ReplaceTypesError}; +use hugr_passes::{ComposablePass, ReplaceTypes}; use lazy_static::lazy_static; use std::collections::BTreeMap; use std::collections::btree_map::Entry; @@ -60,7 +61,7 @@ pub enum LowerTk2Error { OpReplacement(HugrError), /// An error raised when lowering operations. #[display("Error when lowering ops: {_0}")] - CircuitReplacement(hugr::algorithms::lower::LowerError), + CircuitReplacement(hugr_passes::lower::LowerError), /// TketOps were not lowered after the pass. #[display("TketOps were not lowered: {missing_ops:?}")] #[from(ignore)] @@ -275,6 +276,14 @@ pub fn check_lowered(hugr: &H) -> Result<(), Vec> { #[derive(Default, Debug, Clone)] pub struct LowerTketToQSystemPass; +impl WithScope for LowerTketToQSystemPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for LowerTketToQSystemPass { type Error = LowerTk2Error; type Result = (); @@ -307,14 +316,18 @@ mod test { .add_dataflow_op(TketOp::TryQAlloc, []) .unwrap() .outputs_arr(); - let [q] = b.build_unwrap_sum(1, option_type(qb_t()), maybe_q).unwrap(); + let [q] = b + .build_unwrap_sum(1, option_type(vec![qb_t()]), maybe_q) + .unwrap(); let [q] = b.add_dataflow_op(TketOp::Reset, [q]).unwrap().outputs_arr(); b.add_dataflow_op(TketOp::QFree, [q]).unwrap(); let [maybe_q] = b .add_dataflow_op(TketOp::TryQAlloc, []) .unwrap() .outputs_arr(); - let [q] = b.build_unwrap_sum(1, option_type(qb_t()), maybe_q).unwrap(); + let [q] = b + .build_unwrap_sum(1, option_type(vec![qb_t()]), maybe_q) + .unwrap(); let [_] = b .add_dataflow_op(TketOp::MeasureFree, [q]) @@ -385,7 +398,7 @@ mod test { #[test] fn test_mixed() { - let mut b = DFGBuilder::new(Signature::new(rotation_type(), bool_t())).unwrap(); + let mut b = DFGBuilder::new(Signature::new(vec![rotation_type()], vec![bool_t()])).unwrap(); let [angle] = b.input_wires_arr(); let qalloc = b.add_dataflow_op(TketOp::QAlloc, []).unwrap(); let [q] = qalloc.outputs_arr(); diff --git a/tket-qsystem/src/extension/random.rs b/tket-qsystem/src/extension/random.rs index a2c251c89..121495313 100644 --- a/tket-qsystem/src/extension/random.rs +++ b/tket-qsystem/src/extension/random.rs @@ -141,7 +141,9 @@ impl MakeOpDef for RandomOp { ), RandomOp::NewRNGContext => Signature::new( vec![int_type(6)], - Type::from(option_type(RandomType::RNGContext.get_type(extension_ref))), + vec![Type::from(option_type(vec![ + RandomType::RNGContext.get_type(extension_ref), + ]))], ), RandomOp::DeleteRNGContext => { Signature::new(vec![RandomType::RNGContext.get_type(extension_ref)], vec![]) @@ -273,7 +275,9 @@ mod test { let [ctx] = func_builder .build_unwrap_sum( 1, - option_type(RandomType::RNGContext.get_type(&Arc::downgrade(&EXTENSION))), + option_type(vec![ + RandomType::RNGContext.get_type(&Arc::downgrade(&EXTENSION)), + ]), maybe_ctx, ) .unwrap(); diff --git a/tket-qsystem/src/extension/result.rs b/tket-qsystem/src/extension/result.rs index bd3f1378f..40615d819 100644 --- a/tket-qsystem/src/extension/result.rs +++ b/tket-qsystem/src/extension/result.rs @@ -170,7 +170,7 @@ impl ResultOpDef { fn result_signature(&self) -> SignatureFunc { PolyFuncType::new( [vec![TypeParam::StringType], self.type_params()].concat(), - Signature::new(self.arg_type(), type_row![]), + Signature::new(vec![self.arg_type()], type_row![]), ) .into() } diff --git a/tket-qsystem/src/extension/utils.rs b/tket-qsystem/src/extension/utils.rs index 41ae1cfb9..3e2cebe56 100644 --- a/tket-qsystem/src/extension/utils.rs +++ b/tket-qsystem/src/extension/utils.rs @@ -71,7 +71,7 @@ impl MakeOpDef for UtilsOp { fn init_signature(&self, _extension_ref: &std::sync::Weak) -> SignatureFunc { match self { - UtilsOp::GetCurrentShot => Signature::new(type_row![], int_type(6)), + UtilsOp::GetCurrentShot => Signature::new(type_row![], vec![int_type(6)]), } .into() } diff --git a/tket-qsystem/src/lib.rs b/tket-qsystem/src/lib.rs index b7c1cf4dc..4fd55bfe1 100644 --- a/tket-qsystem/src/lib.rs +++ b/tket-qsystem/src/lib.rs @@ -11,14 +11,16 @@ pub mod pytket; pub mod replace_bools; use derive_more::{Display, Error, From}; -use hugr::algorithms::const_fold::{ConstFoldError, ConstantFoldPass}; -use hugr::algorithms::{ - ComposablePass as _, MonomorphizePass, RemoveDeadFuncsError, RemoveDeadFuncsPass, force_order, - replace_types::ReplaceTypesError, -}; use hugr::hugr::{HugrError, hugrmut::HugrMut}; use hugr::{Hugr, HugrView, Node, core::Visibility, ops::OpType}; use hugr_core::hugr::internal::HugrMutInternals; +use hugr_passes::PassScope; +use hugr_passes::composable::{Preserve, WithScope}; +use hugr_passes::const_fold::{ConstFoldError, ConstantFoldPass}; +use hugr_passes::{ + ComposablePass as _, MonomorphizePass, RemoveDeadFuncsError, RemoveDeadFuncsPass, force_order, + replace_types::ReplaceTypesError, +}; use std::collections::HashSet; use lower_drops::LowerDropsPass; @@ -30,12 +32,6 @@ use extension::{ qsystem::{LowerTk2Error, LowerTketToQSystemPass, QSystemOp}, }; -#[cfg(feature = "llvm")] -#[expect(deprecated)] -// TODO: We still want to run this as long as deserialized hugrs are allowed to contain Value::Function -// Once that variant is removed, we can remove this pass step. -use hugr::llvm::utils::inline_constant_functions; - /// Modify a [hugr::Hugr] into a form that is acceptable for ingress into a /// Q-System. Returns an error if this cannot be done. /// @@ -75,13 +71,10 @@ pub enum QSystemPassError { ConstantFoldError(ConstFoldError), /// An error from the component [LowerDropsPass] pass. LinearizeArrayError(ReplaceTypesError), - #[cfg(feature = "llvm")] - /// An error from the component [inline_constant_functions()] pass. - InlineConstantFunctionsError(anyhow::Error), /// An error when running [RemoveDeadFuncsPass] after the monomorphisation /// pass. /// - /// [RemoveDeadFuncsPass]: hugr::algorithms::RemoveDeadFuncsError + /// [RemoveDeadFuncsPass]: hugr_passes::RemoveDeadFuncsError DCEError(RemoveDeadFuncsError), /// No [FuncDefn] named "main" in [Module]. /// @@ -115,9 +108,8 @@ impl QSystemPass { if self.monomorphize { self.monomorphization().run(hugr).unwrap(); - #[expect(deprecated)] // Will move to pass scopes in - let rdfp = RemoveDeadFuncsPass::default().with_module_entry_points([entrypoint]); + let rdfp = RemoveDeadFuncsPass::default_with_scope(PassScope::Global(Preserve::All)); rdfp.run(hugr)? } @@ -152,13 +144,6 @@ impl QSystemPass { } } - #[cfg(feature = "llvm")] - { - // TODO: We still want to run this as long as deserialized hugrs are allowed to contain Value::Function - // Once that variant is removed, we can remove this pass step. - #[expect(deprecated)] - inline_constant_functions(hugr)?; - } if self.constant_fold { self.constant_fold().run(hugr)?; } @@ -223,7 +208,7 @@ impl QSystemPass { } fn monomorphization(&self) -> MonomorphizePass { - MonomorphizePass + MonomorphizePass::default() } fn lower_drops(&self) -> LowerDropsPass { @@ -316,7 +301,7 @@ mod test { let mut builder = mb .define_function( "main", - Signature::new(qb_t(), vec![bool_type(), bool_type()]), + Signature::new(vec![qb_t()], vec![bool_type(), bool_type()]), ) .unwrap(); let [qb] = builder.input_wires_arr(); @@ -386,7 +371,7 @@ mod test { fn hide_funcs() { let orig = { let arr_t = || array_type(4, bool_type()); - let mut dfb = FunctionBuilder::new("main", Signature::new_endo(arr_t())).unwrap(); + let mut dfb = FunctionBuilder::new("main", Signature::new_endo(vec![arr_t()])).unwrap(); let [arr] = dfb.input_wires_arr(); let (arr1, arr2) = dfb.add_array_clone(bool_type(), 4, arr).unwrap(); let dop = GUPPY_EXTENSION.get_op(&DROP_OP_NAME).unwrap(); @@ -429,51 +414,4 @@ mod test { ); assert_eq!(hugr.num_nodes(), hugr_public.num_nodes()); } - - #[cfg(feature = "llvm")] - #[test] - // TODO: We still want to test this as long as deserialized hugrs are allowed to contain Value::Function - // Once that variant is removed, we can remove this test. - #[expect(deprecated)] - fn const_function() { - use hugr::builder::{Container, DFGBuilder, DataflowHugr, ModuleBuilder}; - use hugr::ops::{CallIndirect, Value}; - - let qb_sig: Signature = Signature::new_endo(qb_t()); - let mut hugr = { - let mut builder = ModuleBuilder::new(); - let val = Value::function({ - let builder = DFGBuilder::new(Signature::new_endo(qb_t())).unwrap(); - let [r] = builder.input_wires_arr(); - builder.finish_hugr_with_outputs([r]).unwrap() - }) - .unwrap(); - let const_node = builder.add_constant(val); - { - let mut builder = builder.define_function("main", qb_sig.clone()).unwrap(); - let [i] = builder.input_wires_arr(); - let fun = builder.load_const(&const_node); - let [r] = builder - .add_dataflow_op( - CallIndirect { - signature: qb_sig.clone(), - }, - [fun, i], - ) - .unwrap() - .outputs_arr(); - builder.finish_with_outputs([r]).unwrap(); - }; - builder.finish_hugr().unwrap() - }; - - QSystemPass::default().run(&mut hugr).unwrap(); - - // QSystemPass should have removed the const function - for n in hugr.descendants(hugr.module_root()) { - if hugr.get_optype(n).as_const().is_some() { - panic!("Const function is still there!"); - } - } - } } diff --git a/tket-qsystem/src/llvm/array_utils.rs b/tket-qsystem/src/llvm/array_utils.rs index 430c5c2b0..dda38e4b1 100644 --- a/tket-qsystem/src/llvm/array_utils.rs +++ b/tket-qsystem/src/llvm/array_utils.rs @@ -5,10 +5,10 @@ use anyhow::Result; use hugr::extension::prelude::usize_t; use hugr::llvm::emit::EmitFuncContext; +use hugr::llvm::extension::collections::array; use hugr::llvm::extension::collections::array::{ build_array_fat_pointer, decompose_array_fat_pointer, }; -use hugr::llvm::extension::collections::{array, stack_array}; use hugr::llvm::inkwell::types::{BasicType, BasicTypeEnum}; use hugr::llvm::inkwell::values::BasicValueEnum; use hugr::llvm::{CodegenExtension, inkwell}; @@ -16,7 +16,7 @@ use hugr::{HugrView, Node}; use inkwell::AddressSpace; use inkwell::builder::{Builder, BuilderError}; use inkwell::context::Context; -use inkwell::types::{IntType, PointerType, StructType}; +use inkwell::types::{IntType, StructType}; use inkwell::values::{ArrayValue, IntValue, PointerValue, StructValue}; /// Specifies different array lowering strategies. @@ -32,6 +32,8 @@ pub trait ArrayLowering { &self, builder: &Builder<'c>, val: BasicValueEnum<'c>, + elem_type: BasicTypeEnum<'c>, + length: u32, ) -> Result>; /// Turns a pointer to the first array element into an array value in the given lowering. @@ -44,65 +46,6 @@ pub trait ArrayLowering { ) -> Result>; } -/// Array lowering via the stack as implemented in [stack_array]. -#[derive(Clone)] -#[allow( - deprecated, - clippy::allow_attributes, - reason = "Waiting for switch to new array lowering" -)] -pub struct StackArrayLowering(ACG); - -/// The default stack array lowering strategy using [stack_array::DefaultArrayCodegen]. -#[expect(deprecated)] -pub const DEFAULT_STACK_ARRAY_LOWERING: StackArrayLowering = - StackArrayLowering(stack_array::DefaultArrayCodegen); - -#[expect(deprecated)] -impl StackArrayLowering { - /// Creates a new [StackArrayLowering]. - pub const fn new(array_codegen: ACG) -> Self { - Self(array_codegen) - } -} - -#[expect(deprecated)] -impl ArrayLowering for StackArrayLowering { - fn codegen_extension(&self) -> impl CodegenExtension { - stack_array::ArrayCodegenExtension::new(self.0.clone()) - } - - fn array_to_ptr<'c>( - &self, - builder: &Builder<'c>, - val: BasicValueEnum<'c>, - ) -> Result> { - let (elem_ptr, _) = build_array_alloca(builder, val.into_array_value())?; - Ok(elem_ptr) - } - - fn array_from_ptr<'c, H: HugrView>( - &self, - ctx: &mut EmitFuncContext<'c, '_, H>, - ptr: PointerValue<'c>, - elem_type: BasicTypeEnum<'c>, - length: u32, - ) -> Result> { - let builder = ctx.builder(); - let ptr = builder - .build_bit_cast( - ptr, - elem_type - .array_type(length) - .ptr_type(AddressSpace::default()), - "", - )? - .into_pointer_value(); - let array = builder.build_load(ptr, "")?.into_array_value(); - Ok(array.into()) - } -} - /// Array lowering via a heap as implemented in [mod@array]. #[derive(Clone)] pub struct HeapArrayLowering(ACG); @@ -127,9 +70,12 @@ impl ArrayLowering for HeapArrayLowering &self, builder: &Builder<'c>, val: BasicValueEnum<'c>, + elem_type: BasicTypeEnum<'c>, + length: u32, ) -> Result> { let (array_ptr, offset) = decompose_array_fat_pointer(builder, val)?; - let elem_ptr = unsafe { builder.build_in_bounds_gep(array_ptr, &[offset], "")? }; + let array_ty = elem_type.array_type(length); + let elem_ptr = unsafe { builder.build_in_bounds_gep(array_ty, array_ptr, &[offset], "")? }; Ok(elem_ptr) } @@ -153,26 +99,19 @@ impl ArrayLowering for HeapArrayLowering /// Helper function to allocate an array on the stack. /// -/// Returns two pointers: The first one is a pointer to the first element of the -/// array (i.e. it is of type `array.get_element_type().ptr_type()`) whereas the -/// second one points to the whole array value, i.e. it is of type `array.ptr_type()`. -// Note: copied from -// https://github.com/quantinuum/hugr/blob/bf3889fa206fbb5a22a5ae4b9ea5f8cc0468b4b7/hugr-llvm/src/extension/collections/array.rs#L186 +/// Returns a pointer to the newly allocated array. pub fn build_array_alloca<'c>( builder: &Builder<'c>, array: ArrayValue<'c>, -) -> Result<(PointerValue<'c>, PointerValue<'c>), BuilderError> { +) -> Result, BuilderError> { let array_ty = array.get_type(); let array_len: IntValue<'c> = { let ctx = builder.get_insert_block().unwrap().get_context(); ctx.i32_type().const_int(u64::from(array_ty.len()), false) }; let ptr = builder.build_array_alloca(array_ty.get_element_type(), array_len, "")?; - let array_ptr = builder - .build_bit_cast(ptr, array_ty.ptr_type(AddressSpace::default()), "")? - .into_pointer_value(); - builder.build_store(array_ptr, array)?; - Result::Ok((ptr, array_ptr)) + builder.build_store(ptr, array)?; + Result::Ok(ptr) } /// Helper function to load an array from a pointer. @@ -182,16 +121,10 @@ pub fn build_int_array_load<'c>( elem_type: IntType<'c>, length: u32, ) -> Result, BuilderError> { - let ptr = builder - .build_bit_cast( - array_ptr, - elem_type - .array_type(length) - .ptr_type(AddressSpace::default()), - "", - )? - .into_pointer_value(); - let array = builder.build_load(ptr, "")?.into_array_value(); + let array_ty = elem_type.array_type(length); + let array = builder + .build_load(array_ty, array_ptr, "")? + .into_array_value(); Result::Ok(array) } @@ -207,6 +140,17 @@ pub enum ElemType { Bool, } +impl ElemType { + /// Get the corresponding `inkwell::types::BasicTypeEnum` + pub fn llvm_type<'a>(&self, ctx: &'a Context) -> BasicTypeEnum<'a> { + match *self { + ElemType::Int | ElemType::Uint => ctx.i64_type().into(), + ElemType::Float => ctx.f64_type().into(), + ElemType::Bool => ctx.bool_type().into(), + } + } +} + /// Helper function to create a dense array struct type. /// /// The struct contains four fields: @@ -219,29 +163,19 @@ pub enum ElemType { /// The fourth field points to an array of masking data of the same size as the /// primary data in memory and contains boolean values to indicate the presence /// of data in the primary array. Dense arrays have mask values of all zeros. -pub fn struct_1d_arr_t<'a>(ctx: &'a Context, data_type: &'a ElemType) -> StructType<'a> { - let data_ptr_t = match data_type { - ElemType::Int | ElemType::Uint => ctx.i64_type().ptr_type(AddressSpace::default()), - ElemType::Float => ctx.f64_type().ptr_type(AddressSpace::default()), - ElemType::Bool => ctx.bool_type().ptr_type(AddressSpace::default()), - }; +pub fn struct_1d_arr_t<'a>(ctx: &'a Context) -> StructType<'a> { + let ptr_t = ctx.ptr_type(AddressSpace::default()); ctx.struct_type( &[ ctx.i32_type().into(), // x ctx.i32_type().into(), // y - data_ptr_t.into(), /* pointer to first array - * elem */ - ctx.bool_type().ptr_type(AddressSpace::default()).into(), // pointer to first mask elem + ptr_t.into(), // pointer to first element + ptr_t.into(), // pointer to first mask element ], true, ) } -/// Helper function to create a `PointerType` to a dense array. -pub fn struct_1d_arr_ptr_t<'a>(ctx: &'a Context, data_type: &'a ElemType) -> PointerType<'a> { - struct_1d_arr_t(ctx, data_type).ptr_type(AddressSpace::default()) -} - /// Helper function to allocate and initialize a dense array struct on the stack. /// /// Returns a `PointerVal` to the struct and the `StructVal` itself. All of @@ -250,28 +184,19 @@ pub fn struct_1d_arr_alloc<'a>( ctx: &'a Context, builder: &Builder<'a>, length: u32, - data_type: &'a ElemType, array_ptr: PointerValue<'a>, ) -> Result<(PointerValue<'a>, StructValue<'a>), BuilderError> { - let out_arr_type = struct_1d_arr_t(ctx, data_type); + let out_arr_type = struct_1d_arr_t(ctx); let out_arr_ptr = builder.build_alloca(out_arr_type, "out_arr_alloca")?; - let x_field = builder.build_struct_gep(out_arr_ptr, 0, "x_ptr")?; - let y_field = builder.build_struct_gep(out_arr_ptr, 1, "y_ptr")?; - let arr_field = builder.build_struct_gep(out_arr_ptr, 2, "arr_ptr")?; - let mask_field = builder.build_struct_gep(out_arr_ptr, 3, "mask_ptr")?; + let x_field = builder.build_struct_gep(out_arr_type, out_arr_ptr, 0, "x_ptr")?; + let y_field = builder.build_struct_gep(out_arr_type, out_arr_ptr, 1, "y_ptr")?; + let arr_field = builder.build_struct_gep(out_arr_type, out_arr_ptr, 2, "arr_ptr")?; + let mask_field = builder.build_struct_gep(out_arr_type, out_arr_ptr, 3, "mask_ptr")?; let x_val = ctx.i32_type().const_int(length.into(), false); let y_val = ctx.i32_type().const_int(1, false); - let bit_cast_type = match data_type { - ElemType::Bool => ctx.bool_type().ptr_type(AddressSpace::default()), - ElemType::Int | ElemType::Uint => ctx.i64_type().ptr_type(AddressSpace::default()), - ElemType::Float => ctx.f64_type().ptr_type(AddressSpace::default()), - }; - let casted_arr_ptr = builder - .build_bit_cast(array_ptr, bit_cast_type, "")? - .into_pointer_value(); - let (mask_ptr, _) = build_array_alloca( + let mask_ptr = build_array_alloca( builder, ctx.bool_type().const_array( vec![ctx.bool_type().const_int(0, false); length.try_into().unwrap()].as_slice(), @@ -280,10 +205,12 @@ pub fn struct_1d_arr_alloc<'a>( builder.build_store(x_field, x_val)?; builder.build_store(y_field, y_val)?; - builder.build_store(arr_field, casted_arr_ptr)?; + builder.build_store(arr_field, array_ptr)?; builder.build_store(mask_field, mask_ptr)?; - let out_arr = builder.build_load(out_arr_ptr, "")?.into_struct_value(); + let out_arr = builder + .build_load(out_arr_type, out_arr_ptr, "")? + .into_struct_value(); Result::Ok((out_arr_ptr, out_arr)) } @@ -303,11 +230,9 @@ mod tests { make_bb(&context, &module, &builder); - let (ptr, array_ptr) = - build_array(&context, &builder).expect("Array allocation should succeed"); + let ptr = build_array(&context, &builder).expect("Array allocation should succeed"); - assert!(!ptr.is_null(), "Element pointer should not be null"); - assert!(!array_ptr.is_null(), "Array pointer should not be null"); + assert!(!ptr.is_null(), "Pointer should not be null"); builder .build_return(None) @@ -332,7 +257,7 @@ mod tests { fn build_array<'c>( context: &'c Context, builder: &Builder<'c>, - ) -> Result<(PointerValue<'c>, PointerValue<'c>), BuilderError> { + ) -> Result, BuilderError> { // Create test array let i32_type = context.i32_type(); let array = @@ -350,8 +275,7 @@ mod tests { make_bb(&context, &module, &builder); - let (array_ptr, _) = - build_array(&context, &builder).expect("Array allocation should succeed"); + let array_ptr = build_array(&context, &builder).expect("Array allocation should succeed"); let i32_type = context.i32_type(); let array_length = 2; let loaded_array = build_int_array_load(&builder, array_ptr, i32_type, array_length) @@ -369,46 +293,14 @@ mod tests { #[test] fn test_struct_1d_arr_t() { let context = Context::create(); - - // Test for each element type - let int_struct = struct_1d_arr_t(&context, &ElemType::Int); - let uint_struct = struct_1d_arr_t(&context, &ElemType::Uint); - let float_struct = struct_1d_arr_t(&context, &ElemType::Float); - let bool_struct = struct_1d_arr_t(&context, &ElemType::Bool); - - let structs = [int_struct, uint_struct, float_struct, bool_struct]; - - for s in &structs { - // All structs should have 4 fields - assert_eq!(s.get_field_types().len(), 4); - - // Check the field types (first two fields should be i32 for all structs) - assert!(s.get_field_types()[0].is_int_type()); - assert!(s.get_field_types()[1].is_int_type()); - - // Third field should be a pointer to the corresponding data type - assert!(s.get_field_types()[2].is_pointer_type()); - - // Fourth field should be a pointer to bool type for all structs - assert!(s.get_field_types()[3].is_pointer_type()); - } - } - - /// Test that struct_1d_arr_ptr_t returns the correct pointer type. - #[test] - fn test_struct_1d_arr_ptr_t() { - let context = Context::create(); - - // Test for each element type - let int_ptr = struct_1d_arr_ptr_t(&context, &ElemType::Int); - let uint_ptr = struct_1d_arr_ptr_t(&context, &ElemType::Uint); - let float_ptr = struct_1d_arr_ptr_t(&context, &ElemType::Float); - let bool_ptr = struct_1d_arr_ptr_t(&context, &ElemType::Bool); - - // Test that all element types return struct pointer types - for ptr in [int_ptr, uint_ptr, float_ptr, bool_ptr] { - assert!(ptr.get_element_type().is_struct_type()); - } + let struct_ty = struct_1d_arr_t(&context); + + // Fields should be (int, int, ptr, ptr) + assert_eq!(struct_ty.get_field_types().len(), 4); + assert!(struct_ty.get_field_types()[0].is_int_type()); + assert!(struct_ty.get_field_types()[1].is_int_type()); + assert!(struct_ty.get_field_types()[2].is_pointer_type()); + assert!(struct_ty.get_field_types()[3].is_pointer_type()); } /// Test that struct_1d_arr_alloc properly allocates and initializes a dense array struct. @@ -420,16 +312,9 @@ mod tests { make_bb(&context, &module, &builder); - let (array_ptr, _) = build_array(&context, &builder).unwrap(); - // Test the function with different element types - let elem_types = [ElemType::Int, ElemType::Float, ElemType::Bool]; - - for elem_type in elem_types.iter() { - let (struct_ptr, _) = - struct_1d_arr_alloc(&context, &builder, 2, elem_type, array_ptr).unwrap(); - - assert!(!struct_ptr.is_null(), "Struct pointer should not be null"); - } + let array_ptr = build_array(&context, &builder).unwrap(); + let (struct_ptr, _) = struct_1d_arr_alloc(&context, &builder, 2, array_ptr).unwrap(); + assert!(!struct_ptr.is_null(), "Struct pointer should not be null"); builder .build_return(None) @@ -442,7 +327,6 @@ mod tests { /// Tests that [ArrayLowering::array_to_ptr] and [ArrayLowering::array_from_ptr] are inverses. #[rstest] #[case(DEFAULT_HEAP_ARRAY_LOWERING)] - #[case(DEFAULT_STACK_ARRAY_LOWERING)] fn test_array_ptr_conversion(#[case] array_lowering: impl ArrayLowering) { let mut llvm_ctx = llvm_ctx(-1); llvm_ctx.add_extensions(|cge| cge.add_default_prelude_extensions()); @@ -457,12 +341,12 @@ mod tests { let elem_ty = emit_ctx.iw_context().i32_type().into(); let size = 2; - let (array_ptr, _) = build_array(emit_ctx.iw_context(), emit_ctx.builder()).unwrap(); + let array_ptr = build_array(emit_ctx.iw_context(), emit_ctx.builder()).unwrap(); let array = array_lowering .array_from_ptr(&mut emit_ctx, array_ptr, elem_ty, size) .unwrap(); let new_array_ptr = array_lowering - .array_to_ptr(emit_ctx.builder(), array) + .array_to_ptr(emit_ctx.builder(), array, elem_ty, size) .unwrap(); assert_eq!(array_ptr.get_type(), new_array_ptr.get_type()); let new_array = array_lowering diff --git a/tket-qsystem/src/llvm/debug.rs b/tket-qsystem/src/llvm/debug.rs index 89d49b205..ac4823ec3 100644 --- a/tket-qsystem/src/llvm/debug.rs +++ b/tket-qsystem/src/llvm/debug.rs @@ -7,11 +7,12 @@ use hugr::llvm::CodegenExtsBuilder; use hugr::llvm::custom::CodegenExtension; use hugr::llvm::emit::{EmitFuncContext, EmitOpArgs}; use hugr::llvm::inkwell::AddressSpace; +use hugr::llvm::inkwell::types::BasicType; use hugr::ops::ExtensionOp; use hugr::{HugrView, Node}; use tket::extension::debug::{DEBUG_EXTENSION_ID, STATE_RESULT_OP_ID, StateResult}; -use super::array_utils::{ArrayLowering, ElemType, struct_1d_arr_alloc, struct_1d_arr_ptr_t}; +use super::array_utils::{ArrayLowering, struct_1d_arr_alloc}; static TAG_PREFIX: &str = "USER:"; @@ -54,8 +55,9 @@ impl DebugCodegenExtension { // Types (qubits are just i64s). let iw_ctx = ctx.iw_context(); let void_t = iw_ctx.void_type(); - let i8_ptr_t = iw_ctx.i8_type().ptr_type(AddressSpace::default()); + let i8_t = iw_ctx.i8_type(); let i64_t = iw_ctx.i64_type(); + let ptr_t = iw_ctx.ptr_type(AddressSpace::default()); // Tag arguments. let state_result = StateResult::from_extension_op(args.node().as_ref())?; @@ -64,14 +66,13 @@ impl DebugCodegenExtension { bail!("Empty state result tag received"); } let tag_ptr = emit_global_string(ctx, tag, "res_", format!("{TAG_PREFIX}STATE:"))?; + // The first byte of the string contains its length. Load that value + // and zext it into i64. let tag_len = { - let mut l = builder - .build_load(tag_ptr.into_pointer_value(), "tag_len")? + let l = builder + .build_load(i8_t, tag_ptr.into_pointer_value(), "tag_len")? .into_int_value(); - if l.get_type() != i64_t { - l = builder.build_int_z_extend(l, i64_t, "tag_len")?; - } - l + builder.build_int_z_extend(l, i64_t, "tag_len")? }; // Qubit array argument. @@ -80,26 +81,19 @@ impl DebugCodegenExtension { .inputs .try_into() .map_err(|_| anyhow!(format!("StateResult expects a qubit array argument")))?; - let qubits_array = self.array_lowering.array_to_ptr(builder, qubits)?; - let (qubits_ptr, _) = struct_1d_arr_alloc( - iw_ctx, + let qubits_array = self.array_lowering.array_to_ptr( builder, + qubits, + i64_t.as_basic_type_enum(), array_len.try_into()?, - &ElemType::Int, - qubits_array, )?; + let (qubits_ptr, _) = + struct_1d_arr_alloc(iw_ctx, builder, array_len.try_into()?, qubits_array)?; // Build the function call. let fn_state_result = ctx.get_extern_func( "print_state_result", - void_t.fn_type( - &[ - i8_ptr_t.into(), - i64_t.into(), - struct_1d_arr_ptr_t(iw_ctx, &ElemType::Int).into(), - ], - false, - ), + void_t.fn_type(&[ptr_t.into(), i64_t.into(), ptr_t.into()], false), )?; builder.build_call( @@ -122,7 +116,6 @@ mod test { use hugr::llvm::test::single_op_hugr; use crate::llvm::array_utils::DEFAULT_HEAP_ARRAY_LOWERING; - use crate::llvm::array_utils::DEFAULT_STACK_ARRAY_LOWERING; use crate::llvm::prelude::QISPreludeCodegen; use rstest::rstest; @@ -130,7 +123,6 @@ mod test { use super::*; #[rstest] - #[case::state_result(1, StateResult::new("test_state_result".to_string(), 2), &DEFAULT_STACK_ARRAY_LOWERING)] #[case::state_result(2, StateResult::new("test_state_result".to_string(), 2), &DEFAULT_HEAP_ARRAY_LOWERING)] fn emit_debug_codegen( #[case] _i: i32, diff --git a/tket-qsystem/src/llvm/prelude.rs b/tket-qsystem/src/llvm/prelude.rs index 953d87196..c0763741c 100644 --- a/tket-qsystem/src/llvm/prelude.rs +++ b/tket-qsystem/src/llvm/prelude.rs @@ -116,7 +116,7 @@ impl QISPreludeCodegen { let func_type = iwc.void_type().fn_type( &[ iwc.i32_type().into(), - iwc.i8_type().ptr_type(AddressSpace::default()).into(), + iwc.ptr_type(AddressSpace::default()).into(), ], false, ); @@ -196,14 +196,7 @@ pub fn emit_global_string<'c, H: HugrView>( }) .unwrap() }; - Ok(ctx - .builder() - .build_pointer_cast( - global.as_pointer_value(), - ctx.iw_context().i8_type().ptr_type(AddressSpace::default()), - "", - )? - .as_basic_value_enum()) + Ok(global.as_pointer_value().as_basic_value_enum()) } #[cfg(test)] diff --git a/tket-qsystem/src/llvm/qsystem.rs b/tket-qsystem/src/llvm/qsystem.rs index 8dc4e83f5..1d526affa 100644 --- a/tket-qsystem/src/llvm/qsystem.rs +++ b/tket-qsystem/src/llvm/qsystem.rs @@ -369,7 +369,7 @@ mod test { #[with(_i)] mut llvm_ctx: TestContext, #[case] op: QSystemOp, ) { - use hugr::algorithms::ComposablePass; + use hugr_passes::ComposablePass; use crate::llvm::{futures::FuturesCodegenExtension, prelude::QISPreludeCodegen}; diff --git a/tket-qsystem/src/llvm/result.rs b/tket-qsystem/src/llvm/result.rs index 249c877e5..3d85323ee 100644 --- a/tket-qsystem/src/llvm/result.rs +++ b/tket-qsystem/src/llvm/result.rs @@ -12,13 +12,13 @@ use hugr::llvm::types::HugrSumType; use inkwell::AddressSpace; use inkwell::builder::Builder; use inkwell::context::Context; -use inkwell::types::{FloatType, IntType, PointerType, VoidType}; +use inkwell::types::{BasicMetadataTypeEnum, FloatType, IntType, PointerType, VoidType}; use inkwell::values::{BasicValueEnum, FunctionValue, IntValue}; use tket::hugr::extension::simple_op::MakeExtensionOp; use tket::hugr::ops::ExtensionOp; use tket::hugr::{HugrView, Node}; -use super::array_utils::{ArrayLowering, ElemType, struct_1d_arr_alloc, struct_1d_arr_ptr_t}; +use super::array_utils::{ArrayLowering, ElemType, struct_1d_arr_alloc}; static TAG_PREFIX: &str = "USER:"; @@ -60,10 +60,14 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, self.0.typing_session().iw_context() } - fn int_t(&self) -> IntType<'c> { + fn i64_t(&self) -> IntType<'c> { self.iw_context().i64_type() } + fn i8_t(&self) -> IntType<'c> { + self.iw_context().i8_type() + } + fn float_t(&self) -> FloatType<'c> { self.iw_context().f64_type() } @@ -72,10 +76,8 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, self.iw_context().bool_type() } - fn i8_ptr_t(&self) -> PointerType<'c> { - self.iw_context() - .i8_type() - .ptr_type(AddressSpace::default()) + fn ptr_t(&self) -> PointerType<'c> { + self.iw_context().ptr_type(AddressSpace::default()) } fn void_t(&self) -> VoidType<'c> { @@ -88,18 +90,18 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, fn get_func_print(&self, op: &ResultOp) -> Result> { // The first two parameters are the same for all print function variants - let mut params = vec![self.i8_ptr_t().into(), self.int_t().into()]; + let mut params: Vec = vec![self.ptr_t().into(), self.i64_t().into()]; let symbol = match op.result_op { ResultOpDef::Bool => { params.push(self.bool_t().into()); "print_bool" } ResultOpDef::Int => { - params.push(self.int_t().into()); + params.push(self.i64_t().into()); "print_int" } ResultOpDef::UInt => { - params.push(self.int_t().into()); + params.push(self.i64_t().into()); "print_uint" } ResultOpDef::F64 => { @@ -107,19 +109,19 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, "print_float" } ResultOpDef::ArrBool => { - params.push(struct_1d_arr_ptr_t(self.iw_context(), &ElemType::Bool).into()); + params.push(self.ptr_t().into()); "print_bool_arr" } ResultOpDef::ArrInt => { - params.push(struct_1d_arr_ptr_t(self.iw_context(), &ElemType::Int).into()); + params.push(self.ptr_t().into()); "print_int_arr" } ResultOpDef::ArrUInt => { - params.push(struct_1d_arr_ptr_t(self.iw_context(), &ElemType::Uint).into()); + params.push(self.ptr_t().into()); "print_uint_arr" } ResultOpDef::ArrF64 => { - params.push(struct_1d_arr_ptr_t(self.iw_context(), &ElemType::Float).into()); + params.push(self.ptr_t().into()); "print_float_arr" } }; @@ -143,17 +145,13 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, let tag_ptr = emit_global_string(self.0, tag, "res_", format!("{TAG_PREFIX}{type_tag}"))?; let tag_len = { - let mut l = self + let l = self .0 .builder() - .build_load(tag_ptr.into_pointer_value(), "tag_len")? + .build_load(self.i8_t(), tag_ptr.into_pointer_value(), "tag_len")? .into_int_value(); - if self.int_t() != l.get_type() { - l = self - .builder() - .build_int_z_extend(l, self.int_t(), "tag_len")?; - } - l + self.builder() + .build_int_z_extend(l, self.i64_t(), "tag_len")? }; Ok((tag_ptr, tag_len)) @@ -173,14 +171,14 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, }; let print_fn = self.get_func_print(op)?; - let array = self.1.array_to_ptr(self.builder(), val)?; - let (array_ptr, _) = struct_1d_arr_alloc( - self.iw_context(), + let array = self.1.array_to_ptr( self.builder(), + val, + data_type.llvm_type(self.iw_context()), length.try_into()?, - data_type, - array, )?; + let (array_ptr, _) = + struct_1d_arr_alloc(self.iw_context(), self.builder(), length.try_into()?, array)?; self.builder().build_call( print_fn, &[tag_ptr.into(), tag_len.into(), array_ptr.into()], @@ -288,7 +286,6 @@ impl<'c, H: HugrView, AL: ArrayLowering + Clone> ResultEmitter<'c, mod test { use crate::extension::result::ResultOp; use crate::llvm::array_utils::DEFAULT_HEAP_ARRAY_LOWERING; - use crate::llvm::array_utils::DEFAULT_STACK_ARRAY_LOWERING; use hugr::extension::simple_op::MakeRegisteredOp; use hugr::llvm::check_emission; @@ -303,26 +300,23 @@ mod test { use super::*; #[rstest] - #[case::bool(1, ResultOp::new_bool("test_bool"), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::int(2, ResultOp::new_int("test_int", 6), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::uint(3, ResultOp::new_uint("test_uint", 6), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::f64(4, ResultOp::new_f64("test_f64"), &DEFAULT_STACK_ARRAY_LOWERING)] + #[case::bool(1, ResultOp::new_bool("test_bool"), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::int(2, ResultOp::new_int("test_int", 6), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::uint(3, ResultOp::new_uint("test_uint", 6), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::f64(4, ResultOp::new_f64("test_f64"), &DEFAULT_HEAP_ARRAY_LOWERING)] #[case::arr_bool(5, ResultOp::new_bool("test_arr_bool").array_op(10), &DEFAULT_HEAP_ARRAY_LOWERING)] - #[case::arr_bool(6, ResultOp::new_bool("test_arr_bool").array_op(10), &DEFAULT_STACK_ARRAY_LOWERING)] #[case::arr_int(7, ResultOp::new_int("test_arr_int", 6).array_op(10), &DEFAULT_HEAP_ARRAY_LOWERING)] - #[case::arr_int(8, ResultOp::new_int("test_arr_int", 6).array_op(10), &DEFAULT_STACK_ARRAY_LOWERING)] #[case::arr_uint(9, ResultOp::new_uint("test_arr_uint", 6).array_op(10), &DEFAULT_HEAP_ARRAY_LOWERING)] - #[case::arr_int(10, ResultOp::new_int("test_arr_int", 6).array_op(10), &DEFAULT_STACK_ARRAY_LOWERING)] #[case::arr_f64(11, ResultOp::new_f64("test_arr_f64").array_op(10), &DEFAULT_HEAP_ARRAY_LOWERING)] // test cases for various tags - #[case::unicode_tag(12, ResultOp::new_int("测试字符串", 6), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::special_chars(13, ResultOp::new_uint("test!@#$%^&*()", 6), &DEFAULT_STACK_ARRAY_LOWERING)] + #[case::unicode_tag(12, ResultOp::new_int("测试字符串", 6), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::special_chars(13, ResultOp::new_uint("test!@#$%^&*()", 6), &DEFAULT_HEAP_ARRAY_LOWERING)] #[should_panic(expected = "Constant string too long")] - #[case::very_long_tag(14, ResultOp::new_f64("x".repeat(256)), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::whitespace(15, ResultOp::new_bool(" spaces tabs\t\t\tnewlines\n\n\n"), &DEFAULT_STACK_ARRAY_LOWERING)] - #[case::emoji(16, ResultOp::new_bool("🚀👨‍👩‍👧‍👦🌍"), &DEFAULT_STACK_ARRAY_LOWERING)] + #[case::very_long_tag(14, ResultOp::new_f64("x".repeat(256)), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::whitespace(15, ResultOp::new_bool(" spaces tabs\t\t\tnewlines\n\n\n"), &DEFAULT_HEAP_ARRAY_LOWERING)] + #[case::emoji(16, ResultOp::new_bool("🚀👨‍👩‍👧‍👦🌍"), &DEFAULT_HEAP_ARRAY_LOWERING)] #[should_panic(expected = "Empty result tag received")] - #[case::actually_empty(17, ResultOp::new_bool(""), &DEFAULT_STACK_ARRAY_LOWERING)] + #[case::actually_empty(17, ResultOp::new_bool(""), &DEFAULT_HEAP_ARRAY_LOWERING)] fn emit_result_codegen( #[case] _i: i32, #[with(_i)] mut llvm_ctx: TestContext, diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_1.snap deleted file mode 100644 index 0298f02be..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_1.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/debug.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" - -define private [2 x i64] @_hl.main.1([2 x i64] %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 2, align 8 - %2 = bitcast i64* %1 to [2 x i64]* - store [2 x i64] %0, [2 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 2, align 1 - %4 = bitcast i1* %3 to [2 x i1]* - store [2 x i1] zeroinitializer, [2 x i1]* %4, align 1 - store i32 2, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_state_result(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret [2 x i64] %0 -} - -declare void @print_state_result(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_2.snap deleted file mode 100644 index 29a830699..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm14_2.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/debug.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" - -define private { i64*, i64 } @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %0, 0 - %array_offset = extractvalue { i64*, i64 } %0, 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 2, align 1 - %3 = bitcast i1* %2 to [2 x i1]* - store [2 x i1] zeroinitializer, [2 x i1]* %3, align 1 - store i32 2, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_state_result(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret { i64*, i64 } %0 -} - -declare void @print_state_result(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_1.snap new file mode 100644 index 000000000..6cef542c4 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_1.snap @@ -0,0 +1,35 @@ +--- +source: tket-qsystem/src/llvm/debug.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" + +define private [2 x i64] @_hl.main.1([2 x i64] %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 2, align 8 + store [2 x i64] %0, ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 2, align 1 + store [2 x i1] zeroinitializer, ptr %2, align 1 + store i32 2, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca) + ret [2 x i64] %0 +} + +declare void @print_state_result(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_2.snap new file mode 100644 index 000000000..94ba83daa --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@llvm21_2.snap @@ -0,0 +1,36 @@ +--- +source: tket-qsystem/src/llvm/debug.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" + +define internal { ptr, i64 } @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %0, 0 + %array_offset = extractvalue { ptr, i64 } %0, 1 + %1 = getelementptr inbounds [2 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 2, align 1 + store [2 x i1] zeroinitializer, ptr %2, align 1 + store i32 2, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca) + ret { ptr, i64 } %0 +} + +declare void @print_state_result(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_1.snap deleted file mode 100644 index cade8dba6..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_1.snap +++ /dev/null @@ -1,46 +0,0 @@ ---- -source: tket-qsystem/src/llvm/debug.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" - -define private [2 x i64] @_hl.main.1([2 x i64] %0) { -alloca_block: - %"0" = alloca [2 x i64], align 8 - %"2_0" = alloca [2 x i64], align 8 - %"4_0" = alloca [2 x i64], align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store [2 x i64] %0, [2 x i64]* %"2_0", align 4 - %"2_01" = load [2 x i64], [2 x i64]* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 2, align 8 - %2 = bitcast i64* %1 to [2 x i64]* - store [2 x i64] %"2_01", [2 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 2, align 1 - %4 = bitcast i1* %3 to [2 x i1]* - store [2 x i1] zeroinitializer, [2 x i1]* %4, align 1 - store i32 2, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_state_result(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - store [2 x i64] %"2_01", [2 x i64]* %"4_0", align 4 - %"4_03" = load [2 x i64], [2 x i64]* %"4_0", align 4 - store [2 x i64] %"4_03", [2 x i64]* %"0", align 4 - %"04" = load [2 x i64], [2 x i64]* %"0", align 4 - ret [2 x i64] %"04" -} - -declare void @print_state_result(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_2.snap deleted file mode 100644 index a29e3306c..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm14_2.snap +++ /dev/null @@ -1,46 +0,0 @@ ---- -source: tket-qsystem/src/llvm/debug.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" - -define private { i64*, i64 } @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - %"0" = alloca { i64*, i64 }, align 8 - %"2_0" = alloca { i64*, i64 }, align 8 - %"4_0" = alloca { i64*, i64 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i64*, i64 } %0, { i64*, i64 }* %"2_0", align 8 - %"2_01" = load { i64*, i64 }, { i64*, i64 }* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %"2_01", 0 - %array_offset = extractvalue { i64*, i64 } %"2_01", 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 2, align 1 - %3 = bitcast i1* %2 to [2 x i1]* - store [2 x i1] zeroinitializer, [2 x i1]* %3, align 1 - store i32 2, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_state_result(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @res_test_state.900F7606.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - store { i64*, i64 } %"2_01", { i64*, i64 }* %"4_0", align 8 - %"4_03" = load { i64*, i64 }, { i64*, i64 }* %"4_0", align 8 - store { i64*, i64 } %"4_03", { i64*, i64 }* %"0", align 8 - %"04" = load { i64*, i64 }, { i64*, i64 }* %"0", align 8 - ret { i64*, i64 } %"04" -} - -declare void @print_state_result(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_1.snap new file mode 100644 index 000000000..eae96bd39 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_1.snap @@ -0,0 +1,44 @@ +--- +source: tket-qsystem/src/llvm/debug.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" + +define private [2 x i64] @_hl.main.1([2 x i64] %0) { +alloca_block: + %"0" = alloca [2 x i64], align 8 + %"2_0" = alloca [2 x i64], align 8 + %"4_0" = alloca [2 x i64], align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store [2 x i64] %0, ptr %"2_0", align 4 + %"2_01" = load [2 x i64], ptr %"2_0", align 4 + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 2, align 8 + store [2 x i64] %"2_01", ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 2, align 1 + store [2 x i1] zeroinitializer, ptr %2, align 1 + store i32 2, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca) + store [2 x i64] %"2_01", ptr %"4_0", align 4 + %"4_03" = load [2 x i64], ptr %"4_0", align 4 + store [2 x i64] %"4_03", ptr %"0", align 4 + %"04" = load [2 x i64], ptr %"0", align 4 + ret [2 x i64] %"04" +} + +declare void @print_state_result(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_2.snap new file mode 100644 index 000000000..ad0c265b3 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__debug__test__emit_debug_codegen@pre-mem2reg@llvm21_2.snap @@ -0,0 +1,45 @@ +--- +source: tket-qsystem/src/llvm/debug.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_state.900F7606.0 = private constant [29 x i8] c"\1CUSER:STATE:test_state_result" + +define internal { ptr, i64 } @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + %"0" = alloca { ptr, i64 }, align 8 + %"2_0" = alloca { ptr, i64 }, align 8 + %"4_0" = alloca { ptr, i64 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { ptr, i64 } %0, ptr %"2_0", align 8 + %"2_01" = load { ptr, i64 }, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1 + %1 = getelementptr inbounds [2 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 2, align 1 + store [2 x i1] zeroinitializer, ptr %2, align 1 + store i32 2, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca) + store { ptr, i64 } %"2_01", ptr %"4_0", align 8 + %"4_03" = load { ptr, i64 }, ptr %"4_0", align 8 + store { ptr, i64 } %"4_03", ptr %"0", align 8 + %"04" = load { ptr, i64 }, ptr %"0", align 8 + ret { ptr, i64 } %"04" +} + +declare void @print_state_result(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap similarity index 92% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap index fa7ffb5f1..03ded3943 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap similarity index 79% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap index 52322ecfe..9437cd92a 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block call void @___inc_future_refcount(i64 %0) - %mrv = insertvalue { i64, i64 } undef, i64 %0, 0 + %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %0, 1 ret { i64, i64 } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap similarity index 88% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_6.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap index 20e883f75..1dc8154d9 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap similarity index 91% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap index 2bcc688d8..3dd7fa44c 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap similarity index 79% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap index 52322ecfe..9437cd92a 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block call void @___inc_future_refcount(i64 %0) - %mrv = insertvalue { i64, i64 } undef, i64 %0, 0 + %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %0, 1 ret { i64, i64 } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap similarity index 88% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap index 20e883f75..1dc8154d9 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_1.snap similarity index 68% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_1.snap index f811b7c27..36db9fe95 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i64, align 8 @@ -13,15 +13,15 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 %read_bool = call i1 @___read_future_bool(i64 %"2_01") call void @___dec_future_refcount(i64 %"2_01") %measure = select i1 %read_bool, i1 true, i1 false - store i1 %measure, i1* %"4_0", align 1 - %"4_02" = load i1, i1* %"4_0", align 1 - store i1 %"4_02", i1* %"0", align 1 - %"03" = load i1, i1* %"0", align 1 + store i1 %measure, ptr %"4_0", align 1 + %"4_02" = load i1, ptr %"4_0", align 1 + store i1 %"4_02", ptr %"0", align 1 + %"03" = load i1, ptr %"0", align 1 ret i1 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_2.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_2.snap index 54cfcbcd8..4e69ebda0 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_2.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -15,18 +15,18 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___inc_future_refcount(i64 %"2_01") - store i64 %"2_01", i64* %"4_0", align 4 - store i64 %"2_01", i64* %"4_1", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - %"4_13" = load i64, i64* %"4_1", align 4 - store i64 %"4_02", i64* %"0", align 4 - store i64 %"4_13", i64* %"1", align 4 - %"04" = load i64, i64* %"0", align 4 - %"15" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"04", 0 + store i64 %"2_01", ptr %"4_0", align 4 + store i64 %"2_01", ptr %"4_1", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + %"4_13" = load i64, ptr %"4_1", align 4 + store i64 %"4_02", ptr %"0", align 4 + store i64 %"4_13", ptr %"1", align 4 + %"04" = load i64, ptr %"0", align 4 + %"15" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"04", 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %"15", 1 ret { i64, i64 } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap similarity index 75% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_6.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap index d61ec467f..ffc5672d6 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap @@ -5,14 +5,14 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___dec_future_refcount(i64 %"2_01") ret void } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_4.snap similarity index 65% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_4.snap index d14303ab1..bf61f0507 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -13,14 +13,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 %read_uint = call i64 @___read_future_uint(i64 %"2_01") call void @___dec_future_refcount(i64 %"2_01") - store i64 %read_uint, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store i64 %read_uint, ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_5.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_5.snap index 54cfcbcd8..4e69ebda0 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -15,18 +15,18 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___inc_future_refcount(i64 %"2_01") - store i64 %"2_01", i64* %"4_0", align 4 - store i64 %"2_01", i64* %"4_1", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - %"4_13" = load i64, i64* %"4_1", align 4 - store i64 %"4_02", i64* %"0", align 4 - store i64 %"4_13", i64* %"1", align 4 - %"04" = load i64, i64* %"0", align 4 - %"15" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"04", 0 + store i64 %"2_01", ptr %"4_0", align 4 + store i64 %"2_01", ptr %"4_1", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + %"4_13" = load i64, ptr %"4_1", align 4 + store i64 %"4_02", ptr %"0", align 4 + store i64 %"4_13", ptr %"1", align 4 + %"04" = load i64, ptr %"0", align 4 + %"15" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"04", 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %"15", 1 ret { i64, i64 } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap similarity index 75% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap index d61ec467f..ffc5672d6 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap @@ -5,14 +5,14 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___dec_future_refcount(i64 %"2_01") ret void } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm14_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap similarity index 50% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm14_0.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap index cedb8cc11..5e06ce453 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm14_0.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap @@ -7,20 +7,20 @@ source_filename = "test_context" @e_EXIT.2B78BC40.0 = private constant [14 x i8] c"\0DEXIT:INT:EXIT" -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = extractvalue { i32, i8* } { i32 42, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @e_EXIT.2B78BC40.0, i32 0, i32 0) }, 0 - %3 = extractvalue { i32, i8* } { i32 42, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @e_EXIT.2B78BC40.0, i32 0, i32 0) }, 1 - call void @panic(i32 %2, i8* %3) - %mrv = insertvalue { i64, i64 } undef, i64 0, 0 + %2 = extractvalue { i32, ptr } { i32 42, ptr @e_EXIT.2B78BC40.0 }, 0 + %3 = extractvalue { i32, ptr } { i32 42, ptr @e_EXIT.2B78BC40.0 }, 1 + call void @panic(i32 %2, ptr %3) + %mrv = insertvalue { i64, i64 } poison, i64 0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 0, 1 ret { i64, i64 } %mrv8 } ; Function Attrs: noreturn -declare void @panic(i32, i8*) #0 +declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm14_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm14_0.snap deleted file mode 100644 index 852d29dd3..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm14_0.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: tket-qsystem/src/llvm/prelude.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@e_EXIT.2B78BC40.0 = private constant [14 x i8] c"\0DEXIT:INT:EXIT" - -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca i64, align 8 - %"5_0" = alloca { i32, i8* }, align 8 - %"2_0" = alloca i64, align 8 - %"2_1" = alloca i64, align 8 - %"6_0" = alloca i64, align 8 - %"6_1" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i32, i8* } { i32 42, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @e_EXIT.2B78BC40.0, i32 0, i32 0) }, { i32, i8* }* %"5_0", align 8 - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - %"5_01" = load { i32, i8* }, { i32, i8* }* %"5_0", align 8 - %"2_02" = load i64, i64* %"2_0", align 4 - %"2_13" = load i64, i64* %"2_1", align 4 - %2 = extractvalue { i32, i8* } %"5_01", 0 - %3 = extractvalue { i32, i8* } %"5_01", 1 - call void @panic(i32 %2, i8* %3) - store i64 0, i64* %"6_0", align 4 - store i64 0, i64* %"6_1", align 4 - %"6_04" = load i64, i64* %"6_0", align 4 - %"6_15" = load i64, i64* %"6_1", align 4 - store i64 %"6_04", i64* %"0", align 4 - store i64 %"6_15", i64* %"1", align 4 - %"06" = load i64, i64* %"0", align 4 - %"17" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"06", 0 - %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 - ret { i64, i64 } %mrv8 -} - -; Function Attrs: noreturn -declare void @panic(i32, i8*) #0 - -attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm21_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm21_0.snap new file mode 100644 index 000000000..331738b28 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@pre-mem2reg@llvm21_0.snap @@ -0,0 +1,47 @@ +--- +source: tket-qsystem/src/llvm/prelude.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@e_EXIT.2B78BC40.0 = private constant [14 x i8] c"\0DEXIT:INT:EXIT" + +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca i64, align 8 + %"5_0" = alloca { i32, ptr }, align 8 + %"2_0" = alloca i64, align 8 + %"2_1" = alloca i64, align 8 + %"6_0" = alloca i64, align 8 + %"6_1" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { i32, ptr } { i32 42, ptr @e_EXIT.2B78BC40.0 }, ptr %"5_0", align 8 + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + %"5_01" = load { i32, ptr }, ptr %"5_0", align 8 + %"2_02" = load i64, ptr %"2_0", align 4 + %"2_13" = load i64, ptr %"2_1", align 4 + %2 = extractvalue { i32, ptr } %"5_01", 0 + %3 = extractvalue { i32, ptr } %"5_01", 1 + call void @panic(i32 %2, ptr %3) + store i64 0, ptr %"6_0", align 4 + store i64 0, ptr %"6_1", align 4 + %"6_04" = load i64, ptr %"6_0", align 4 + %"6_15" = load i64, ptr %"6_1", align 4 + store i64 %"6_04", ptr %"0", align 4 + store i64 %"6_15", ptr %"1", align 4 + %"06" = load i64, ptr %"0", align 4 + %"17" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"06", 0 + %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 + ret { i64, i64 } %mrv8 +} + +; Function Attrs: noreturn +declare void @panic(i32, ptr) #0 + +attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm14_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm14_0.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap index 585301d77..4c5fd6ab0 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm14_0.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap @@ -7,21 +7,21 @@ source_filename = "test_context" @e_PANIC.DF25FD88.0 = private constant [15 x i8] c"\0EEXIT:INT:PANIC" -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = extractvalue { i32, i8* } { i32 42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @e_PANIC.DF25FD88.0, i32 0, i32 0) }, 0 + %2 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 0 %shift_code = add i32 %2, 1000 - %3 = extractvalue { i32, i8* } { i32 42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @e_PANIC.DF25FD88.0, i32 0, i32 0) }, 1 - call void @panic(i32 %shift_code, i8* %3) - %mrv = insertvalue { i64, i64 } undef, i64 0, 0 + %3 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 1 + call void @panic(i32 %shift_code, ptr %3) + %mrv = insertvalue { i64, i64 } poison, i64 0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 0, 1 ret { i64, i64 } %mrv8 } ; Function Attrs: noreturn -declare void @panic(i32, i8*) #0 +declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm14_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm14_0.snap deleted file mode 100644 index 69dc76664..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm14_0.snap +++ /dev/null @@ -1,48 +0,0 @@ ---- -source: tket-qsystem/src/llvm/prelude.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@e_PANIC.DF25FD88.0 = private constant [15 x i8] c"\0EEXIT:INT:PANIC" - -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca i64, align 8 - %"5_0" = alloca { i32, i8* }, align 8 - %"2_0" = alloca i64, align 8 - %"2_1" = alloca i64, align 8 - %"6_0" = alloca i64, align 8 - %"6_1" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i32, i8* } { i32 42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @e_PANIC.DF25FD88.0, i32 0, i32 0) }, { i32, i8* }* %"5_0", align 8 - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - %"5_01" = load { i32, i8* }, { i32, i8* }* %"5_0", align 8 - %"2_02" = load i64, i64* %"2_0", align 4 - %"2_13" = load i64, i64* %"2_1", align 4 - %2 = extractvalue { i32, i8* } %"5_01", 0 - %shift_code = add i32 %2, 1000 - %3 = extractvalue { i32, i8* } %"5_01", 1 - call void @panic(i32 %shift_code, i8* %3) - store i64 0, i64* %"6_0", align 4 - store i64 0, i64* %"6_1", align 4 - %"6_04" = load i64, i64* %"6_0", align 4 - %"6_15" = load i64, i64* %"6_1", align 4 - store i64 %"6_04", i64* %"0", align 4 - store i64 %"6_15", i64* %"1", align 4 - %"06" = load i64, i64* %"0", align 4 - %"17" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"06", 0 - %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 - ret { i64, i64 } %mrv8 -} - -; Function Attrs: noreturn -declare void @panic(i32, i8*) #0 - -attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm21_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm21_0.snap new file mode 100644 index 000000000..698d37033 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@pre-mem2reg@llvm21_0.snap @@ -0,0 +1,48 @@ +--- +source: tket-qsystem/src/llvm/prelude.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@e_PANIC.DF25FD88.0 = private constant [15 x i8] c"\0EEXIT:INT:PANIC" + +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca i64, align 8 + %"5_0" = alloca { i32, ptr }, align 8 + %"2_0" = alloca i64, align 8 + %"2_1" = alloca i64, align 8 + %"6_0" = alloca i64, align 8 + %"6_1" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, ptr %"5_0", align 8 + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + %"5_01" = load { i32, ptr }, ptr %"5_0", align 8 + %"2_02" = load i64, ptr %"2_0", align 4 + %"2_13" = load i64, ptr %"2_1", align 4 + %2 = extractvalue { i32, ptr } %"5_01", 0 + %shift_code = add i32 %2, 1000 + %3 = extractvalue { i32, ptr } %"5_01", 1 + call void @panic(i32 %shift_code, ptr %3) + store i64 0, ptr %"6_0", align 4 + store i64 0, ptr %"6_1", align 4 + %"6_04" = load i64, ptr %"6_0", align 4 + %"6_15" = load i64, ptr %"6_1", align 4 + store i64 %"6_04", ptr %"0", align 4 + store i64 %"6_15", ptr %"1", align 4 + %"06" = load i64, ptr %"0", align 4 + %"17" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"06", 0 + %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 + ret { i64, i64 } %mrv8 +} + +; Function Attrs: noreturn +declare void @panic(i32, ptr) #0 + +attributes #0 = { noreturn } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap similarity index 86% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap index e6a334eb2..e9ff3cb50 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0, double %1) { +define internal i64 @_hl.main.1(i64 %0, double %1) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap similarity index 91% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_10.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap index 6695a2c82..d134bfc1c 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_10.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap similarity index 77% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap index ca593d05a..a685d8d2e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block call void @___rzz(i64 %0, i64 %1, double %2) - %mrv = insertvalue { i64, i64 } undef, i64 %0, 0 + %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 %1, 1 ret { i64, i64 } %mrv8 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap similarity index 84% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap index 81e72eff7..a35d56a21 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0, double %1, double %2) { +define internal i64 @_hl.main.1(i64 %0, double %1, double %2) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap similarity index 90% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap index 198413f5a..56e998b93 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i1, i64, i1 } @_hl.main.1(i64 %0) { +define internal { i1, i64, i1 } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap similarity index 90% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap index 56a0d7d7c..6790e71b0 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap similarity index 94% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_6.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap index 0d5764d73..d3e065184 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i1, i64 } @_hl.main.1() { +define internal { i1, i64 } @_hl.main.1() { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap similarity index 88% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_7.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap index 8811e9a8c..46476c4c3 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_7.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap similarity index 88% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_8.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap index c58047475..3b781f3b2 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_8.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap similarity index 82% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_9.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap index ccddf87dc..342767d90 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm14_9.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { +define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { alloca_block: br label %entry_block @@ -13,7 +13,7 @@ entry_block: ; preds = %alloca_block %lazy_measure = call i64 @___lazy_measure(i64 %0) call void @___reset(i64 %0) %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure, 1 - %mrv = insertvalue { i64, { i1, i64, i1 } } undef, i64 %0, 0 + %mrv = insertvalue { i64, { i1, i64, i1 } } poison, i64 %0, 0 %mrv10 = insertvalue { i64, { i1, i64, i1 } } %mrv, { i1, i64, i1 } %1, 1 ret { i64, { i1, i64, i1 } } %mrv10 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_2.snap deleted file mode 100644 index 553eed50c..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_2.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/qsystem.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -define private { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca i64, align 8 - %"2_0" = alloca i64, align 8 - %"2_1" = alloca i64, align 8 - %"2_2" = alloca double, align 8 - %"4_0" = alloca i64, align 8 - %"4_1" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store i64 %1, i64* %"2_1", align 4 - store double %2, double* %"2_2", align 8 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load i64, i64* %"2_1", align 4 - %"2_23" = load double, double* %"2_2", align 8 - call void @___rzz(i64 %"2_01", i64 %"2_12", double %"2_23") - store i64 %"2_01", i64* %"4_0", align 4 - store i64 %"2_12", i64* %"4_1", align 4 - %"4_04" = load i64, i64* %"4_0", align 4 - %"4_15" = load i64, i64* %"4_1", align 4 - store i64 %"4_04", i64* %"0", align 4 - store i64 %"4_15", i64* %"1", align 4 - %"06" = load i64, i64* %"0", align 4 - %"17" = load i64, i64* %"1", align 4 - %mrv = insertvalue { i64, i64 } undef, i64 %"06", 0 - %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 - ret { i64, i64 } %mrv8 -} - -declare void @___rzz(i64, i64, double) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_9.snap deleted file mode 100644 index ed21c02e0..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_9.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: tket-qsystem/src/llvm/qsystem.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -define private { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { -alloca_block: - %"0" = alloca i64, align 8 - %"1" = alloca { i1, i64, i1 }, align 8 - %"2_0" = alloca i64, align 8 - %"4_0" = alloca i64, align 8 - %"4_1" = alloca { i1, i64, i1 }, align 8 - %"6_0" = alloca i64, align 8 - %"8_0" = alloca i64, align 8 - %"8_1" = alloca i64, align 8 - %"9_0" = alloca { i1, i64, i1 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - store i64 %"2_01", i64* %"6_0", align 4 - %"6_02" = load i64, i64* %"6_0", align 4 - %lazy_measure = call i64 @___lazy_measure(i64 %"6_02") - call void @___reset(i64 %"6_02") - store i64 %"6_02", i64* %"8_0", align 4 - store i64 %lazy_measure, i64* %"8_1", align 4 - %"8_13" = load i64, i64* %"8_1", align 4 - %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %"8_13", 1 - store { i1, i64, i1 } %1, { i1, i64, i1 }* %"9_0", align 4 - %"8_04" = load i64, i64* %"8_0", align 4 - %"9_05" = load { i1, i64, i1 }, { i1, i64, i1 }* %"9_0", align 4 - store i64 %"8_04", i64* %"4_0", align 4 - store { i1, i64, i1 } %"9_05", { i1, i64, i1 }* %"4_1", align 4 - %"4_06" = load i64, i64* %"4_0", align 4 - %"4_17" = load { i1, i64, i1 }, { i1, i64, i1 }* %"4_1", align 4 - store i64 %"4_06", i64* %"0", align 4 - store { i1, i64, i1 } %"4_17", { i1, i64, i1 }* %"1", align 4 - %"08" = load i64, i64* %"0", align 4 - %"19" = load { i1, i64, i1 }, { i1, i64, i1 }* %"1", align 4 - %mrv = insertvalue { i64, { i1, i64, i1 } } undef, i64 %"08", 0 - %mrv10 = insertvalue { i64, { i1, i64, i1 } } %mrv, { i1, i64, i1 } %"19", 1 - ret { i64, { i1, i64, i1 } } %mrv10 -} - -declare i64 @___lazy_measure(i64) - -declare void @___reset(i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_1.snap similarity index 54% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_1.snap index fb8bd9e09..463842459 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0, double %1) { +define internal i64 @_hl.main.1(i64 %0, double %1) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -14,15 +14,15 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store double %1, double* %"2_1", align 8 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load double, double* %"2_1", align 8 + store i64 %0, ptr %"2_0", align 4 + store double %1, ptr %"2_1", align 8 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load double, ptr %"2_1", align 8 call void @___rz(i64 %"2_01", double %"2_12") - store i64 %"2_01", i64* %"4_0", align 4 - %"4_03" = load i64, i64* %"4_0", align 4 - store i64 %"4_03", i64* %"0", align 4 - %"04" = load i64, i64* %"0", align 4 + store i64 %"2_01", ptr %"4_0", align 4 + %"4_03" = load i64, ptr %"4_0", align 4 + store i64 %"4_03", ptr %"0", align 4 + %"04" = load i64, ptr %"0", align 4 ret i64 %"04" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_10.snap similarity index 64% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_10.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_10.snap index fe551a2b1..1cdeb521d 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_10.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_10.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -13,14 +13,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 %lazy_measure_leaked = call i64 @___lazy_measure_leaked(i64 %"2_01") call void @___qfree(i64 %"2_01") - store i64 %lazy_measure_leaked, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store i64 %lazy_measure_leaked, ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_2.snap new file mode 100644 index 000000000..ad630f9b4 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_2.snap @@ -0,0 +1,40 @@ +--- +source: tket-qsystem/src/llvm/qsystem.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca i64, align 8 + %"2_0" = alloca i64, align 8 + %"2_1" = alloca i64, align 8 + %"2_2" = alloca double, align 8 + %"4_0" = alloca i64, align 8 + %"4_1" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + store i64 %1, ptr %"2_1", align 4 + store double %2, ptr %"2_2", align 8 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load i64, ptr %"2_1", align 4 + %"2_23" = load double, ptr %"2_2", align 8 + call void @___rzz(i64 %"2_01", i64 %"2_12", double %"2_23") + store i64 %"2_01", ptr %"4_0", align 4 + store i64 %"2_12", ptr %"4_1", align 4 + %"4_04" = load i64, ptr %"4_0", align 4 + %"4_15" = load i64, ptr %"4_1", align 4 + store i64 %"4_04", ptr %"0", align 4 + store i64 %"4_15", ptr %"1", align 4 + %"06" = load i64, ptr %"0", align 4 + %"17" = load i64, ptr %"1", align 4 + %mrv = insertvalue { i64, i64 } poison, i64 %"06", 0 + %mrv8 = insertvalue { i64, i64 } %mrv, i64 %"17", 1 + ret { i64, i64 } %mrv8 +} + +declare void @___rzz(i64, i64, double) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_3.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_3.snap index 7626c2648..b62712490 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0, double %1, double %2) { +define internal i64 @_hl.main.1(i64 %0, double %1, double %2) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -15,17 +15,17 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - store double %1, double* %"2_1", align 8 - store double %2, double* %"2_2", align 8 - %"2_01" = load i64, i64* %"2_0", align 4 - %"2_12" = load double, double* %"2_1", align 8 - %"2_23" = load double, double* %"2_2", align 8 + store i64 %0, ptr %"2_0", align 4 + store double %1, ptr %"2_1", align 8 + store double %2, ptr %"2_2", align 8 + %"2_01" = load i64, ptr %"2_0", align 4 + %"2_12" = load double, ptr %"2_1", align 8 + %"2_23" = load double, ptr %"2_2", align 8 call void @___rxy(i64 %"2_01", double %"2_12", double %"2_23") - store i64 %"2_01", i64* %"4_0", align 4 - %"4_04" = load i64, i64* %"4_0", align 4 - store i64 %"4_04", i64* %"0", align 4 - %"05" = load i64, i64* %"0", align 4 + store i64 %"2_01", ptr %"4_0", align 4 + %"4_04" = load i64, ptr %"4_0", align 4 + store i64 %"4_04", ptr %"0", align 4 + %"05" = load i64, ptr %"0", align 4 ret i64 %"05" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_4.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_4.snap index 253c6f592..7b72c61b4 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i1, i64, i1 } @_hl.main.1(i64 %0) { +define internal { i1, i64, i1 } @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca { i1, i64, i1 }, align 8 %"2_0" = alloca i64, align 8 @@ -16,21 +16,21 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - store i64 %"2_01", i64* %"6_0", align 4 - %"6_02" = load i64, i64* %"6_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + store i64 %"2_01", ptr %"6_0", align 4 + %"6_02" = load i64, ptr %"6_0", align 4 %lazy_measure = call i64 @___lazy_measure(i64 %"6_02") call void @___qfree(i64 %"6_02") - store i64 %lazy_measure, i64* %"8_0", align 4 - %"8_03" = load i64, i64* %"8_0", align 4 + store i64 %lazy_measure, ptr %"8_0", align 4 + %"8_03" = load i64, ptr %"8_0", align 4 %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %"8_03", 1 - store { i1, i64, i1 } %1, { i1, i64, i1 }* %"9_0", align 4 - %"9_04" = load { i1, i64, i1 }, { i1, i64, i1 }* %"9_0", align 4 - store { i1, i64, i1 } %"9_04", { i1, i64, i1 }* %"4_0", align 4 - %"4_05" = load { i1, i64, i1 }, { i1, i64, i1 }* %"4_0", align 4 - store { i1, i64, i1 } %"4_05", { i1, i64, i1 }* %"0", align 4 - %"06" = load { i1, i64, i1 }, { i1, i64, i1 }* %"0", align 4 + store { i1, i64, i1 } %1, ptr %"9_0", align 4 + %"9_04" = load { i1, i64, i1 }, ptr %"9_0", align 4 + store { i1, i64, i1 } %"9_04", ptr %"4_0", align 4 + %"4_05" = load { i1, i64, i1 }, ptr %"4_0", align 4 + store { i1, i64, i1 } %"4_05", ptr %"0", align 4 + %"06" = load { i1, i64, i1 }, ptr %"0", align 4 ret { i1, i64, i1 } %"06" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_5.snap similarity index 63% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_5.snap index 0e91c3e57..0b5aa81be 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -13,14 +13,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 %lazy_measure = call i64 @___lazy_measure(i64 %"2_01") call void @___qfree(i64 %"2_01") - store i64 %lazy_measure, i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store i64 %lazy_measure, ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap similarity index 76% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_6.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap index 6bd67e371..a6894518e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i1, i64 } @_hl.main.1() { +define internal { i1, i64 } @_hl.main.1() { alloca_block: %"0" = alloca { i1, i64 }, align 8 %"4_0" = alloca { i1, i64 }, align 8 @@ -23,10 +23,10 @@ reset_bb: ; preds = %entry_block id_bb: ; preds = %entry_block, %reset_bb %0 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc, 1 %1 = select i1 %not_max, { i1, i64 } %0, { i1, i64 } { i1 false, i64 poison } - store { i1, i64 } %1, { i1, i64 }* %"4_0", align 4 - %"4_01" = load { i1, i64 }, { i1, i64 }* %"4_0", align 4 - store { i1, i64 } %"4_01", { i1, i64 }* %"0", align 4 - %"02" = load { i1, i64 }, { i1, i64 }* %"0", align 4 + store { i1, i64 } %1, ptr %"4_0", align 4 + %"4_01" = load { i1, i64 }, ptr %"4_0", align 4 + store { i1, i64 } %"4_01", ptr %"0", align 4 + %"02" = load { i1, i64 }, ptr %"0", align 4 ret { i1, i64 } %"02" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap similarity index 74% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_7.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap index faa50933f..3d88cb892 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_7.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap @@ -5,14 +5,14 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___qfree(i64 %"2_01") ret void } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_8.snap similarity index 59% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_8.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_8.snap index b3b3ea33d..0f3c13390 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm14_8.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_8.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -13,13 +13,13 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @___reset(i64 %"2_01") - store i64 %"2_01", i64* %"4_0", align 4 - %"4_02" = load i64, i64* %"4_0", align 4 - store i64 %"4_02", i64* %"0", align 4 - %"03" = load i64, i64* %"0", align 4 + store i64 %"2_01", ptr %"4_0", align 4 + %"4_02" = load i64, ptr %"4_0", align 4 + store i64 %"4_02", ptr %"0", align 4 + %"03" = load i64, ptr %"0", align 4 ret i64 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_9.snap new file mode 100644 index 000000000..f711ce8ac --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_9.snap @@ -0,0 +1,50 @@ +--- +source: tket-qsystem/src/llvm/qsystem.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { +alloca_block: + %"0" = alloca i64, align 8 + %"1" = alloca { i1, i64, i1 }, align 8 + %"2_0" = alloca i64, align 8 + %"4_0" = alloca i64, align 8 + %"4_1" = alloca { i1, i64, i1 }, align 8 + %"6_0" = alloca i64, align 8 + %"8_0" = alloca i64, align 8 + %"8_1" = alloca i64, align 8 + %"9_0" = alloca { i1, i64, i1 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + store i64 %"2_01", ptr %"6_0", align 4 + %"6_02" = load i64, ptr %"6_0", align 4 + %lazy_measure = call i64 @___lazy_measure(i64 %"6_02") + call void @___reset(i64 %"6_02") + store i64 %"6_02", ptr %"8_0", align 4 + store i64 %lazy_measure, ptr %"8_1", align 4 + %"8_13" = load i64, ptr %"8_1", align 4 + %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %"8_13", 1 + store { i1, i64, i1 } %1, ptr %"9_0", align 4 + %"8_04" = load i64, ptr %"8_0", align 4 + %"9_05" = load { i1, i64, i1 }, ptr %"9_0", align 4 + store i64 %"8_04", ptr %"4_0", align 4 + store { i1, i64, i1 } %"9_05", ptr %"4_1", align 4 + %"4_06" = load i64, ptr %"4_0", align 4 + %"4_17" = load { i1, i64, i1 }, ptr %"4_1", align 4 + store i64 %"4_06", ptr %"0", align 4 + store { i1, i64, i1 } %"4_17", ptr %"1", align 4 + %"08" = load i64, ptr %"0", align 4 + %"19" = load { i1, i64, i1 }, ptr %"1", align 4 + %mrv = insertvalue { i64, { i1, i64, i1 } } poison, i64 %"08", 0 + %mrv10 = insertvalue { i64, { i1, i64, i1 } } %mrv, { i1, i64, i1 } %"19", 1 + ret { i64, { i1, i64, i1 } } %mrv10 +} + +declare i64 @___lazy_measure(i64) + +declare void @___reset(i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap similarity index 87% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap index 0a035fa56..799a38083 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private {} @_hl.main.1({} %0, i64 %1) { +define internal {} @_hl.main.1({} %0, i64 %1) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap similarity index 79% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap index c948e80e6..c69b7f8cd 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i32, {} } @_hl.main.1({} %0) { +define internal { i32, {} } @_hl.main.1({} %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %rint = call i32 @random_int() - %mrv = insertvalue { i32, {} } undef, i32 %rint, 0 + %mrv = insertvalue { i32, {} } poison, i32 %rint, 0 %mrv6 = insertvalue { i32, {} } %mrv, {} zeroinitializer, 1 ret { i32, {} } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap similarity index 78% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap index e49057f26..22381198e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { double, {} } @_hl.main.1({} %0) { +define internal { double, {} } @_hl.main.1({} %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %rfloat = call double @random_float() - %mrv = insertvalue { double, {} } undef, double %rfloat, 0 + %mrv = insertvalue { double, {} } poison, double %rfloat, 0 %mrv6 = insertvalue { double, {} } %mrv, {} zeroinitializer, 1 ret { double, {} } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap similarity index 78% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap index 9eb97e012..d0bf6b489 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i32, {} } @_hl.main.1({} %0, i32 %1) { +define internal { i32, {} } @_hl.main.1({} %0, i32 %1) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block %rintb = call i32 @random_rng(i32 %1) - %mrv = insertvalue { i32, {} } undef, i32 %rintb, 0 + %mrv = insertvalue { i32, {} } poison, i32 %rintb, 0 %mrv7 = insertvalue { i32, {} } %mrv, {} zeroinitializer, 1 ret { i32, {} } %mrv7 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap similarity index 88% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap index bcc98e15c..2f1d5c317 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap similarity index 85% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap index 964c0773d..eb392ab80 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1({} %0) { +define internal void @_hl.main.1({} %0) { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_3.snap deleted file mode 100644 index eb8f56334..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_3.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/random.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -define private { i32, {} } @_hl.main.1({} %0, i32 %1) { -alloca_block: - %"0" = alloca i32, align 4 - %"1" = alloca {}, align 8 - %"2_0" = alloca {}, align 8 - %"2_1" = alloca i32, align 4 - %"4_0" = alloca i32, align 4 - %"4_1" = alloca {}, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - store i32 %1, i32* %"2_1", align 4 - %"2_01" = load {}, {}* %"2_0", align 1 - %"2_12" = load i32, i32* %"2_1", align 4 - %rintb = call i32 @random_rng(i32 %"2_12") - store i32 %rintb, i32* %"4_0", align 4 - store {} zeroinitializer, {}* %"4_1", align 1 - %"4_03" = load i32, i32* %"4_0", align 4 - %"4_14" = load {}, {}* %"4_1", align 1 - store i32 %"4_03", i32* %"0", align 4 - store {} %"4_14", {}* %"1", align 1 - %"05" = load i32, i32* %"0", align 4 - %"16" = load {}, {}* %"1", align 1 - %mrv = insertvalue { i32, {} } undef, i32 %"05", 0 - %mrv7 = insertvalue { i32, {} } %mrv, {} %"16", 1 - ret { i32, {} } %mrv7 -} - -declare i32 @random_rng(i32) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.snap similarity index 55% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.snap index f4eab931c..d48da2bc1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private {} @_hl.main.1({} %0, i64 %1) { +define internal {} @_hl.main.1({} %0, i64 %1) { alloca_block: %"0" = alloca {}, align 8 %"2_0" = alloca {}, align 8 @@ -14,15 +14,15 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - store i64 %1, i64* %"2_1", align 4 - %"2_01" = load {}, {}* %"2_0", align 1 - %"2_12" = load i64, i64* %"2_1", align 4 + store {} %0, ptr %"2_0", align 1 + store i64 %1, ptr %"2_1", align 4 + %"2_01" = load {}, ptr %"2_0", align 1 + %"2_12" = load i64, ptr %"2_1", align 4 call void @random_advance(i64 %"2_12") - store {} %"2_01", {}* %"4_0", align 1 - %"4_03" = load {}, {}* %"4_0", align 1 - store {} %"4_03", {}* %"0", align 1 - %"04" = load {}, {}* %"0", align 1 + store {} %"2_01", ptr %"4_0", align 1 + %"4_03" = load {}, ptr %"4_0", align 1 + store {} %"4_03", ptr %"0", align 1 + %"04" = load {}, ptr %"0", align 1 ret {} %"04" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_1.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_1.snap index 1f5d4b39b..e901642f4 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { i32, {} } @_hl.main.1({} %0) { +define internal { i32, {} } @_hl.main.1({} %0) { alloca_block: %"0" = alloca i32, align 4 %"1" = alloca {}, align 8 @@ -15,18 +15,18 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 + store {} %0, ptr %"2_0", align 1 + %"2_01" = load {}, ptr %"2_0", align 1 %rint = call i32 @random_int() - store i32 %rint, i32* %"4_0", align 4 - store {} zeroinitializer, {}* %"4_1", align 1 - %"4_02" = load i32, i32* %"4_0", align 4 - %"4_13" = load {}, {}* %"4_1", align 1 - store i32 %"4_02", i32* %"0", align 4 - store {} %"4_13", {}* %"1", align 1 - %"04" = load i32, i32* %"0", align 4 - %"15" = load {}, {}* %"1", align 1 - %mrv = insertvalue { i32, {} } undef, i32 %"04", 0 + store i32 %rint, ptr %"4_0", align 4 + store {} zeroinitializer, ptr %"4_1", align 1 + %"4_02" = load i32, ptr %"4_0", align 4 + %"4_13" = load {}, ptr %"4_1", align 1 + store i32 %"4_02", ptr %"0", align 4 + store {} %"4_13", ptr %"1", align 1 + %"04" = load i32, ptr %"0", align 4 + %"15" = load {}, ptr %"1", align 1 + %mrv = insertvalue { i32, {} } poison, i32 %"04", 0 %mrv6 = insertvalue { i32, {} } %mrv, {} %"15", 1 ret { i32, {} } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_2.snap similarity index 50% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_2.snap index ce928d0f3..ea5809cf5 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_2.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private { double, {} } @_hl.main.1({} %0) { +define internal { double, {} } @_hl.main.1({} %0) { alloca_block: %"0" = alloca double, align 8 %"1" = alloca {}, align 8 @@ -15,18 +15,18 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 + store {} %0, ptr %"2_0", align 1 + %"2_01" = load {}, ptr %"2_0", align 1 %rfloat = call double @random_float() - store double %rfloat, double* %"4_0", align 8 - store {} zeroinitializer, {}* %"4_1", align 1 - %"4_02" = load double, double* %"4_0", align 8 - %"4_13" = load {}, {}* %"4_1", align 1 - store double %"4_02", double* %"0", align 8 - store {} %"4_13", {}* %"1", align 1 - %"04" = load double, double* %"0", align 8 - %"15" = load {}, {}* %"1", align 1 - %mrv = insertvalue { double, {} } undef, double %"04", 0 + store double %rfloat, ptr %"4_0", align 8 + store {} zeroinitializer, ptr %"4_1", align 1 + %"4_02" = load double, ptr %"4_0", align 8 + %"4_13" = load {}, ptr %"4_1", align 1 + store double %"4_02", ptr %"0", align 8 + store {} %"4_13", ptr %"1", align 1 + %"04" = load double, ptr %"0", align 8 + %"15" = load {}, ptr %"1", align 1 + %mrv = insertvalue { double, {} } poison, double %"04", 0 %mrv6 = insertvalue { double, {} } %mrv, {} %"15", 1 ret { double, {} } %mrv6 } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_3.snap new file mode 100644 index 000000000..23085e6bd --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_3.snap @@ -0,0 +1,37 @@ +--- +source: tket-qsystem/src/llvm/random.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +define internal { i32, {} } @_hl.main.1({} %0, i32 %1) { +alloca_block: + %"0" = alloca i32, align 4 + %"1" = alloca {}, align 8 + %"2_0" = alloca {}, align 8 + %"2_1" = alloca i32, align 4 + %"4_0" = alloca i32, align 4 + %"4_1" = alloca {}, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store {} %0, ptr %"2_0", align 1 + store i32 %1, ptr %"2_1", align 4 + %"2_01" = load {}, ptr %"2_0", align 1 + %"2_12" = load i32, ptr %"2_1", align 4 + %rintb = call i32 @random_rng(i32 %"2_12") + store i32 %rintb, ptr %"4_0", align 4 + store {} zeroinitializer, ptr %"4_1", align 1 + %"4_03" = load i32, ptr %"4_0", align 4 + %"4_14" = load {}, ptr %"4_1", align 1 + store i32 %"4_03", ptr %"0", align 4 + store {} %"4_14", ptr %"1", align 1 + %"05" = load i32, ptr %"0", align 4 + %"16" = load {}, ptr %"1", align 1 + %mrv = insertvalue { i32, {} } poison, i32 %"05", 0 + %mrv7 = insertvalue { i32, {} } %mrv, {} %"16", 1 + ret { i32, {} } %mrv7 +} + +declare i32 @random_rng(i32) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_4.snap similarity index 60% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_4.snap index 50849c55a..6a3e511b8 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i64, align 8 @@ -13,13 +13,13 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 call void @random_seed(i64 %"2_01") - store i1 true, i1* %"4_0", align 1 - %"4_02" = load i1, i1* %"4_0", align 1 - store i1 %"4_02", i1* %"0", align 1 - %"03" = load i1, i1* %"0", align 1 + store i1 true, ptr %"4_0", align 1 + %"4_02" = load i1, ptr %"4_0", align 1 + store i1 %"4_02", ptr %"0", align 1 + %"03" = load i1, ptr %"0", align 1 ret i1 %"03" } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap similarity index 70% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_5.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap index 720310723..6c5937da7 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm14_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private void @_hl.main.1({} %0) { +define internal void @_hl.main.1({} %0) { alloca_block: %"2_0" = alloca {}, align 8 br label %entry_block entry_block: ; preds = %alloca_block - store {} %0, {}* %"2_0", align 1 - %"2_01" = load {}, {}* %"2_0", align 1 + store {} %0, ptr %"2_0", align 1 + %"2_01" = load {}, ptr %"2_0", align 1 ret void } diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_10.snap deleted file mode 100644 index e78833680..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_10.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1([10 x i64] %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 10, align 8 - %2 = bitcast i64* %1 to [10 x i64]* - store [10 x i64] %0, [10 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_11.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_11.snap deleted file mode 100644 index c24f1db8f..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_11.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_f.038B27BE.0 = private constant [27 x i8] c"\1AUSER:FLOATARR:test_arr_f64" - -define private void @_hl.main.1({ double*, i64 } %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_f.038B27BE.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { double*, i64 } %0, 0 - %array_offset = extractvalue { double*, i64 } %0, 1 - %1 = getelementptr inbounds double, double* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, double*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store double* %1, double** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, align 1 - call void @print_float_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_f.038B27BE.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, double*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_float_arr(i8*, i64, <{ i32, i32, double*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_5.snap deleted file mode 100644 index c10a9e045..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_5.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" - -define private void @_hl.main.1({ i1*, i64 } %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i1*, i64 } %0, 0 - %array_offset = extractvalue { i1*, i64 } %0, 1 - %1 = getelementptr inbounds i1, i1* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i1*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i1* %1, i1** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, align 1 - call void @print_bool_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i1*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_bool_arr(i8*, i64, <{ i32, i32, i1*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_6.snap deleted file mode 100644 index c290f33d0..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_6.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" - -define private void @_hl.main.1([10 x i1] %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i1, i32 10, align 1 - %2 = bitcast i1* %1 to [10 x i1]* - store [10 x i1] %0, [10 x i1]* %2, align 1 - %out_arr_alloca = alloca <{ i32, i32, i1*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i1* %1, i1** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, align 1 - call void @print_bool_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i1*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_bool_arr(i8*, i64, <{ i32, i32, i1*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_7.snap deleted file mode 100644 index 2674ed27b..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_7.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %0, 0 - %array_offset = extractvalue { i64*, i64 } %0, 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_8.snap deleted file mode 100644 index e78833680..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_8.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1([10 x i64] %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 10, align 8 - %2 = bitcast i64* %1 to [10 x i64]* - store [10 x i64] %0, [10 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_9.snap deleted file mode 100644 index 4469ce657..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_9.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_u.3D1C515C.0 = private constant [26 x i8] c"\19USER:INTARR:test_arr_uint" - -define private void @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - br label %entry_block - -entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @res_test_arr_u.3D1C515C.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %0, 0 - %array_offset = extractvalue { i64*, i64 } %0, 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_uint_arr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @res_test_arr_u.3D1C515C.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_uint_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap index ebab729e6..423005c5e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @res_test_bool.427F8271.0 = private constant [20 x i8] c"\13USER:BOOL:test_bool" -define private void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_bool.427F8271.0, i32 0, i32 0), align 1 + %tag_len = load i8, ptr @res_test_bool.427F8271.0, align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_bool.427F8271.0, i32 0, i32 0), i64 %tag_len2, i1 %0) + call void @print_bool(ptr @res_test_bool.427F8271.0, i64 %tag_len2, i1 %0) ret void } -declare void @print_bool(i8*, i64, i1) +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_10.snap new file mode 100644 index 000000000..38ff5b53a --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_10.snap @@ -0,0 +1,35 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define private void @_hl.main.1([10 x i64] %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 10, align 8 + store [10 x i64] %0, ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_11.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_11.snap new file mode 100644 index 000000000..82c88b50c --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_11.snap @@ -0,0 +1,36 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_f.038B27BE.0 = private constant [27 x i8] c"\1AUSER:FLOATARR:test_arr_f64" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_f.038B27BE.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %0, 0 + %array_offset = extractvalue { ptr, i64 } %0, 1 + %1 = getelementptr inbounds [10 x double], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_float_arr(ptr @res_test_arr_f.038B27BE.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_float_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_12.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_12.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap index 4d06e8f74..0aba173da 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_12.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0" = private constant [25 x i8] c"\18USER:INT:\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i32 0, i32 0), align 1 + %tag_len = load i8, ptr @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_int(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i32 0, i32 0), i64 %tag_len2, i64 %0) + call void @print_int(ptr @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i64 %tag_len2, i64 %0) ret void } -declare void @print_int(i8*, i64, i64) +declare void @print_int(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_13.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_13.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap index 817731f6c..887f8aae5 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_13.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @"res_test!@#$%^.2547CEEA.0" = private constant [24 x i8] c"\17USER:INT:test!@#$%^&*()" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @"res_test!@#$%^.2547CEEA.0", i32 0, i32 0), align 1 + %tag_len = load i8, ptr @"res_test!@#$%^.2547CEEA.0", align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_uint(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @"res_test!@#$%^.2547CEEA.0", i32 0, i32 0), i64 %tag_len2, i64 %0) + call void @print_uint(ptr @"res_test!@#$%^.2547CEEA.0", i64 %tag_len2, i64 %0) ret void } -declare void @print_uint(i8*, i64, i64) +declare void @print_uint(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_15.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap similarity index 54% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_15.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap index c289f6d65..c5499233a 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_15.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @"res_ spaces .F46B5D1D.0" = private constant [41 x i8] c"(USER:BOOL: spaces tabs\09\09\09newlines\0A\0A\0A" -define private void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @"res_ spaces .F46B5D1D.0", i32 0, i32 0), align 1 + %tag_len = load i8, ptr @"res_ spaces .F46B5D1D.0", align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @"res_ spaces .F46B5D1D.0", i32 0, i32 0), i64 %tag_len2, i1 %0) + call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %0) ret void } -declare void @print_bool(i8*, i64, i1) +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_16.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_16.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap index bf212c0a2..62cff092b 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_16.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0" = private constant [44 x i8] c"+USER:BOOL:\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D" -define private void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i32 0, i32 0), align 1 + %tag_len = load i8, ptr @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i32 0, i32 0), i64 %tag_len2, i1 %0) + call void @print_bool(ptr @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i64 %tag_len2, i1 %0) ret void } -declare void @print_bool(i8*, i64, i1) +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_2.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap index fb5a8f724..d851efee9 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @res_test_int.258C85C2.0 = private constant [18 x i8] c"\11USER:INT:test_int" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_test_int.258C85C2.0, i32 0, i32 0), align 1 + %tag_len = load i8, ptr @res_test_int.258C85C2.0, align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_test_int.258C85C2.0, i32 0, i32 0), i64 %tag_len2, i64 %0) + call void @print_int(ptr @res_test_int.258C85C2.0, i64 %tag_len2, i64 %0) ret void } -declare void @print_int(i8*, i64, i64) +declare void @print_int(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap similarity index 52% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_3.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap index 9607cb99b..aeb0eff62 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @res_test_uint.DE04EADD.0 = private constant [19 x i8] c"\12USER:INT:test_uint" -define private void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_test_uint.DE04EADD.0, i32 0, i32 0), align 1 + %tag_len = load i8, ptr @res_test_uint.DE04EADD.0, align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_uint(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_test_uint.DE04EADD.0, i32 0, i32 0), i64 %tag_len2, i64 %0) + call void @print_uint(ptr @res_test_uint.DE04EADD.0, i64 %tag_len2, i64 %0) ret void } -declare void @print_uint(i8*, i64, i64) +declare void @print_uint(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap similarity index 51% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_4.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap index f09b1a1de..079dfa470 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm14_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap @@ -7,15 +7,15 @@ source_filename = "test_context" @res_test_f64.A24BDAE1.0 = private constant [20 x i8] c"\13USER:FLOAT:test_f64" -define private void @_hl.main.1(double %0) { +define internal void @_hl.main.1(double %0) { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_f64.A24BDAE1.0, i32 0, i32 0), align 1 + %tag_len = load i8, ptr @res_test_f64.A24BDAE1.0, align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_float(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_f64.A24BDAE1.0, i32 0, i32 0), i64 %tag_len2, double %0) + call void @print_float(ptr @res_test_f64.A24BDAE1.0, i64 %tag_len2, double %0) ret void } -declare void @print_float(i8*, i64, double) +declare void @print_float(ptr, i64, double) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_5.snap new file mode 100644 index 000000000..d74b84386 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_5.snap @@ -0,0 +1,36 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %0, 0 + %array_offset = extractvalue { ptr, i64 } %0, 1 + %1 = getelementptr inbounds [10 x i1], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_bool_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_6.snap new file mode 100644 index 000000000..46ec3a632 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_6.snap @@ -0,0 +1,35 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" + +define private void @_hl.main.1([10 x i1] %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i1, i32 10, align 1 + store [10 x i1] %0, ptr %1, align 1 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_bool_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_7.snap new file mode 100644 index 000000000..0719cb4bc --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_7.snap @@ -0,0 +1,36 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %0, 0 + %array_offset = extractvalue { ptr, i64 } %0, 1 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_8.snap new file mode 100644 index 000000000..38ff5b53a --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_8.snap @@ -0,0 +1,35 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define private void @_hl.main.1([10 x i64] %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 10, align 8 + store [10 x i64] %0, ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_9.snap new file mode 100644 index 000000000..28b01c227 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_9.snap @@ -0,0 +1,36 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_u.3D1C515C.0 = private constant [26 x i8] c"\19USER:INTARR:test_arr_uint" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + br label %entry_block + +entry_block: ; preds = %alloca_block + %tag_len = load i8, ptr @res_test_arr_u.3D1C515C.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %0, 0 + %array_offset = extractvalue { ptr, i64 } %0, 1 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_uint_arr(ptr @res_test_arr_u.3D1C515C.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_uint_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_1.snap deleted file mode 100644 index f098f8c73..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_1.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_bool.427F8271.0 = private constant [20 x i8] c"\13USER:BOOL:test_bool" - -define private void @_hl.main.1(i1 %0) { -alloca_block: - %"2_0" = alloca i1, align 1 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %tag_len = load i8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_bool.427F8271.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_bool.427F8271.0, i32 0, i32 0), i64 %tag_len2, i1 %"2_01") - ret void -} - -declare void @print_bool(i8*, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_10.snap deleted file mode 100644 index aba89c04d..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_10.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1([10 x i64] %0) { -alloca_block: - %"2_0" = alloca [10 x i64], align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store [10 x i64] %0, [10 x i64]* %"2_0", align 4 - %"2_01" = load [10 x i64], [10 x i64]* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 10, align 8 - %2 = bitcast i64* %1 to [10 x i64]* - store [10 x i64] %"2_01", [10 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_11.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_11.snap deleted file mode 100644 index 41bf9b67e..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_11.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_f.038B27BE.0 = private constant [27 x i8] c"\1AUSER:FLOATARR:test_arr_f64" - -define private void @_hl.main.1({ double*, i64 } %0) { -alloca_block: - %"2_0" = alloca { double*, i64 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { double*, i64 } %0, { double*, i64 }* %"2_0", align 8 - %"2_01" = load { double*, i64 }, { double*, i64 }* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_f.038B27BE.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { double*, i64 } %"2_01", 0 - %array_offset = extractvalue { double*, i64 } %"2_01", 1 - %1 = getelementptr inbounds double, double* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, double*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store double* %1, double** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, double*, i1* }>, <{ i32, i32, double*, i1* }>* %out_arr_alloca, align 1 - call void @print_float_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_f.038B27BE.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, double*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_float_arr(i8*, i64, <{ i32, i32, double*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_12.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_12.snap deleted file mode 100644 index 9c45642d9..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_12.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0" = private constant [25 x i8] c"\18USER:INT:\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2" - -define private void @_hl.main.1(i64 %0) { -alloca_block: - %"2_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_int(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i32 0, i32 0), i64 %tag_len2, i64 %"2_01") - ret void -} - -declare void @print_int(i8*, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_13.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_13.snap deleted file mode 100644 index c42464d2b..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_13.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@"res_test!@#$%^.2547CEEA.0" = private constant [24 x i8] c"\17USER:INT:test!@#$%^&*()" - -define private void @_hl.main.1(i64 %0) { -alloca_block: - %"2_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @"res_test!@#$%^.2547CEEA.0", i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_uint(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @"res_test!@#$%^.2547CEEA.0", i32 0, i32 0), i64 %tag_len2, i64 %"2_01") - ret void -} - -declare void @print_uint(i8*, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_16.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_16.snap deleted file mode 100644 index 312214cc7..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_16.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0" = private constant [44 x i8] c"+USER:BOOL:\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D" - -define private void @_hl.main.1(i1 %0) { -alloca_block: - %"2_0" = alloca i1, align 1 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %tag_len = load i8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i32 0, i32 0), i64 %tag_len2, i1 %"2_01") - ret void -} - -declare void @print_bool(i8*, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_2.snap deleted file mode 100644 index f045733c9..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_2.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_int.258C85C2.0 = private constant [18 x i8] c"\11USER:INT:test_int" - -define private void @_hl.main.1(i64 %0) { -alloca_block: - %"2_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_test_int.258C85C2.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_int(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @res_test_int.258C85C2.0, i32 0, i32 0), i64 %tag_len2, i64 %"2_01") - ret void -} - -declare void @print_int(i8*, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_3.snap deleted file mode 100644 index cbdd43094..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_3.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_uint.DE04EADD.0 = private constant [19 x i8] c"\12USER:INT:test_uint" - -define private void @_hl.main.1(i64 %0) { -alloca_block: - %"2_0" = alloca i64, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store i64 %0, i64* %"2_0", align 4 - %"2_01" = load i64, i64* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_test_uint.DE04EADD.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_uint(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @res_test_uint.DE04EADD.0, i32 0, i32 0), i64 %tag_len2, i64 %"2_01") - ret void -} - -declare void @print_uint(i8*, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_4.snap deleted file mode 100644 index 9e38de759..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_4.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_f64.A24BDAE1.0 = private constant [20 x i8] c"\13USER:FLOAT:test_f64" - -define private void @_hl.main.1(double %0) { -alloca_block: - %"2_0" = alloca double, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store double %0, double* %"2_0", align 8 - %"2_01" = load double, double* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_f64.A24BDAE1.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_float(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @res_test_f64.A24BDAE1.0, i32 0, i32 0), i64 %tag_len2, double %"2_01") - ret void -} - -declare void @print_float(i8*, i64, double) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_5.snap deleted file mode 100644 index 0c7ae16d8..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_5.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" - -define private void @_hl.main.1({ i1*, i64 } %0) { -alloca_block: - %"2_0" = alloca { i1*, i64 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i1*, i64 } %0, { i1*, i64 }* %"2_0", align 8 - %"2_01" = load { i1*, i64 }, { i1*, i64 }* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i1*, i64 } %"2_01", 0 - %array_offset = extractvalue { i1*, i64 } %"2_01", 1 - %1 = getelementptr inbounds i1, i1* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i1*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i1* %1, i1** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, align 1 - call void @print_bool_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i1*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_bool_arr(i8*, i64, <{ i32, i32, i1*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_6.snap deleted file mode 100644 index f13fb8ba3..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_6.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" - -define private void @_hl.main.1([10 x i1] %0) { -alloca_block: - %"2_0" = alloca [10 x i1], align 1 - br label %entry_block - -entry_block: ; preds = %alloca_block - store [10 x i1] %0, [10 x i1]* %"2_0", align 1 - %"2_01" = load [10 x i1], [10 x i1]* %"2_0", align 1 - %tag_len = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i1, i32 10, align 1 - %2 = bitcast i1* %1 to [10 x i1]* - store [10 x i1] %"2_01", [10 x i1]* %2, align 1 - %out_arr_alloca = alloca <{ i32, i32, i1*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i1* %1, i1** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i1*, i1* }>, <{ i32, i32, i1*, i1* }>* %out_arr_alloca, align 1 - call void @print_bool_arr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @res_test_arr_b.866EEC87.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i1*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_bool_arr(i8*, i64, <{ i32, i32, i1*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_7.snap deleted file mode 100644 index b42be4fcb..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_7.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - %"2_0" = alloca { i64*, i64 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i64*, i64 } %0, { i64*, i64 }* %"2_0", align 8 - %"2_01" = load { i64*, i64 }, { i64*, i64 }* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %"2_01", 0 - %array_offset = extractvalue { i64*, i64 } %"2_01", 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_8.snap deleted file mode 100644 index aba89c04d..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_8.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" - -define private void @_hl.main.1([10 x i64] %0) { -alloca_block: - %"2_0" = alloca [10 x i64], align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store [10 x i64] %0, [10 x i64]* %"2_0", align 4 - %"2_01" = load [10 x i64], [10 x i64]* %"2_0", align 4 - %tag_len = load i8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %1 = alloca i64, i32 10, align 8 - %2 = bitcast i64* %1 to [10 x i64]* - store [10 x i64] %"2_01", [10 x i64]* %2, align 4 - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %3 = alloca i1, i32 10, align 1 - %4 = bitcast i1* %3 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %4, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %3, i1** %mask_ptr, align 8 - %5 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_int_arr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @res_test_arr_i.DFD30452.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_int_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_9.snap deleted file mode 100644 index bd9efd731..000000000 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_9.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tket-qsystem/src/llvm/result.rs -expression: mod_str ---- -; ModuleID = 'test_context' -source_filename = "test_context" - -@res_test_arr_u.3D1C515C.0 = private constant [26 x i8] c"\19USER:INTARR:test_arr_uint" - -define private void @_hl.main.1({ i64*, i64 } %0) { -alloca_block: - %"2_0" = alloca { i64*, i64 }, align 8 - br label %entry_block - -entry_block: ; preds = %alloca_block - store { i64*, i64 } %0, { i64*, i64 }* %"2_0", align 8 - %"2_01" = load { i64*, i64 }, { i64*, i64 }* %"2_0", align 8 - %tag_len = load i8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @res_test_arr_u.3D1C515C.0, i32 0, i32 0), align 1 - %tag_len2 = zext i8 %tag_len to i64 - %array_ptr = extractvalue { i64*, i64 } %"2_01", 0 - %array_offset = extractvalue { i64*, i64 } %"2_01", 1 - %1 = getelementptr inbounds i64, i64* %array_ptr, i64 %array_offset - %out_arr_alloca = alloca <{ i32, i32, i64*, i1* }>, align 8 - %x_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 0 - %y_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 1 - %arr_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 2 - %mask_ptr = getelementptr inbounds <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, i32 0, i32 3 - %2 = alloca i1, i32 10, align 1 - %3 = bitcast i1* %2 to [10 x i1]* - store [10 x i1] zeroinitializer, [10 x i1]* %3, align 1 - store i32 10, i32* %x_ptr, align 4 - store i32 1, i32* %y_ptr, align 4 - store i64* %1, i64** %arr_ptr, align 8 - store i1* %2, i1** %mask_ptr, align 8 - %4 = load <{ i32, i32, i64*, i1* }>, <{ i32, i32, i64*, i1* }>* %out_arr_alloca, align 1 - call void @print_uint_arr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @res_test_arr_u.3D1C515C.0, i32 0, i32 0), i64 %tag_len2, <{ i32, i32, i64*, i1* }>* %out_arr_alloca) - ret void -} - -declare void @print_uint_arr(i8*, i64, <{ i32, i32, i64*, i1* }>*) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_1.snap new file mode 100644 index 000000000..492d3658d --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_1.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_bool.427F8271.0 = private constant [20 x i8] c"\13USER:BOOL:test_bool" + +define internal void @_hl.main.1(i1 %0) { +alloca_block: + %"2_0" = alloca i1, align 1 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %tag_len = load i8, ptr @res_test_bool.427F8271.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_bool(ptr @res_test_bool.427F8271.0, i64 %tag_len2, i1 %"2_01") + ret void +} + +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_10.snap new file mode 100644 index 000000000..4d2298606 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_10.snap @@ -0,0 +1,38 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define private void @_hl.main.1([10 x i64] %0) { +alloca_block: + %"2_0" = alloca [10 x i64], align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store [10 x i64] %0, ptr %"2_0", align 4 + %"2_01" = load [10 x i64], ptr %"2_0", align 4 + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 10, align 8 + store [10 x i64] %"2_01", ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_11.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_11.snap new file mode 100644 index 000000000..ba95a66ed --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_11.snap @@ -0,0 +1,39 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_f.038B27BE.0 = private constant [27 x i8] c"\1AUSER:FLOATARR:test_arr_f64" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + %"2_0" = alloca { ptr, i64 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { ptr, i64 } %0, ptr %"2_0", align 8 + %"2_01" = load { ptr, i64 }, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_arr_f.038B27BE.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1 + %1 = getelementptr inbounds [10 x double], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_float_arr(ptr @res_test_arr_f.038B27BE.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_float_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_12.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_12.snap new file mode 100644 index 000000000..a35ff2db4 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_12.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0" = private constant [25 x i8] c"\18USER:INT:\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2" + +define internal void @_hl.main.1(i64 %0) { +alloca_block: + %"2_0" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %tag_len = load i8, ptr @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_int(ptr @"res_\E6\B5\8B\E8\AF\95\E5\AD\97\E7\AC\A6\E4\B8\B2.935D2D1A.0", i64 %tag_len2, i64 %"2_01") + ret void +} + +declare void @print_int(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_13.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_13.snap new file mode 100644 index 000000000..5680b3487 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_13.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@"res_test!@#$%^.2547CEEA.0" = private constant [24 x i8] c"\17USER:INT:test!@#$%^&*()" + +define internal void @_hl.main.1(i64 %0) { +alloca_block: + %"2_0" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %tag_len = load i8, ptr @"res_test!@#$%^.2547CEEA.0", align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_uint(ptr @"res_test!@#$%^.2547CEEA.0", i64 %tag_len2, i64 %"2_01") + ret void +} + +declare void @print_uint(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_15.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap similarity index 50% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_15.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap index b0bdad46b..43feb3284 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm14_15.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap @@ -7,18 +7,18 @@ source_filename = "test_context" @"res_ spaces .F46B5D1D.0" = private constant [41 x i8] c"(USER:BOOL: spaces tabs\09\09\09newlines\0A\0A\0A" -define private void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) { alloca_block: %"2_0" = alloca i1, align 1 br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %tag_len = load i8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @"res_ spaces .F46B5D1D.0", i32 0, i32 0), align 1 + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %tag_len = load i8, ptr @"res_ spaces .F46B5D1D.0", align 1 %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @"res_ spaces .F46B5D1D.0", i32 0, i32 0), i64 %tag_len2, i1 %"2_01") + call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %"2_01") ret void } -declare void @print_bool(i8*, i64, i1) +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_16.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_16.snap new file mode 100644 index 000000000..9913d7df3 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_16.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0" = private constant [44 x i8] c"+USER:BOOL:\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D" + +define internal void @_hl.main.1(i1 %0) { +alloca_block: + %"2_0" = alloca i1, align 1 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %tag_len = load i8, ptr @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_bool(ptr @"res_\F0\9F\9A\80\F0\9F\91\A8\E2\80\8D\F0\9F\91\A9\E2\80\8D\F0\9F\91\A7\E2\80\8D\F0\9F\91\A6\F0\9F\8C\8D.F7EE3FAA.0", i64 %tag_len2, i1 %"2_01") + ret void +} + +declare void @print_bool(ptr, i64, i1) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_2.snap new file mode 100644 index 000000000..637e6c305 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_2.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_int.258C85C2.0 = private constant [18 x i8] c"\11USER:INT:test_int" + +define internal void @_hl.main.1(i64 %0) { +alloca_block: + %"2_0" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %tag_len = load i8, ptr @res_test_int.258C85C2.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_int(ptr @res_test_int.258C85C2.0, i64 %tag_len2, i64 %"2_01") + ret void +} + +declare void @print_int(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_3.snap new file mode 100644 index 000000000..b6edcf627 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_3.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_uint.DE04EADD.0 = private constant [19 x i8] c"\12USER:INT:test_uint" + +define internal void @_hl.main.1(i64 %0) { +alloca_block: + %"2_0" = alloca i64, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store i64 %0, ptr %"2_0", align 4 + %"2_01" = load i64, ptr %"2_0", align 4 + %tag_len = load i8, ptr @res_test_uint.DE04EADD.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_uint(ptr @res_test_uint.DE04EADD.0, i64 %tag_len2, i64 %"2_01") + ret void +} + +declare void @print_uint(ptr, i64, i64) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_4.snap new file mode 100644 index 000000000..0a631f536 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_4.snap @@ -0,0 +1,24 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_f64.A24BDAE1.0 = private constant [20 x i8] c"\13USER:FLOAT:test_f64" + +define internal void @_hl.main.1(double %0) { +alloca_block: + %"2_0" = alloca double, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store double %0, ptr %"2_0", align 8 + %"2_01" = load double, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_f64.A24BDAE1.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + call void @print_float(ptr @res_test_f64.A24BDAE1.0, i64 %tag_len2, double %"2_01") + ret void +} + +declare void @print_float(ptr, i64, double) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_5.snap new file mode 100644 index 000000000..2095e59c2 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_5.snap @@ -0,0 +1,39 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + %"2_0" = alloca { ptr, i64 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { ptr, i64 } %0, ptr %"2_0", align 8 + %"2_01" = load { ptr, i64 }, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1 + %1 = getelementptr inbounds [10 x i1], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_bool_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_6.snap new file mode 100644 index 000000000..8f40a37cb --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_6.snap @@ -0,0 +1,38 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_b.866EEC87.0 = private constant [27 x i8] c"\1AUSER:BOOLARR:test_arr_bool" + +define private void @_hl.main.1([10 x i1] %0) { +alloca_block: + %"2_0" = alloca [10 x i1], align 1 + br label %entry_block + +entry_block: ; preds = %alloca_block + store [10 x i1] %0, ptr %"2_0", align 1 + %"2_01" = load [10 x i1], ptr %"2_0", align 1 + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i1, i32 10, align 1 + store [10 x i1] %"2_01", ptr %1, align 1 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_bool_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_7.snap new file mode 100644 index 000000000..809855c5c --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_7.snap @@ -0,0 +1,39 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + %"2_0" = alloca { ptr, i64 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { ptr, i64 } %0, ptr %"2_0", align 8 + %"2_01" = load { ptr, i64 }, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_8.snap new file mode 100644 index 000000000..4d2298606 --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_8.snap @@ -0,0 +1,38 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_i.DFD30452.0 = private constant [25 x i8] c"\18USER:INTARR:test_arr_int" + +define private void @_hl.main.1([10 x i64] %0) { +alloca_block: + %"2_0" = alloca [10 x i64], align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store [10 x i64] %0, ptr %"2_0", align 4 + %"2_01" = load [10 x i64], ptr %"2_0", align 4 + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %1 = alloca i64, i32 10, align 8 + store [10 x i64] %"2_01", ptr %1, align 4 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_int_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_9.snap new file mode 100644 index 000000000..8777c792b --- /dev/null +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_9.snap @@ -0,0 +1,39 @@ +--- +source: tket-qsystem/src/llvm/result.rs +expression: mod_str +--- +; ModuleID = 'test_context' +source_filename = "test_context" + +@res_test_arr_u.3D1C515C.0 = private constant [26 x i8] c"\19USER:INTARR:test_arr_uint" + +define internal void @_hl.main.1({ ptr, i64 } %0) { +alloca_block: + %"2_0" = alloca { ptr, i64 }, align 8 + br label %entry_block + +entry_block: ; preds = %alloca_block + store { ptr, i64 } %0, ptr %"2_0", align 8 + %"2_01" = load { ptr, i64 }, ptr %"2_0", align 8 + %tag_len = load i8, ptr @res_test_arr_u.3D1C515C.0, align 1 + %tag_len2 = zext i8 %tag_len to i64 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3 + %2 = alloca i1, i32 10, align 1 + store [10 x i1] zeroinitializer, ptr %2, align 1 + store i32 10, ptr %x_ptr, align 4 + store i32 1, ptr %y_ptr, align 4 + store ptr %1, ptr %arr_ptr, align 8 + store ptr %2, ptr %mask_ptr, align 8 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1 + call void @print_uint_arr(ptr @res_test_arr_u.3D1C515C.0, i64 %tag_len2, ptr %out_arr_alloca) + ret void +} + +declare void @print_uint_arr(ptr, i64, ptr) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap similarity index 90% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap index 27fd66452..1f7077f82 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1() { +define internal i64 @_hl.main.1() { alloca_block: br label %entry_block diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm14_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap similarity index 66% rename from tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm14_1.snap rename to tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap index 70392c734..565aa96c4 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm14_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i64 @_hl.main.1() { +define internal i64 @_hl.main.1() { alloca_block: %"0" = alloca i64, align 8 %"4_0" = alloca i64, align 8 @@ -13,10 +13,10 @@ alloca_block: entry_block: ; preds = %alloca_block %shot = call i64 @get_current_shot() - store i64 %shot, i64* %"4_0", align 4 - %"4_01" = load i64, i64* %"4_0", align 4 - store i64 %"4_01", i64* %"0", align 4 - %"02" = load i64, i64* %"0", align 4 + store i64 %shot, ptr %"4_0", align 4 + %"4_01" = load i64, ptr %"4_0", align 4 + store i64 %"4_01", ptr %"0", align 4 + %"02" = load i64, ptr %"0", align 4 ret i64 %"02" } diff --git a/tket-qsystem/src/lower_drops.rs b/tket-qsystem/src/lower_drops.rs index 0dd243573..36889c1b6 100644 --- a/tket-qsystem/src/lower_drops.rs +++ b/tket-qsystem/src/lower_drops.rs @@ -1,10 +1,11 @@ //! Contains a pass to lower "drop" ops from the Guppy extension -use hugr::algorithms::replace_types::{Linearizer, NodeTemplate, ReplaceTypesError}; -use hugr::algorithms::{ComposablePass, ReplaceTypes}; use hugr::extension::prelude::bool_t; use hugr::extension::simple_op::MakeRegisteredOp; use hugr::types::Term; use hugr::{Node, hugr::hugrmut::HugrMut}; +use hugr_passes::composable::WithScope; +use hugr_passes::replace_types::{Linearizer, NodeTemplate, ReplaceTypesError}; +use hugr_passes::{ComposablePass, ReplaceTypes}; use tket::extension::guppy::{DROP_OP_NAME, GUPPY_EXTENSION}; use crate::extension::futures::{FutureOp, FutureOpDef, future_type}; @@ -13,6 +14,14 @@ use crate::extension::futures::{FutureOp, FutureOpDef, future_type}; #[derive(Default, Debug, Clone)] pub struct LowerDropsPass; +impl WithScope for LowerDropsPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for LowerDropsPass { type Error = ReplaceTypesError; @@ -74,7 +83,7 @@ mod test { let arr_type = array_type(2, usize_t()); let drop_op = GUPPY_EXTENSION.get_op(DROP_OP_NAME.as_str()).unwrap(); let drop_node = ExtensionOp::new(drop_op.clone(), [arr_type.clone().into()]).unwrap(); - let mut b = DFGBuilder::new(inout_sig(arr_type, vec![])).unwrap(); + let mut b = DFGBuilder::new(inout_sig(vec![arr_type], vec![])).unwrap(); let inp = b.input_wires(); b.add_dataflow_op(drop_node, inp).unwrap(); let mut h = b.finish_hugr_with_outputs([]).unwrap(); diff --git a/tket-qsystem/src/replace_bools.rs b/tket-qsystem/src/replace_bools.rs index d681c84ae..ff138cc90 100644 --- a/tket-qsystem/src/replace_bools.rs +++ b/tket-qsystem/src/replace_bools.rs @@ -3,10 +3,6 @@ mod static_array; use derive_more::{Display, Error, From}; -use hugr::algorithms::replace_types::{Linearizer, NodeTemplate, ReplaceTypesError}; -use hugr::algorithms::{ - ComposablePass, ReplaceTypes, ensure_no_nonlocal_edges, non_local::FindNonLocalEdgesError, -}; use hugr::builder::{ BuildHandle, Container, DFGBuilder, Dataflow, DataflowHugr, DataflowSubContainer, SubContainer, inout_sig, @@ -24,6 +20,10 @@ use hugr::std_extensions::collections::{ use hugr::std_extensions::logic::LogicOp; use hugr::types::{SumType, Term, Type}; use hugr::{Hugr, Node, Wire, hugr::hugrmut::HugrMut, type_row}; +use hugr_passes::composable::WithScope; +use hugr_passes::non_local::LocalizeEdges; +use hugr_passes::replace_types::{Linearizer, NodeTemplate, ReplaceTypesError}; +use hugr_passes::{ComposablePass, ReplaceTypes, non_local::FindNonLocalEdgesError}; use static_array::{ReplaceStaticArrayBoolPass, ReplaceStaticArrayBoolPassError}; use tket::TketOp; use tket::extension::{ @@ -68,12 +68,20 @@ pub enum ReplaceBoolPassError { #[derive(Default, Debug, Clone)] pub struct ReplaceBoolPass; +impl WithScope for ReplaceBoolPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for ReplaceBoolPass { type Error = ReplaceBoolPassError; type Result = (); fn run(&self, hugr: &mut H) -> Result<(), Self::Error> { - ensure_no_nonlocal_edges(hugr)?; + LocalizeEdges::default().check_no_nonlocal_edges(hugr)?; ReplaceStaticArrayBoolPass::default().run(hugr)?; let lowerer = lowerer(); lowerer.run(hugr)?; @@ -83,13 +91,16 @@ impl> ComposablePass for ReplaceBoolPass { /// The type each tket.bool is replaced with. fn bool_dest() -> Type { - SumType::new([bool_t(), future_type(bool_t())]).into() + SumType::new([vec![bool_t()], vec![future_type(bool_t())]]).into() } fn read_builder(dfb: &mut DFGBuilder, sum_wire: Wire) -> BuildHandle { let mut cb = dfb .conditional_builder( - ([bool_t().into(), future_type(bool_t()).into()], sum_wire), + ( + [vec![bool_t()].into(), vec![future_type(bool_t())].into()], + sum_wire, + ), [], vec![bool_t()].into(), ) @@ -121,7 +132,10 @@ fn make_opaque_op_dest() -> NodeTemplate { let [inp] = dfb.input_wires_arr(); let out = dfb .add_dataflow_op( - Tag::new(0, vec![bool_t().into(), future_type(bool_t()).into()]), + Tag::new( + 0, + vec![vec![bool_t()].into(), vec![future_type(bool_t())].into()], + ), vec![inp], ) .unwrap(); @@ -152,7 +166,10 @@ fn binary_logic_op_dest(op: &BoolOp) -> NodeTemplate { }; let out = dfb .add_dataflow_op( - Tag::new(0, vec![bool_t().into(), future_type(bool_t()).into()]), + Tag::new( + 0, + vec![vec![bool_t()].into(), vec![future_type(bool_t())].into()], + ), vec![result.out_wire(0)], ) .unwrap(); @@ -170,7 +187,10 @@ fn not_op_dest() -> NodeTemplate { .unwrap(); let out = dfb .add_dataflow_op( - Tag::new(0, vec![bool_t().into(), future_type(bool_t()).into()]), + Tag::new( + 0, + vec![vec![bool_t()].into(), vec![future_type(bool_t())].into()], + ), vec![result.out_wire(0)], ) .unwrap(); @@ -186,7 +206,10 @@ fn measure_dest() -> NodeTemplate { let measure = dfb.add_dataflow_op(lazy_measure, vec![q]).unwrap(); let tagged_output = dfb .add_dataflow_op( - Tag::new(1, vec![bool_t().into(), future_type(bool_t()).into()]), + Tag::new( + 1, + vec![vec![bool_t()].into(), vec![future_type(bool_t())].into()], + ), vec![measure.out_wire(0)], ) .unwrap(); @@ -204,7 +227,10 @@ fn measure_reset_dest() -> NodeTemplate { let measure = dfb.add_dataflow_op(lazy_measure_reset, vec![q]).unwrap(); let tagged_output = dfb .add_dataflow_op( - Tag::new(1, vec![bool_t().into(), future_type(bool_t()).into()]), + Tag::new( + 1, + vec![vec![bool_t()].into(), vec![future_type(bool_t())].into()], + ), vec![measure.out_wire(1)], ) .unwrap(); @@ -216,7 +242,7 @@ fn measure_reset_dest() -> NodeTemplate { fn barray_get_dest(rt: &ReplaceTypes, size: u64, elem_ty: Type) -> NodeTemplate { let array_ty = borrow_array_type(size, elem_ty.clone()); - let opt_el = option_type(elem_ty.clone()); + let opt_el = option_type(vec![elem_ty.clone()]); let mut dfb = DFGBuilder::new(inout_sig( vec![array_ty.clone(), usize_t()], vec![opt_el.clone().into(), array_ty.clone()], @@ -243,7 +269,10 @@ fn barray_get_dest(rt: &ReplaceTypes, size: u64, elem_ty: Type) -> NodeTemplate let mut out_of_range = cb.case_builder(0).unwrap(); let [arr_in, _] = out_of_range.input_wires_arr(); let [none] = out_of_range - .add_dataflow_op(Tag::new(0, vec![type_row![], elem_ty.clone().into()]), []) + .add_dataflow_op( + Tag::new(0, vec![type_row![], vec![elem_ty.clone()].into()]), + [], + ) .unwrap() .outputs_arr(); out_of_range.finish_with_outputs([none, arr_in]).unwrap(); @@ -274,7 +303,10 @@ fn barray_get_dest(rt: &ReplaceTypes, size: u64, elem_ty: Type) -> NodeTemplate .unwrap() .outputs_arr(); let [some] = in_range - .add_dataflow_op(Tag::new(1, vec![type_row![], elem_ty.into()]), [elem2]) + .add_dataflow_op( + Tag::new(1, vec![type_row![], vec![elem_ty].into()]), + [elem2], + ) .unwrap() .outputs_arr(); in_range.finish_with_outputs([some, arr]).unwrap(); @@ -653,7 +685,7 @@ mod test { .add_borrow_array_get(src_ty.clone(), 4, arr_in, idx) .unwrap(); let [elem] = dfb - .build_unwrap_sum(1, option_type(src_ty.clone()), opt_elem) + .build_unwrap_sum(1, option_type(vec![src_ty.clone()]), opt_elem) .unwrap(); let mut h = dfb.finish_hugr_with_outputs([arr, elem]).unwrap(); diff --git a/tket-qsystem/src/replace_bools/static_array.rs b/tket-qsystem/src/replace_bools/static_array.rs index 6cee3e3fe..28d7a66db 100644 --- a/tket-qsystem/src/replace_bools/static_array.rs +++ b/tket-qsystem/src/replace_bools/static_array.rs @@ -1,11 +1,5 @@ -/// Provides a `ReplaceStaticArrayBoolPass` which replaces static arrays containing `tket.bool` with -/// static arrays containing `bool_t` values. use hugr::{ HugrView as _, Node, Wire, - algorithms::{ - ComposablePass, ReplaceTypes, - replace_types::{NodeTemplate, ReplaceTypesError}, - }, builder::{ BuildError, DFGBuilder, Dataflow, DataflowHugr as _, DataflowSubContainer as _, SubContainer as _, inout_sig, @@ -25,6 +19,13 @@ use hugr::{ }, types::{Transformable as _, Type, TypeEnum, TypeRow}, }; +use hugr_passes::composable::WithScope; +/// Provides a `ReplaceStaticArrayBoolPass` which replaces static arrays containing `tket.bool` with +/// static arrays containing `bool_t` values. +use hugr_passes::{ + ComposablePass, ReplaceTypes, + replace_types::{NodeTemplate, ReplaceTypesError}, +}; use itertools::Itertools as _; use tket::extension::bool::{self, BOOL_TYPE_NAME, BoolOpBuilder as _, ConstBool, bool_type}; @@ -41,6 +42,14 @@ type Result = std::result::Result; /// containing `tket.bool` with static arrays containing `bool_t` values. pub struct ReplaceStaticArrayBoolPass(ReplaceTypes); +impl WithScope for ReplaceStaticArrayBoolPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for ReplaceStaticArrayBoolPass { type Error = ReplaceStaticArrayBoolPassError; type Result = bool; @@ -262,7 +271,7 @@ fn get_op_dest(rt: &ReplaceTypes, old_elem_ty: Type) -> Option { let mut hugr1 = { let mut dfb = DFGBuilder::new(inout_sig( vec![static_array_type(old_elem_ty.clone()), usize_t()], - Type::from(option_type(old_elem_ty.clone())), + vec![Type::from(option_type(vec![old_elem_ty.clone()]))], )) .unwrap(); let [arr, index] = dfb.input_wires_arr(); @@ -286,9 +295,9 @@ fn get_op_dest(rt: &ReplaceTypes, old_elem_ty: Type) -> Option { .input()[0] .clone(); - let res_ty = Type::from(option_type(old_elem_ty.clone())); + let res_ty = Type::from(option_type(vec![old_elem_ty.clone()])); let mut dfb = - DFGBuilder::new(inout_sig(vec![new_arr_ty, usize_t()], res_ty.clone())).unwrap(); + DFGBuilder::new(inout_sig(vec![new_arr_ty, usize_t()], vec![res_ty.clone()])).unwrap(); let [arr, index] = dfb.input_wires_arr(); let [val] = dfb .add_hugr_with_wires(hugr1, [arr, index]) @@ -304,7 +313,7 @@ fn get_op_dest(rt: &ReplaceTypes, old_elem_ty: Type) -> Option { #[cfg(test)] mod test { use hugr::types::SumType; - use hugr::{HugrView as _, algorithms::ComposablePass as _, extension::prelude::option_type}; + use hugr::{HugrView as _, extension::prelude::option_type}; use hugr::{ builder::DataflowHugr as _, extension::prelude::ConstUsize, std_extensions::collections::static_array::StaticArrayOpBuilder as _, @@ -316,6 +325,7 @@ mod test { type_row, types::Signature, }; + use hugr_passes::ComposablePass as _; use rstest::rstest; use super::*; @@ -352,7 +362,7 @@ mod test { let element_ty = x.get_element_type().clone(); let mut builder = DFGBuilder::new(Signature::new( type_row![], - vec![option_type(element_ty.clone()).into(), usize_t()], + vec![option_type(vec![element_ty.clone()]).into(), usize_t()], )) .unwrap(); diff --git a/tket-qsystem/tests/guppy_opt.rs b/tket-qsystem/tests/guppy_opt.rs index d69abf70b..b43cafec3 100644 --- a/tket-qsystem/tests/guppy_opt.rs +++ b/tket-qsystem/tests/guppy_opt.rs @@ -8,8 +8,8 @@ use std::io::BufReader; use std::path::Path; use tket::extension::{TKET_EXTENSION_ID, TKET1_EXTENSION_ID}; -use hugr::algorithms::ComposablePass; use hugr::{Hugr, HugrView}; +use hugr_passes::ComposablePass; use rstest::rstest; use tket::passes::NormalizeGuppy; use tket::serialize::pytket::{EncodeOptions, EncodedCircuit}; @@ -125,8 +125,8 @@ fn optimize_flattened_guppy(#[case] name: &str, #[case] xfail: Option Signature::new(bool_type, sum_type).into(), - BoolOp::make_opaque => Signature::new(sum_type, bool_type).into(), - BoolOp::not => Signature::new(bool_type.clone(), bool_type.clone()).into(), - BoolOp::eq | BoolOp::and | BoolOp::or | BoolOp::xor => Signature::new( - vec![bool_type.clone(), bool_type.clone()], - bool_type.clone(), - ) - .into(), + BoolOp::read => Signature::new([bool_type], [sum_type]).into(), + BoolOp::make_opaque => Signature::new([sum_type], [bool_type]).into(), + BoolOp::not => Signature::new([bool_type.clone()], [bool_type.clone()]).into(), + BoolOp::eq | BoolOp::and | BoolOp::or | BoolOp::xor => { + Signature::new([bool_type.clone(), bool_type.clone()], [bool_type.clone()]).into() + } } } @@ -287,7 +285,7 @@ pub(crate) mod test { let sum_type = Type::new_unit_sum(2); let hugr = { - let mut builder = DFGBuilder::new(Signature::new(bool_type, sum_type)).unwrap(); + let mut builder = DFGBuilder::new(Signature::new([bool_type], [sum_type])).unwrap(); let [input] = builder.input_wires_arr(); let output = builder.add_bool_read(input).unwrap(); builder.finish_hugr_with_outputs(output).unwrap() @@ -301,7 +299,7 @@ pub(crate) mod test { let sum_type = Type::new_unit_sum(2); let hugr = { - let mut builder = DFGBuilder::new(Signature::new(sum_type, bool_type)).unwrap(); + let mut builder = DFGBuilder::new(Signature::new([sum_type], [bool_type])).unwrap(); let [input] = builder.input_wires_arr(); let output = builder.add_bool_make_opaque(input).unwrap(); builder.finish_hugr_with_outputs(output).unwrap() diff --git a/tket/src/extension/debug.rs b/tket/src/extension/debug.rs index ea089cc5c..94dfb7f0a 100644 --- a/tket/src/extension/debug.rs +++ b/tket/src/extension/debug.rs @@ -186,7 +186,7 @@ pub(crate) mod test { let qb_array_type = array_type(22, qb_t()); let hugr = { let mut builder = - DFGBuilder::new(Signature::new(qb_array_type.clone(), qb_array_type)).unwrap(); + DFGBuilder::new(Signature::new([qb_array_type.clone()], [qb_array_type])).unwrap(); let inputs: [hugr::Wire; 1] = builder.input_wires_arr(); let output = builder.add_dataflow_op(op, inputs).unwrap(); builder.finish_hugr_with_outputs(output.outputs()).unwrap() diff --git a/tket/src/extension/modifier.rs b/tket/src/extension/modifier.rs index ea710512f..8d6bfdcac 100644 --- a/tket/src/extension/modifier.rs +++ b/tket/src/extension/modifier.rs @@ -227,7 +227,7 @@ mod test { #[case] op_fn: fn(Type, Type) -> (ExtensionOp, Signature), #[case] needs_extra_param: bool, ) { - let original_sig = Signature::new(vec![int_type(6), bool_t()], int_type(6)); + let original_sig = Signature::new([int_type(6), bool_t()], [int_type(6)]); let (control_op, modified_sig) = op_fn(int_type(6), bool_t()); let main_sig = modified_sig.clone(); diff --git a/tket/src/extension/rotation.rs b/tket/src/extension/rotation.rs index 0d4d71eac..a7d34585e 100644 --- a/tket/src/extension/rotation.rs +++ b/tket/src/extension/rotation.rs @@ -148,16 +148,16 @@ impl MakeOpDef for RotationOp { let rotation_type = Type::new_extension(rotation_custom_type(extension_ref)); match self { RotationOp::from_halfturns => Signature::new( - float64_type(), - Type::from(option_type(rotation_type.clone())), + [float64_type()], + [Type::from(option_type([rotation_type.clone()]))], ), RotationOp::from_halfturns_unchecked => { - Signature::new(float64_type(), rotation_type.clone()) + Signature::new([float64_type()], [rotation_type.clone()]) } - RotationOp::to_halfturns => Signature::new(rotation_type.clone(), float64_type()), + RotationOp::to_halfturns => Signature::new([rotation_type.clone()], [float64_type()]), RotationOp::radd => Signature::new( vec![rotation_type.clone(), rotation_type.clone()], - rotation_type, + [rotation_type], ), } .into() @@ -291,8 +291,8 @@ mod test { #[test] fn test_builder() { let mut builder = DFGBuilder::new(Signature::new( - rotation_type(), - vec![Type::from(option_type(rotation_type())), rotation_type()], + [rotation_type()], + [Type::from(option_type([rotation_type()])), rotation_type()], )) .unwrap(); diff --git a/tket/src/llvm/rotation.rs b/tket/src/llvm/rotation.rs index d11dc8e6f..6ae0311de 100644 --- a/tket/src/llvm/rotation.rs +++ b/tket/src/llvm/rotation.rs @@ -79,10 +79,11 @@ impl RotationCodegenExtension { let builder = context.builder(); // We must distinguish {NaNs, infinities} from finite - // values. The `llvm.is.fpclass` intrinsic was introduced in llvm 15 - // and is the best way to do so. For now we are using llvm - // 14, and so we use 3 `feq`s. - // Below is commented code that we can use once we support llvm 15. + // values. The `llvm.is.fpclass` intrinsic was introduced in LLVM15 + // and is the best way to do so. + // This was written when using LLVM14, so we used 3 `feq`s. + // + // TODO: We now use LLVM21. Update this accordingly. let half_turns_ok = { let is_pos_inf = builder.build_float_compare( FloatPredicate::OEQ, @@ -169,7 +170,7 @@ impl RotationCodegenExtension { self.emit_from_halfturns(context, half_turns.into_float_value())?; let builder = context.builder(); - let result_sum_type = ts.llvm_sum_type(option_type(rotation_type()))?; + let result_sum_type = ts.llvm_sum_type(option_type([rotation_type()]))?; let success = result_sum_type.build_tag(builder, 1, vec![half_turns.into()])?; let failure = result_sum_type.build_tag(builder, 0, vec![])?; let result = builder.build_select(half_turns_ok, success, failure, "")?; @@ -247,7 +248,7 @@ mod test { let [rot2] = { let mb_rot = builder.add_from_halfturns(half_turns).unwrap(); builder - .build_unwrap_sum(1, option_type(rotation_type()), mb_rot) + .build_unwrap_sum(1, option_type([rotation_type()]), mb_rot) .unwrap() }; let _ = builder @@ -273,7 +274,7 @@ mod test { #[case] expected_half_turns: f64, ) { let hugr = SimpleHugrConfig::new() - .with_outs(float64_type()) + .with_outs([float64_type()]) .finish(|mut builder| { let rot2 = builder.add_load_value(angle1); let rot1 = builder.add_load_value(angle2); @@ -309,7 +310,7 @@ mod test { #[case] expected_halfturns: f64, ) { let hugr = SimpleHugrConfig::new() - .with_outs(float64_type()) + .with_outs([float64_type()]) .finish(|mut builder| { let rot = builder.add_load_value(angle); let halfturns = builder.add_to_halfturns(rot).unwrap(); @@ -377,7 +378,7 @@ mod test { use hugr::ops::Value; let hugr = SimpleHugrConfig::new() - .with_outs(float64_type()) + .with_outs([float64_type()]) .finish(|mut builder| { let konst: Value = if halfturns.is_finite() { ConstF64::new(halfturns).into() diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_1.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap similarity index 87% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_1.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap index c912ce85f..d3fd9c9e7 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_1.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_2.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap similarity index 86% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_2.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap index fa15af65a..2e5dcc2ec 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_2.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_3.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap similarity index 87% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_3.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap index c2deefcc5..270a70277 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_3.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_4.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap similarity index 85% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_4.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap index 453322e35..241f4932b 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_4.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_5.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap similarity index 85% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_5.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap index 770cfbeba..a2e47e3e1 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_5.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_6.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap similarity index 85% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_6.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap index c3c4a25de..d5801c415 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_6.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_7.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap similarity index 85% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_7.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap index d84fd3203..a2ff1fc65 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm14_7.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: br label %entry_block diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_1.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_1.snap similarity index 58% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_1.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_1.snap index 433cb54fe..98441114b 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_1.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_1.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -13,12 +13,12 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 %1 = select i1 %"2_01", i1 true, i1 false - store i1 %1, i1* %"4_0", align 1 - %"4_02" = load i1, i1* %"4_0", align 1 - store i1 %"4_02", i1* %"0", align 1 - %"03" = load i1, i1* %"0", align 1 + store i1 %1, ptr %"4_0", align 1 + %"4_02" = load i1, ptr %"4_0", align 1 + store i1 %"4_02", ptr %"0", align 1 + %"03" = load i1, ptr %"0", align 1 ret i1 %"03" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_2.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_2.snap similarity index 55% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_2.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_2.snap index 45576b4c5..3537ec577 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_2.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_2.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -13,11 +13,11 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - store i1 %"2_01", i1* %"4_0", align 1 - %"4_02" = load i1, i1* %"4_0", align 1 - store i1 %"4_02", i1* %"0", align 1 - %"03" = load i1, i1* %"0", align 1 + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + store i1 %"2_01", ptr %"4_0", align 1 + %"4_02" = load i1, ptr %"4_0", align 1 + store i1 %"4_02", ptr %"0", align 1 + %"03" = load i1, ptr %"0", align 1 ret i1 %"03" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_3.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_3.snap similarity index 57% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_3.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_3.snap index 695c2e714..df4c08751 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_3.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -13,12 +13,12 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 + store i1 %0, ptr %"2_0", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 %1 = xor i1 %"2_01", true - store i1 %1, i1* %"4_0", align 1 - %"4_02" = load i1, i1* %"4_0", align 1 - store i1 %"4_02", i1* %"0", align 1 - %"03" = load i1, i1* %"0", align 1 + store i1 %1, ptr %"4_0", align 1 + %"4_02" = load i1, ptr %"4_0", align 1 + store i1 %"4_02", ptr %"0", align 1 + %"03" = load i1, ptr %"0", align 1 ret i1 %"03" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_4.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_4.snap similarity index 53% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_4.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_4.snap index e39424faa..11c16eb29 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_4.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_4.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -14,14 +14,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - store i1 %1, i1* %"2_1", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %"2_12" = load i1, i1* %"2_1", align 1 + store i1 %0, ptr %"2_0", align 1 + store i1 %1, ptr %"2_1", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %"2_12" = load i1, ptr %"2_1", align 1 %2 = and i1 %"2_01", %"2_12" - store i1 %2, i1* %"4_0", align 1 - %"4_03" = load i1, i1* %"4_0", align 1 - store i1 %"4_03", i1* %"0", align 1 - %"04" = load i1, i1* %"0", align 1 + store i1 %2, ptr %"4_0", align 1 + %"4_03" = load i1, ptr %"4_0", align 1 + store i1 %"4_03", ptr %"0", align 1 + %"04" = load i1, ptr %"0", align 1 ret i1 %"04" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_5.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_5.snap similarity index 53% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_5.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_5.snap index 15d2e00ce..848c4bca9 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_5.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -14,14 +14,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - store i1 %1, i1* %"2_1", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %"2_12" = load i1, i1* %"2_1", align 1 + store i1 %0, ptr %"2_0", align 1 + store i1 %1, ptr %"2_1", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %"2_12" = load i1, ptr %"2_1", align 1 %2 = or i1 %"2_01", %"2_12" - store i1 %2, i1* %"4_0", align 1 - %"4_03" = load i1, i1* %"4_0", align 1 - store i1 %"4_03", i1* %"0", align 1 - %"04" = load i1, i1* %"0", align 1 + store i1 %2, ptr %"4_0", align 1 + %"4_03" = load i1, ptr %"4_0", align 1 + store i1 %"4_03", ptr %"0", align 1 + %"04" = load i1, ptr %"0", align 1 ret i1 %"04" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_6.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_6.snap similarity index 53% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_6.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_6.snap index 55508dcd9..6bcb19853 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_6.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -14,14 +14,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - store i1 %1, i1* %"2_1", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %"2_12" = load i1, i1* %"2_1", align 1 + store i1 %0, ptr %"2_0", align 1 + store i1 %1, ptr %"2_1", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %"2_12" = load i1, ptr %"2_1", align 1 %2 = xor i1 %"2_01", %"2_12" - store i1 %2, i1* %"4_0", align 1 - %"4_03" = load i1, i1* %"4_0", align 1 - store i1 %"4_03", i1* %"0", align 1 - %"04" = load i1, i1* %"0", align 1 + store i1 %2, ptr %"4_0", align 1 + %"4_03" = load i1, ptr %"4_0", align 1 + store i1 %"4_03", ptr %"0", align 1 + %"04" = load i1, ptr %"0", align 1 ret i1 %"04" } diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_7.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_7.snap similarity index 53% rename from tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_7.snap rename to tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_7.snap index d35f142bc..ae9b27724 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm14_7.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_7.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define private i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -14,14 +14,14 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store i1 %0, i1* %"2_0", align 1 - store i1 %1, i1* %"2_1", align 1 - %"2_01" = load i1, i1* %"2_0", align 1 - %"2_12" = load i1, i1* %"2_1", align 1 + store i1 %0, ptr %"2_0", align 1 + store i1 %1, ptr %"2_1", align 1 + %"2_01" = load i1, ptr %"2_0", align 1 + %"2_12" = load i1, ptr %"2_1", align 1 %2 = icmp eq i1 %"2_01", %"2_12" - store i1 %2, i1* %"4_0", align 1 - %"4_03" = load i1, i1* %"4_0", align 1 - store i1 %"4_03", i1* %"0", align 1 - %"04" = load i1, i1* %"0", align 1 + store i1 %2, ptr %"4_0", align 1 + %"4_03" = load i1, ptr %"4_0", align 1 + store i1 %"4_03", ptr %"0", align 1 + %"04" = load i1, ptr %"0", align 1 ret i1 %"04" } diff --git a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm14_0.snap b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap similarity index 77% rename from tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm14_0.snap rename to tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap index db9966b73..5de56cca4 100644 --- a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm14_0.snap +++ b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap @@ -10,7 +10,7 @@ source_filename = "test_context" @1 = private unnamed_addr constant [37 x i8] c"Expected variant 1 but got variant 0\00", align 1 @prelude.panic_template.1 = private unnamed_addr constant [34 x i8] c"Program panicked (signal %i): %s\0A\00", align 1 -define private void @_hl.main.1(double %0) { +define internal void @_hl.main.1(double %0) { alloca_block: br label %entry_block @@ -24,7 +24,7 @@ entry_block: ; preds = %alloca_block br i1 %6, label %9, label %7 7: ; preds = %entry_block - %8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template, i32 0, i32 0), i32 1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @0, i32 0, i32 0)) + %8 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0) call void @abort() unreachable @@ -50,9 +50,9 @@ entry_block: ; preds = %alloca_block br label %cond_7_case_1 cond_7_case_0: ; preds = %19 - %22 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 0 - %23 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 1 - %24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %22, i8* %23) + %22 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 0 + %23 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 1 + %24 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %22, ptr %23) call void @abort() br label %cond_exit_7 @@ -65,6 +65,6 @@ cond_exit_7: ; preds = %cond_7_case_1, %con ret void } -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) declare void @abort() diff --git a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm14_0.snap b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_0.snap similarity index 58% rename from tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm14_0.snap rename to tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_0.snap index 91f3a294f..7814e640f 100644 --- a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm14_0.snap +++ b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_0.snap @@ -10,7 +10,7 @@ source_filename = "test_context" @1 = private unnamed_addr constant [37 x i8] c"Expected variant 1 but got variant 0\00", align 1 @prelude.panic_template.1 = private unnamed_addr constant [34 x i8] c"Program panicked (signal %i): %s\0A\00", align 1 -define private void @_hl.main.1(double %0) { +define internal void @_hl.main.1(double %0) { alloca_block: %"2_0" = alloca double, align 8 %"4_0" = alloca double, align 8 @@ -18,7 +18,7 @@ alloca_block: %"6_0" = alloca { i1, double }, align 8 %"7_0" = alloca double, align 8 %"0" = alloca double, align 8 - %"12_0" = alloca { i32, i8* }, align 8 + %"12_0" = alloca { i32, ptr }, align 8 %"13_0" = alloca double, align 8 %"08" = alloca double, align 8 %"15_0" = alloca double, align 8 @@ -26,8 +26,8 @@ alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - store double %0, double* %"2_0", align 8 - %"2_01" = load double, double* %"2_0", align 8 + store double %0, ptr %"2_0", align 8 + %"2_01" = load double, ptr %"2_0", align 8 %1 = fcmp oeq double %"2_01", 0x7FF0000000000000 %2 = fcmp oeq double %"2_01", 0xFFF0000000000000 %3 = fcmp uno double %"2_01", 0.000000e+00 @@ -37,15 +37,15 @@ entry_block: ; preds = %alloca_block br i1 %6, label %9, label %7 7: ; preds = %entry_block - %8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template, i32 0, i32 0), i32 1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @0, i32 0, i32 0)) + %8 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0) call void @abort() unreachable 9: ; preds = %entry_block - store double %"2_01", double* %"4_0", align 8 - %"4_02" = load double, double* %"4_0", align 8 - store double %"4_02", double* %"5_0", align 8 - %"5_03" = load double, double* %"5_0", align 8 + store double %"2_01", ptr %"4_0", align 8 + %"4_02" = load double, ptr %"4_0", align 8 + store double %"4_02", ptr %"5_0", align 8 + %"5_03" = load double, ptr %"5_0", align 8 %10 = fcmp oeq double %"5_03", 0x7FF0000000000000 %11 = fcmp oeq double %"5_03", 0xFFF0000000000000 %12 = fcmp uno double %"5_03", 0.000000e+00 @@ -54,8 +54,8 @@ entry_block: ; preds = %alloca_block %15 = xor i1 %14, true %16 = insertvalue { i1, double } { i1 true, double poison }, double %"5_03", 1 %17 = select i1 %15, { i1, double } %16, { i1, double } { i1 false, double poison } - store { i1, double } %17, { i1, double }* %"6_0", align 8 - %"6_04" = load { i1, double }, { i1, double }* %"6_0", align 8 + store { i1, double } %17, ptr %"6_0", align 8 + %"6_04" = load { i1, double }, ptr %"6_0", align 8 %18 = extractvalue { i1, double } %"6_04", 0 switch i1 %18, label %19 [ i1 true, label %20 @@ -66,38 +66,38 @@ entry_block: ; preds = %alloca_block 20: ; preds = %9 %21 = extractvalue { i1, double } %"6_04", 1 - store double %21, double* %"08", align 8 + store double %21, ptr %"08", align 8 br label %cond_7_case_1 cond_7_case_0: ; preds = %19 - store { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, { i32, i8* }* %"12_0", align 8 - %"12_06" = load { i32, i8* }, { i32, i8* }* %"12_0", align 8 - %22 = extractvalue { i32, i8* } %"12_06", 0 - %23 = extractvalue { i32, i8* } %"12_06", 1 - %24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %22, i8* %23) + store { i32, ptr } { i32 1, ptr @1 }, ptr %"12_0", align 8 + %"12_06" = load { i32, ptr }, ptr %"12_0", align 8 + %22 = extractvalue { i32, ptr } %"12_06", 0 + %23 = extractvalue { i32, ptr } %"12_06", 1 + %24 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %22, ptr %23) call void @abort() - store double 0.000000e+00, double* %"13_0", align 8 - %"13_07" = load double, double* %"13_0", align 8 - store double %"13_07", double* %"0", align 8 + store double 0.000000e+00, ptr %"13_0", align 8 + %"13_07" = load double, ptr %"13_0", align 8 + store double %"13_07", ptr %"0", align 8 br label %cond_exit_7 cond_7_case_1: ; preds = %20 - %"09" = load double, double* %"08", align 8 - store double %"09", double* %"15_0", align 8 - %"15_010" = load double, double* %"15_0", align 8 - store double %"15_010", double* %"0", align 8 + %"09" = load double, ptr %"08", align 8 + store double %"09", ptr %"15_0", align 8 + %"15_010" = load double, ptr %"15_0", align 8 + store double %"15_010", ptr %"0", align 8 br label %cond_exit_7 cond_exit_7: ; preds = %cond_7_case_1, %cond_7_case_0 - %"05" = load double, double* %"0", align 8 - store double %"05", double* %"7_0", align 8 - %"4_011" = load double, double* %"4_0", align 8 - %"7_012" = load double, double* %"7_0", align 8 + %"05" = load double, ptr %"0", align 8 + store double %"05", ptr %"7_0", align 8 + %"4_011" = load double, ptr %"4_0", align 8 + %"7_012" = load double, ptr %"7_0", align 8 %25 = fadd double %"4_011", %"7_012" - store double %25, double* %"17_0", align 8 + store double %25, ptr %"17_0", align 8 ret void } -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) declare void @abort() diff --git a/tket/src/modifier/control.rs b/tket/src/modifier/control.rs index cdaf9bf17..02f495588 100644 --- a/tket/src/modifier/control.rs +++ b/tket/src/modifier/control.rs @@ -32,14 +32,14 @@ impl ModifierControl { TypeParam::new_list_type(TypeBound::Linear), ], FuncValueType::new( - TypeRV::new_function(FuncValueType::new( + [TypeRV::new_function(FuncValueType::new( vec![ TypeRV::new_row_var_use(1, TypeBound::Linear), TypeRV::new_row_var_use(2, TypeBound::Linear), ], vec![TypeRV::new_row_var_use(1, TypeBound::Linear)], - )), - TypeRV::new_function(FuncValueType::new( + ))], + [TypeRV::new_function(FuncValueType::new( vec![ array_type_parametric( TypeArg::new_var_use(0, TypeParam::max_nat_type()), @@ -59,7 +59,7 @@ impl ModifierControl { .into(), TypeRV::new_row_var_use(1, TypeBound::Linear), ], - )), + ))], ), ) .into() diff --git a/tket/src/modifier/dagger.rs b/tket/src/modifier/dagger.rs index e7b886969..d4e27b425 100644 --- a/tket/src/modifier/dagger.rs +++ b/tket/src/modifier/dagger.rs @@ -41,20 +41,20 @@ impl ModifierDagger { TypeParam::new_list_type(TypeBound::Linear), ], FuncValueType::new( - TypeRV::new_function(FuncValueType::new( + [TypeRV::new_function(FuncValueType::new( vec![ TypeRV::new_row_var_use(0, TypeBound::Linear), TypeRV::new_row_var_use(1, TypeBound::Linear), ], vec![TypeRV::new_row_var_use(0, TypeBound::Linear)], - )), - TypeRV::new_function(FuncValueType::new( + ))], + [TypeRV::new_function(FuncValueType::new( vec![ TypeRV::new_row_var_use(0, TypeBound::Linear), TypeRV::new_row_var_use(1, TypeBound::Linear), ], - TypeRV::new_row_var_use(0, TypeBound::Linear), - )), + [TypeRV::new_row_var_use(0, TypeBound::Linear)], + ))], ), ) .into() diff --git a/tket/src/modifier/modifier_resolver/dfg_modify.rs b/tket/src/modifier/modifier_resolver/dfg_modify.rs index cf6ba3e20..b3a553210 100644 --- a/tket/src/modifier/modifier_resolver/dfg_modify.rs +++ b/tket/src/modifier/modifier_resolver/dfg_modify.rs @@ -701,7 +701,7 @@ mod test { .unwrap() .out_wire(0); let sum_just_input = builder - .make_sum(0, vec![rotation_type().into(), type_row![]], vec![angle]) + .make_sum(0, vec![[rotation_type()].into(), type_row![]], vec![angle]) .unwrap(); let outputs = [rotated].into_iter().chain(inputs); builder @@ -770,10 +770,12 @@ mod test { let cfg = { let mut cfg = func - .cfg_builder(vec![(qb_t(), inputs[0])], qb_t().into()) + .cfg_builder(vec![(qb_t(), inputs[0])], [qb_t()].into()) .unwrap(); let bb = { - let mut bb = cfg.entry_builder(vec![type_row![]], qb_t().into()).unwrap(); + let mut bb = cfg + .entry_builder(vec![type_row![]], [qb_t()].into()) + .unwrap(); let mut inputs: Vec<_> = bb.input_wires().collect(); inputs[0] = bb .add_dataflow_op(TketOp::X, vec![inputs[0]]) diff --git a/tket/src/modifier/pass.rs b/tket/src/modifier/pass.rs index a4776c15e..69828c6ed 100644 --- a/tket/src/modifier/pass.rs +++ b/tket/src/modifier/pass.rs @@ -1,7 +1,8 @@ //! Pass to resolve modifiers (control/dagger/power) in a Hugr. -use hugr::algorithms::ComposablePass; use hugr::hugr::hugrmut::HugrMut; use hugr::{HugrView, Node}; +use hugr_passes::ComposablePass; +use hugr_passes::composable::WithScope; use crate::modifier::modifier_resolver::ModifierResolverErrors; @@ -11,6 +12,14 @@ use super::modifier_resolver::resolve_modifier_with_entrypoints; #[derive(Default)] pub struct ModifierResolverPass; +impl WithScope for ModifierResolverPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for ModifierResolverPass { type Error = ModifierResolverErrors; diff --git a/tket/src/modifier/power.rs b/tket/src/modifier/power.rs index 16fcd679a..c16d1ecfa 100644 --- a/tket/src/modifier/power.rs +++ b/tket/src/modifier/power.rs @@ -53,13 +53,13 @@ impl ModifierPower { )), int_type(6).into(), ], - TypeRV::new_function(FuncValueType::new( + [TypeRV::new_function(FuncValueType::new( vec![ TypeRV::new_row_var_use(0, TypeBound::Linear), TypeRV::new_row_var_use(1, TypeBound::Copyable), ], - TypeRV::new_row_var_use(0, TypeBound::Linear), - )), + [TypeRV::new_row_var_use(0, TypeBound::Linear)], + ))], ), ) .into() diff --git a/tket/src/ops.rs b/tket/src/ops.rs index a9b5c88f9..8e3b9b46f 100644 --- a/tket/src/ops.rs +++ b/tket/src/ops.rs @@ -273,16 +273,16 @@ impl MakeOpDef for TketOp { fn init_signature(&self, _extension_ref: &std::sync::Weak) -> SignatureFunc { use TketOp::*; match self { - H | T | S | V | X | Y | Z | Tdg | Sdg | Vdg | Reset => Signature::new_endo(qb_t()), + H | T | S | V | X | Y | Z | Tdg | Sdg | Vdg | Reset => Signature::new_endo([qb_t()]), CX | CZ | CY => Signature::new_endo(vec![qb_t(); 2]), Toffoli => Signature::new_endo(vec![qb_t(); 3]), - Measure => Signature::new(qb_t(), vec![qb_t(), bool_t()]), - MeasureFree => Signature::new(qb_t(), bool_type()), - Rz | Rx | Ry => Signature::new(vec![qb_t(), rotation_type()], qb_t()), + Measure => Signature::new([qb_t()], vec![qb_t(), bool_t()]), + MeasureFree => Signature::new([qb_t()], [bool_type()]), + Rz | Rx | Ry => Signature::new(vec![qb_t(), rotation_type()], [qb_t()]), CRz => Signature::new(vec![qb_t(), qb_t(), rotation_type()], vec![qb_t(); 2]), - QAlloc => Signature::new(type_row![], qb_t()), - TryQAlloc => Signature::new(type_row![], Type::from(option_type(qb_t()))), - QFree => Signature::new(qb_t(), type_row![]), + QAlloc => Signature::new(type_row![], [qb_t()]), + TryQAlloc => Signature::new(type_row![], [Type::from(option_type([qb_t()]))]), + QFree => Signature::new([qb_t()], type_row![]), } .into() } @@ -422,13 +422,13 @@ pub(crate) mod test { #[test] fn try_qalloc_measure_free() { - let mut b = DFGBuilder::new(Signature::new(type_row![], bool_type())).unwrap(); + let mut b = DFGBuilder::new(Signature::new(type_row![], [bool_type()])).unwrap(); let try_q = b .add_dataflow_op(TketOp::TryQAlloc, []) .unwrap() .out_wire(0); - let [q] = b.build_unwrap_sum(1, option_type(qb_t()), try_q).unwrap(); + let [q] = b.build_unwrap_sum(1, option_type([qb_t()]), try_q).unwrap(); let measured = b .add_dataflow_op(TketOp::MeasureFree, [q]) .unwrap() diff --git a/tket/src/passes/borrow_squash.rs b/tket/src/passes/borrow_squash.rs index d6ddd110d..10130bfc5 100644 --- a/tket/src/passes/borrow_squash.rs +++ b/tket/src/passes/borrow_squash.rs @@ -1,7 +1,6 @@ //! Elide pairs of return-borrow operations on a `BorrowArray` where possible. use derive_more::{Display, Error}; -use hugr::algorithms::ComposablePass; use hugr::extension::prelude::ConstUsize; use hugr::extension::simple_op::MakeExtensionOp; use hugr::hugr::hugrmut::HugrMut; @@ -10,6 +9,8 @@ use hugr::std_extensions::arithmetic::int_types::ConstInt; use hugr::std_extensions::collections::borrow_array::{BArrayUnsafeOpDef, BORROW_ARRAY_TYPENAME}; use hugr::types::{EdgeKind, Type}; use hugr::{HugrView, IncomingPort, Node, OutgoingPort, Wire}; +use hugr_passes::ComposablePass; +use hugr_passes::composable::WithScope; use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet, VecDeque}; @@ -37,6 +38,14 @@ impl BorrowSquashPass { } } +impl WithScope for BorrowSquashPass { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl> ComposablePass for BorrowSquashPass { type Error = BorrowSquashError; /// Pairs of (Return node, Borrow node) that were elided. @@ -47,7 +56,7 @@ impl> ComposablePass for BorrowSquashPass { /// Note it is recommended to run [ConstantFoldPass] first to make as many indices /// constant as possible. /// - /// [ConstantFoldPass]: hugr::algorithms::const_fold::ConstantFoldPass + /// [ConstantFoldPass]: hugr_passes::const_fold::ConstantFoldPass fn run(&self, hugr: &mut H) -> Result, BorrowSquashError> { let mut temp = Vec::new(); // to keep alive let regions = self.regions.as_ref().unwrap_or_else(|| { @@ -366,28 +375,24 @@ mod test { use super::{BorrowSquashPass, find_const}; use crate::extension::REGISTRY; - use hugr::{ - Hugr, HugrView, - algorithms::{ComposablePass, const_fold::ConstantFoldPass}, - builder::{DFGBuilder, Dataflow, DataflowHugr, FunctionBuilder, endo_sig}, - extension::{ - prelude::{ConstUsize, qb_t, usize_t}, - simple_op::MakeExtensionOp, - }, - hugr::hugrmut::HugrMut, - ops::{OpTrait, handle::NodeHandle}, - std_extensions::collections::{ - array::ArrayKind, - borrow_array::{BArrayOpBuilder, BArrayUnsafeOpDef, BorrowArray}, - }, - types::Signature, + use hugr::builder::{DFGBuilder, Dataflow, DataflowHugr, FunctionBuilder, endo_sig}; + use hugr::extension::prelude::{ConstUsize, qb_t, usize_t}; + use hugr::extension::simple_op::MakeExtensionOp; + use hugr::hugr::hugrmut::HugrMut; + use hugr::ops::{OpTrait, handle::NodeHandle}; + use hugr::std_extensions::collections::{ + array::ArrayKind, + borrow_array::{BArrayOpBuilder, BArrayUnsafeOpDef, BorrowArray}, }; + use hugr::types::Signature; + use hugr::{Hugr, HugrView}; + use hugr_passes::{ComposablePass, const_fold::ConstantFoldPass}; use itertools::Itertools; use rstest::{fixture, rstest}; #[rstest] fn simple() { - let mut dfb = DFGBuilder::new(endo_sig(BorrowArray::ty(3, qb_t()))).unwrap(); + let mut dfb = DFGBuilder::new(endo_sig([BorrowArray::ty(3, qb_t())])).unwrap(); let [arr] = dfb.input_wires_arr(); let idx = dfb.add_load_value(ConstUsize::new(1)); let (arr, q) = dfb.add_borrow_array_borrow(qb_t(), 3, arr, idx).unwrap(); diff --git a/tket/src/passes/guppy.rs b/tket/src/passes/guppy.rs index 3847b54a3..c87a8064b 100644 --- a/tket/src/passes/guppy.rs +++ b/tket/src/passes/guppy.rs @@ -1,15 +1,16 @@ //! A pass that normalizes the structure of Guppy-generated circuits into something that can be optimized by tket. use hugr::Node; -use hugr::algorithms::const_fold::{ConstFoldError, ConstantFoldPass}; -use hugr::algorithms::inline_dfgs::InlineDFGsPass; -use hugr::algorithms::normalize_cfgs::{NormalizeCFGError, NormalizeCFGPass}; -use hugr::algorithms::redundant_order_edges::RedundantOrderEdgesPass; -use hugr::algorithms::untuple::UntupleError; -use hugr::algorithms::{ComposablePass, RemoveDeadFuncsError, RemoveDeadFuncsPass, UntuplePass}; use hugr::hugr::HugrError; use hugr::hugr::hugrmut::HugrMut; use hugr::hugr::patch::inline_dfg::InlineDFGError; +use hugr_passes::composable::WithScope; +use hugr_passes::const_fold::{ConstFoldError, ConstantFoldPass}; +use hugr_passes::inline_dfgs::InlineDFGsPass; +use hugr_passes::normalize_cfgs::{NormalizeCFGError, NormalizeCFGPass}; +use hugr_passes::redundant_order_edges::RedundantOrderEdgesPass; +use hugr_passes::untuple::UntupleError; +use hugr_passes::{ComposablePass, RemoveDeadFuncsError, RemoveDeadFuncsPass, UntuplePass}; use crate::passes::BorrowSquashPass; @@ -86,6 +87,14 @@ impl Default for NormalizeGuppy { } } +impl WithScope for NormalizeGuppy { + fn with_scope(self, _scope: impl Into) -> Self { + // TODO: Follow scope configuration + // + self + } +} + impl + 'static> ComposablePass for NormalizeGuppy { type Error = NormalizeGuppyErrors; type Result = (); @@ -95,9 +104,7 @@ impl + 'static> ComposablePass for NormalizeGuppy { } // When we do function inlining, do this after, to sort out argument marshalling if self.untuple { - #[expect(deprecated)] - // Will move to pass scopes in - UntuplePass::new(hugr::algorithms::untuple::UntupleRecursive::Recursive).run(hugr)?; + UntuplePass::default().run(hugr)?; } // Should propagate through untuple, so could do earlier, and must be before BorrowSquash if self.constant_fold { @@ -110,7 +117,9 @@ impl + 'static> ComposablePass for NormalizeGuppy { } // Do earlier? Nothing creates DFGs if self.inline_dfgs { - InlineDFGsPass.run(hugr).unwrap_or_else(|e| match e {}) + InlineDFGsPass::default() + .run(hugr) + .unwrap_or_else(|e| match e {}) } // Potentially, could (need to) do fixpoint here with untuple, // as both create opportunities for the other @@ -122,7 +131,6 @@ impl + 'static> ComposablePass for NormalizeGuppy { // Remove redundant order edges once all other structural rewrites have been applied. if self.remove_redundant_order_edges { RedundantOrderEdgesPass::default() - .recursive(true) .run(hugr) .map_err(NormalizeGuppyErrors::RedundantOrderEdges)?; } diff --git a/tket/src/passes/unpack_container.rs b/tket/src/passes/unpack_container.rs index c8f5950fe..50d934205 100644 --- a/tket/src/passes/unpack_container.rs +++ b/tket/src/passes/unpack_container.rs @@ -41,12 +41,12 @@ fn generic_array_unpack_sig() -> PolyFuncTypeRV { TypeParam::new_list_type(TypeBound::Linear), ], FuncValueType::new( - AK::ty_parametric( + [AK::ty_parametric( TypeArg::new_var_use(0, TypeParam::max_nat_type()), Type::new_var_use(1, TypeBound::Linear), ) - .unwrap(), - TypeRV::new_row_var_use(2, TypeBound::Linear), + .unwrap()], + [TypeRV::new_row_var_use(2, TypeBound::Linear)], ), ) } @@ -95,10 +95,10 @@ static TEMP_UNPACK_EXT: LazyLock> = LazyLock::new(|| { vec![TypeParam::RuntimeType(TypeBound::Linear)], FuncValueType::new( hugr::types::TypeRow::from(vec![Type::from( - hugr::extension::prelude::option_type(Type::new_var_use( + hugr::extension::prelude::option_type([Type::new_var_use( 0, TypeBound::Linear, - )), + )]), )]), hugr::types::TypeRow::from(vec![Type::new_var_use(0, TypeBound::Linear)]), ), @@ -127,8 +127,11 @@ static TEMP_UNPACK_EXT: LazyLock> = LazyLock::new(|| { TypeParam::new_list_type(TypeBound::Linear), ], FuncValueType::new( - Type::new_tuple(TypeRV::new_row_var_use(0, TypeBound::Linear)), - TypeRV::new_row_var_use(1, TypeBound::Linear), + [Type::new_tuple([TypeRV::new_row_var_use( + 0, + TypeBound::Linear, + )])], + [TypeRV::new_row_var_use(1, TypeBound::Linear)], ), ); // pack some wires into a tuple @@ -196,7 +199,7 @@ impl UnpackContainerBuilder { .insert_with(&op, &[elem_ty.clone().into()], |func_b| { let [in_wire] = func_b.input_wires_arr(); let [out_wire] = - func_b.build_expect_sum(1, option_type(elem_ty.clone()), in_wire, |_| { + func_b.build_expect_sum(1, option_type([elem_ty.clone()]), in_wire, |_| { format!("Value of type Option<{elem_ty}> is None so cannot unpack.") })?; Ok(vec![out_wire]) @@ -559,7 +562,7 @@ mod tests { fn test_option_unwrap_wrap() -> Result<(), BuildError> { let analyzer = TypeUnpacker::for_qubits(); let factory = UnpackContainerBuilder::new(analyzer); - let option_qb_type = Type::from(option_type(qb_t())); + let option_qb_type = Type::from(option_type([qb_t()])); let mut builder = DFGBuilder::new(Signature::new_endo(vec![option_qb_type]))?; let input = builder.input().out_wire(0); @@ -587,7 +590,7 @@ mod tests { let array_type = AK::ty(array_size, qb_t()); // Build a dataflow graph that unpacks and repacks the array - let mut builder = DFGBuilder::new(Signature::new_endo(array_type))?; + let mut builder = DFGBuilder::new(Signature::new_endo([array_type]))?; let input = builder.input().out_wire(0); // Unpack the array @@ -611,7 +614,7 @@ mod tests { let tuple_row = vec![qb_t(), bool_t()]; let tuple_type = Type::new_tuple(tuple_row.clone()); - let mut builder = DFGBuilder::new(Signature::new_endo(tuple_type))?; + let mut builder = DFGBuilder::new(Signature::new_endo([tuple_type]))?; let input = builder.input().out_wire(0); let unpacked = factory.unpack_tuple(&mut builder, input, &tuple_row)?; diff --git a/tket/src/passes/unpack_container/op_function_map.rs b/tket/src/passes/unpack_container/op_function_map.rs index b1c063fd0..6215d46be 100644 --- a/tket/src/passes/unpack_container/op_function_map.rs +++ b/tket/src/passes/unpack_container/op_function_map.rs @@ -6,7 +6,6 @@ use hugr::hugr::linking::OnMultiDefn; use hugr::ops::handle::{FuncID, NodeHandle}; use hugr::{ Hugr, Node, Wire, - algorithms::{ReplaceTypes, mangle_name, replace_types::NodeTemplate}, builder::{BuildError, DataflowHugr, FunctionBuilder}, hugr::hugrmut::HugrMut, ops::{DataflowOpTrait, ExtensionOp}, @@ -14,6 +13,7 @@ use hugr::{ }; use hugr_core::Visibility; use hugr_core::hugr::linking::NameLinkingPolicy; +use hugr_passes::{ReplaceTypes, mangle_name, replace_types::NodeTemplate}; use indexmap::IndexMap; use std::{cell::RefCell, ops::Deref}; diff --git a/tket/src/passes/unpack_container/type_unpack.rs b/tket/src/passes/unpack_container/type_unpack.rs index 75c39db0d..dd4df4526 100644 --- a/tket/src/passes/unpack_container/type_unpack.rs +++ b/tket/src/passes/unpack_container/type_unpack.rs @@ -213,11 +213,11 @@ mod test { let analyzer = TypeUnpacker::for_qubits(); // Option by itself should NOT be a container - let opt_qubit = option_type(qb_t()).into(); + let opt_qubit = option_type([qb_t()]).into(); assert!(!analyzer.contains_element_type(&opt_qubit)); // Array of Option should be a special case (a container with that many qubits) - let opt_qubit_array = array_type(4, option_type(qb_t()).into()); + let opt_qubit_array = array_type(4, option_type([qb_t()]).into()); let result = analyzer.unpack_type(&opt_qubit_array); let types = result.unwrap(); @@ -225,7 +225,7 @@ mod test { assert!(types.iter().all(|t| t == &qb_t())); // Option of non-quantum types should not be a container - let opt_bool = option_type(bool_t()).into(); + let opt_bool = option_type([bool_t()]).into(); assert!(!analyzer.contains_element_type(&opt_bool)); } @@ -291,7 +291,7 @@ mod test { bool_t(), array_type( 2, - Type::new_tuple(vec![qb_t(), array_type(3, option_type(qb_t()).into())]), + Type::new_tuple(vec![qb_t(), array_type(3, option_type([qb_t()]).into())]), ), qb_t(), ]); diff --git a/tket/src/serialize/pytket/config/encoder_config.rs b/tket/src/serialize/pytket/config/encoder_config.rs index 04e54bb16..6d5fa45ac 100644 --- a/tket/src/serialize/pytket/config/encoder_config.rs +++ b/tket/src/serialize/pytket/config/encoder_config.rs @@ -153,7 +153,6 @@ impl PytketEncoderConfig { return Ok(None); } } - _ => return Ok(None), } } Ok(Some(values)) diff --git a/tket/src/serialize/pytket/tests.rs b/tket/src/serialize/pytket/tests.rs index d3bbc436c..135e55a21 100644 --- a/tket/src/serialize/pytket/tests.rs +++ b/tket/src/serialize/pytket/tests.rs @@ -356,7 +356,9 @@ fn circ_unsupported_subtree() -> Hugr { .add_dataflow_op(TketOp::TryQAlloc, []) .unwrap() .outputs_arr(); - let [q] = h.build_unwrap_sum(1, option_type(qb_t()), maybe_q).unwrap(); + let [q] = h + .build_unwrap_sum(1, option_type([qb_t()]), maybe_q) + .unwrap(); h.finish_hugr_with_outputs([q]).unwrap() } @@ -608,7 +610,7 @@ fn circ_nested_dfgs() -> Hugr { // A circuit with some simple circuit and an unsupported subgraph that does not interact with it. #[fixture] fn circ_independent_subgraph() -> Hugr { - let input_t = vec![qb_t(), qb_t(), option_type(bool_t()).into()]; + let input_t = vec![qb_t(), qb_t(), option_type([bool_t()]).into()]; let output_t = vec![qb_t(), qb_t(), bool_t()]; let mut h = FunctionBuilder::new("independent_subgraph", Signature::new(input_t, output_t)).unwrap(); @@ -620,7 +622,7 @@ fn circ_independent_subgraph() -> Hugr { .unwrap() .outputs_arr(); let [maybe_b] = h - .build_unwrap_sum(1, option_type(bool_t()), maybe_b) + .build_unwrap_sum(1, option_type([bool_t()]), maybe_b) .unwrap(); h.finish_hugr_with_outputs([q1, q2, maybe_b]).unwrap() @@ -629,8 +631,8 @@ fn circ_independent_subgraph() -> Hugr { // A circuit with an unsupported wire from the input to the output. #[fixture] fn circ_unsupported_io_wire() -> Hugr { - let input_t = vec![qb_t(), qb_t(), option_type(qb_t()).into()]; - let output_t = vec![qb_t(), qb_t(), option_type(qb_t()).into()]; + let input_t = vec![qb_t(), qb_t(), option_type([qb_t()]).into()]; + let output_t = vec![qb_t(), qb_t(), option_type([qb_t()]).into()]; let mut h = FunctionBuilder::new( "unsupported_input_to_output", Signature::new(input_t, output_t), @@ -695,8 +697,8 @@ fn circ_bool_conversion() -> Hugr { /// (see `EncodedCircuitInfo`), for a nested circuit in a CircBox. #[fixture] fn circ_unsupported_extras_in_circ_box() -> Hugr { - let input_t = vec![option_type(bool_t()).into(), option_type(qb_t()).into()]; - let output_t = vec![bool_t(), option_type(qb_t()).into()]; + let input_t = vec![option_type([bool_t()]).into(), option_type([qb_t()]).into()]; + let output_t = vec![bool_t(), option_type([qb_t()]).into()]; let mut h = FunctionBuilder::new( "unsupported_extras_in_circ_box", Signature::new(input_t.clone(), output_t.clone()), @@ -712,7 +714,7 @@ fn circ_unsupported_extras_in_circ_box() -> Hugr { let [maybe_b, maybe_q] = nested.input_wires_arr(); let [maybe_b] = nested - .build_unwrap_sum(1, option_type(bool_t()), maybe_b) + .build_unwrap_sum(1, option_type([bool_t()]), maybe_b) .unwrap(); nested