diff --git a/Cargo.lock b/Cargo.lock index 0a2f62a3e..885becb2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.10.5", "log", "prettyplease", "proc-macro2", @@ -238,9 +238,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "bitmaps" @@ -321,9 +321,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "capnp" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c82ec25a9501d60e22eef4be1b2c271769b5a96e224d0875baef28529cf30" +checksum = "63da65e5e9ffc3b8f993d4ad222a548152549351a643f6b850a7773cb6ff2809" dependencies = [ "embedded-io", ] @@ -355,9 +355,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.59" +version = "1.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7a4d3ec6524d28a329fc53654bbadc9bdd7b0431f5d65f1a56ffb28a1ee5283" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" dependencies = [ "find-msvc-tools", "jobserver", @@ -397,6 +397,17 @@ dependencies = [ "serde", ] +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + [[package]] name = "chrono" version = "0.4.44" @@ -451,9 +462,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.6.0" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -483,9 +494,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.6.0" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", @@ -593,6 +604,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "criterion" version = "0.8.2" @@ -924,9 +944,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "find-msvc-tools" @@ -1046,6 +1066,7 @@ dependencies = [ "cfg-if", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", "wasip2", "wasip3", ] @@ -1129,8 +1150,7 @@ dependencies = [ [[package]] name = "hugr" version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c016d3b51aa136190cd5ff125a96ec32a94e0f2a736a3a668bfe084ec9d9a9e" +source = "git+https://github.com/quantinuum/hugr?branch=george%2Fdebuginfo#4ebb9b8e2e4cdbc62117c65f86ca26bbc145350e" dependencies = [ "hugr-core", "hugr-llvm", @@ -1140,8 +1160,7 @@ dependencies = [ [[package]] name = "hugr-cli" version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6f210455279ec319e42263cb1d9890295cd5a53fdc2f1f34cf4f6901453377" +source = "git+https://github.com/quantinuum/hugr?branch=george%2Fdebuginfo#4ebb9b8e2e4cdbc62117c65f86ca26bbc145350e" dependencies = [ "anyhow", "clap", @@ -1161,8 +1180,7 @@ dependencies = [ [[package]] name = "hugr-core" version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827c0827ea0e1f6c606a17ba9926d3867b008d975688a6d4357d5847eb5826e5" +source = "git+https://github.com/quantinuum/hugr?branch=george%2Fdebuginfo#4ebb9b8e2e4cdbc62117c65f86ca26bbc145350e" dependencies = [ "base64", "cgmath", @@ -1177,7 +1195,7 @@ dependencies = [ "ordered-float", "pastey", "petgraph 0.8.3", - "portgraph 0.16.0", + "portgraph 0.16.1", "regex", "relrc", "rustc-hash 2.1.2", @@ -1199,8 +1217,7 @@ dependencies = [ [[package]] name = "hugr-llvm" version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aac6e08f12883f1d69c1f145c70251e755dde89821719741193c1f51259a59e" +source = "git+https://github.com/quantinuum/hugr?branch=george%2Fdebuginfo#4ebb9b8e2e4cdbc62117c65f86ca26bbc145350e" dependencies = [ "anyhow", "cc", @@ -1211,7 +1228,8 @@ dependencies = [ "insta", "itertools 0.14.0", "petgraph 0.8.3", - "portgraph 0.16.0", + "portgraph 0.16.1", + "rand 0.10.1", "rstest", "strum", ] @@ -1219,8 +1237,7 @@ dependencies = [ [[package]] name = "hugr-model" version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7878f4cb16c1f8d69ea9e832ff77694d9647aa5b963cb242b10969550b2d6e08" +source = "git+https://github.com/quantinuum/hugr?branch=george%2Fdebuginfo#4ebb9b8e2e4cdbc62117c65f86ca26bbc145350e" dependencies = [ "base64", "bumpalo", @@ -1433,9 +1450,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.93" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "797146bb2677299a1eb6b7b50a890f4c361b29ef967addf5b2fa45dae1bb6d7d" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" dependencies = [ "once_cell", "wasm-bindgen", @@ -1455,9 +1472,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.184" +version = "0.2.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" [[package]] name = "libloading" @@ -1477,9 +1494,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "llvm-sys" -version = "211.0.0" +version = "211.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "108b3ad2b2eaf2a561fc74196273b20e3436e4a688b8b44e250d83974dc1b2e2" +checksum = "44007a7a44b73bdd877fa9c9ccef256036511220e90f65b4d50e7a15773c0ee3" dependencies = [ "anyhow", "cc", @@ -1744,9 +1761,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "plotters" @@ -1798,9 +1815,9 @@ dependencies = [ [[package]] name = "portgraph" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d6244193810d114467998a979f0f763e5422ea546586d309fb70a68c036fb5" +checksum = "6a1395575e261a0c0dd2d360ac4e3b14a4c9f68647ee12e59d96af959e4c0f79" dependencies = [ "bitvec", "delegate 0.13.5", @@ -1926,7 +1943,7 @@ dependencies = [ "bit-vec", "bitflags", "num-traits", - "rand 0.9.2", + "rand 0.9.4", "rand_chacha", "rand_xorshift", "regex-syntax", @@ -2059,14 +2076,25 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" dependencies = [ "rand_chacha", "rand_core 0.9.5", ] +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + [[package]] name = "rand_chacha" version = "0.9.0" @@ -2095,6 +2123,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "rand_xorshift" version = "0.4.0" @@ -2115,9 +2149,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" dependencies = [ "either", "rayon-core", @@ -2213,7 +2247,7 @@ dependencies = [ "derive_more 0.99.20", "fxhash", "itertools 0.13.0", - "petgraph 0.8.3", + "petgraph 0.6.5", "serde", "slotmap_fork_lmondada", "thiserror 1.0.69", @@ -2463,9 +2497,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876ac351060d4f882bb1032b6369eb0aef79ad9df1ea8bc404874d8cc3d0cd98" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] @@ -2508,7 +2542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -2828,7 +2862,7 @@ dependencies = [ "pest", "pest_derive", "petgraph 0.8.3", - "portgraph 0.16.0", + "portgraph 0.16.1", "portmatching", "priority-queue", "proptest", @@ -2969,39 +3003,39 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.1.0+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97251a7c317e03ad83774a8752a7e81fb6067740609f75ea2b585b569a59198f" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.25.8+spec-1.1.0" +version = "0.25.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16bff38f1d86c47f9ff0647e6838d7bb362522bdf44006c7068c2b1e606f1f3c" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" dependencies = [ "indexmap 2.14.0", - "toml_datetime 1.1.0+spec-1.1.0", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "winnow 1.0.1", ] [[package]] name = "toml_parser" -version = "1.1.0+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2334f11ee363607eb04df9b8fc8a13ca1715a72ba8662a26ac285c98aabb4011" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ "winnow 1.0.1", ] [[package]] name = "toml_writer" -version = "1.1.0+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "tracing" @@ -3225,9 +3259,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.116" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc0882f7b5bb01ae8c5215a1230832694481c1a4be062fd410e12ea3da5b631" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" dependencies = [ "cfg-if", "once_cell", @@ -3238,9 +3272,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.116" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75973d3066e01d035dbedaad2864c398df42f8dd7b1ea057c35b8407c015b537" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3248,9 +3282,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.116" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91af5e4be765819e0bcfee7322c14374dc821e35e72fa663a830bbc7dc199eac" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" dependencies = [ "bumpalo", "proc-macro2", @@ -3261,9 +3295,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.116" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9bf0406a78f02f336bf1e451799cca198e8acde4ffa278f0fb20487b150a633" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" dependencies = [ "unicode-ident", ] @@ -3304,9 +3338,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.93" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "749466a37ee189057f54748b200186b59a03417a117267baf3fd89cecc9fb837" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 6b86aa45b..6c80c690e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,10 +44,10 @@ large_enum_variant = "allow" [patch.crates-io] # Uncomment to use unreleased versions of hugr -# hugr = { git = "https://github.com/quantinuum/hugr", "rev" = "de7b9f7581ae02cd80dff7b12794b55635903304" } -# hugr-core = { git = "https://github.com/quantinuum/hugr", "rev" = "de7b9f7581ae02cd80dff7b12794b55635903304" } -# hugr-cli = { git = "https://github.com/quantinuum/hugr", "rev" = "de7b9f7581ae02cd80dff7b12794b55635903304" } -# hugr-llvm = { git = "https://github.com/quantinuum/hugr", "rev" = "de7b9f7581ae02cd80dff7b12794b55635903304" } +hugr = { git = "https://github.com/quantinuum/hugr", branch = "george/debuginfo" } +hugr-core = { git = "https://github.com/quantinuum/hugr", branch = "george/debuginfo" } +hugr-cli = { git = "https://github.com/quantinuum/hugr", branch = "george/debuginfo" } +hugr-llvm = { git = "https://github.com/quantinuum/hugr", branch = "george/debuginfo" } # portgraph = { git = "https://github.com/quantinuum/portgraph", rev = "68b96ac737e0c285d8c543b2d74a7aa80a18202c" } [workspace.dependencies] diff --git a/qis-compiler/Cargo.toml b/qis-compiler/Cargo.toml index 699ad52c8..6d0983ae0 100644 --- a/qis-compiler/Cargo.toml +++ b/qis-compiler/Cargo.toml @@ -43,7 +43,7 @@ typetag.workspace = true # Defined here so it can be overridden by the codspeed CI job # using `cargo add`. -insta = "1.47.0" +insta = "1.47.2" [package.metadata.cargo-machete] ignored = ["cbindgen", "pyo3-build-config"] diff --git a/qis-compiler/python/selene_hugr_qis_compiler/selene_hugr_qis_compiler.pyi b/qis-compiler/python/selene_hugr_qis_compiler/selene_hugr_qis_compiler.pyi index aa7b405dc..b5cb52c50 100644 --- a/qis-compiler/python/selene_hugr_qis_compiler/selene_hugr_qis_compiler.pyi +++ b/qis-compiler/python/selene_hugr_qis_compiler/selene_hugr_qis_compiler.pyi @@ -1,8 +1,18 @@ -def compile_to_bitcode(pkg_bytes: bytes, opt_level: int = 2) -> bytes: +def compile_to_bitcode( + pkg_bytes: bytes, + opt_level: int = 2, + target_triple: str = "native", + emit_debug: bool = False, +) -> bytes: """Compile serialized HUGR to LLVM IR bitcode""" ... -def compile_to_llvm_ir(pkg_bytes: bytes, opt_level: int = 2) -> str: +def compile_to_llvm_ir( + pkg_bytes: bytes, + opt_level: int = 2, + target_triple: str = "native", + emit_debug: bool = False, +) -> str: """Compile serialized HUGR to LLVM IR string""" ... diff --git a/qis-compiler/python/tests/generate_hugrs.py b/qis-compiler/python/tests/generate_hugrs.py index 81b91bcb1..726ea28a4 100644 --- a/qis-compiler/python/tests/generate_hugrs.py +++ b/qis-compiler/python/tests/generate_hugrs.py @@ -1,10 +1,13 @@ # /// script # requires-python = ">=3.10" # dependencies = [ -# "guppylang ==0.21.9", +# "guppylang==0.21.9", +# "guppylang-internals", # "tket", # ] # /// +# TODO: point at re-released guppylang(-internals) once available with debug info. right +# now the code below is not compatible with the version specified above. from pathlib import Path @@ -25,6 +28,7 @@ x, z, ) +from guppylang_internals.debug_mode import turn_off_debug_mode, turn_on_debug_mode resources_dir = Path(__file__).parent / "resources" @@ -244,5 +248,7 @@ def foo(a: int) -> None: rng, entry_args, ]: + turn_on_debug_mode() envelope = func() + turn_off_debug_mode() (resources_dir / f"{func.__name__}.hugr").write_bytes(envelope) diff --git a/qis-compiler/python/tests/resources/check.hugr b/qis-compiler/python/tests/resources/check.hugr index 9fc09aae3..64b6d0542 100644 Binary files a/qis-compiler/python/tests/resources/check.hugr and b/qis-compiler/python/tests/resources/check.hugr differ diff --git a/qis-compiler/python/tests/resources/discard_qb_array.hugr b/qis-compiler/python/tests/resources/discard_qb_array.hugr index 9d1a224c1..647a12054 100644 Binary files a/qis-compiler/python/tests/resources/discard_qb_array.hugr and b/qis-compiler/python/tests/resources/discard_qb_array.hugr differ diff --git a/qis-compiler/python/tests/resources/entry_args.hugr b/qis-compiler/python/tests/resources/entry_args.hugr index 8a4977b3d..46f32988d 100644 Binary files a/qis-compiler/python/tests/resources/entry_args.hugr and b/qis-compiler/python/tests/resources/entry_args.hugr differ diff --git a/qis-compiler/python/tests/resources/flip_some.hugr b/qis-compiler/python/tests/resources/flip_some.hugr index 7527103e4..0c901229b 100644 Binary files a/qis-compiler/python/tests/resources/flip_some.hugr and b/qis-compiler/python/tests/resources/flip_some.hugr differ diff --git a/qis-compiler/python/tests/resources/measure_qb_array.hugr b/qis-compiler/python/tests/resources/measure_qb_array.hugr index f4ab82eb5..7047cfd68 100644 Binary files a/qis-compiler/python/tests/resources/measure_qb_array.hugr and b/qis-compiler/python/tests/resources/measure_qb_array.hugr differ diff --git a/qis-compiler/python/tests/resources/no_results.hugr b/qis-compiler/python/tests/resources/no_results.hugr index 43bc9e234..707da0828 100644 Binary files a/qis-compiler/python/tests/resources/no_results.hugr and b/qis-compiler/python/tests/resources/no_results.hugr differ diff --git a/qis-compiler/python/tests/resources/postselect_exit.hugr b/qis-compiler/python/tests/resources/postselect_exit.hugr index 4049b6d7e..735feb1c1 100644 Binary files a/qis-compiler/python/tests/resources/postselect_exit.hugr and b/qis-compiler/python/tests/resources/postselect_exit.hugr differ diff --git a/qis-compiler/python/tests/resources/postselect_panic.hugr b/qis-compiler/python/tests/resources/postselect_panic.hugr index 8fffdc096..12863fc07 100644 Binary files a/qis-compiler/python/tests/resources/postselect_panic.hugr and b/qis-compiler/python/tests/resources/postselect_panic.hugr differ diff --git a/qis-compiler/python/tests/resources/print_current_shot.hugr b/qis-compiler/python/tests/resources/print_current_shot.hugr index 31778e945..95ccc756a 100644 Binary files a/qis-compiler/python/tests/resources/print_current_shot.hugr and b/qis-compiler/python/tests/resources/print_current_shot.hugr differ diff --git a/qis-compiler/python/tests/resources/rng.hugr b/qis-compiler/python/tests/resources/rng.hugr index 0cd61b653..28bc3beb6 100644 Binary files a/qis-compiler/python/tests/resources/rng.hugr and b/qis-compiler/python/tests/resources/rng.hugr differ diff --git a/qis-compiler/python/tests/resources/rus.hugr b/qis-compiler/python/tests/resources/rus.hugr index 4c933b0a3..c19cb606c 100644 Binary files a/qis-compiler/python/tests/resources/rus.hugr and b/qis-compiler/python/tests/resources/rus.hugr differ diff --git a/qis-compiler/python/tests/resources/unsupported_pytket_ops.hugr b/qis-compiler/python/tests/resources/unsupported_pytket_ops.hugr index 02ca2dd8d..71a6b9ded 100644 Binary files a/qis-compiler/python/tests/resources/unsupported_pytket_ops.hugr and b/qis-compiler/python/tests/resources/unsupported_pytket_ops.hugr differ 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 ee1bcede5..cf39d3ddb 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 @@ -4,284 +4,354 @@ target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32: 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" -@"e_Array elem.E746B1A3.0" = private constant [43 x i8] c"*EXIT:INT:Array element is already borrowed" @"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." +define void @"__hugr__.__main__.discard_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit, !dbg !9 + +cond_233_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__hugr__.__tk2_qalloc.229.exit.8, %__hugr__.__tk2_qalloc.229.exit.7, %__hugr__.__tk2_qalloc.229.exit.6, %__hugr__.__tk2_qalloc.229.exit.5, %__hugr__.__tk2_qalloc.229.exit.4, %__hugr__.__tk2_qalloc.229.exit.3, %__hugr__.__tk2_qalloc.229.exit.2, %__hugr__.__tk2_qalloc.229.exit.1, %__hugr__.__tk2_qalloc.229.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__hugr__.__tk2_qalloc.229.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.1, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not = icmp eq i64 %6, 0 + br i1 %.not, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__hugr__.__tk2_qalloc.229.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.2, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not108 = icmp eq i64 %10, 0 + br i1 %.not108, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__hugr__.__tk2_qalloc.229.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.3, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not109 = icmp eq i64 %14, 0 + br i1 %.not109, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__hugr__.__tk2_qalloc.229.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.4, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not110 = icmp eq i64 %18, 0 + br i1 %.not110, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__hugr__.__tk2_qalloc.229.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.5, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not111 = icmp eq i64 %22, 0 + br i1 %.not111, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__hugr__.__tk2_qalloc.229.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.6, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not112 = icmp eq i64 %26, 0 + br i1 %.not112, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__hugr__.__tk2_qalloc.229.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.7, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not113 = icmp eq i64 %30, 0 + br i1 %.not113, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__hugr__.__tk2_qalloc.229.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_233_case_0.i, label %__hugr__.__tk2_qalloc.229.exit.8, !dbg !9 + +__hugr__.__tk2_qalloc.229.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not114 = icmp eq i64 %34, 0 + br i1 %.not114, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__hugr__.__tk2_qalloc.229.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_233_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not115 = icmp eq i64 %38, 0 + br i1 %.not115, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %cond_171_case_1.1.i, label %__barray_mask_borrow.exit.i + +cond_171_case_1.1.i: ; preds = %__barray_mask_borrow.exit.i, %cond_exit_20.9 + %43 = phi i64 [ %41, %cond_exit_20.9 ], [ %.pre.i, %__barray_mask_borrow.exit.i ], !dbg !10 + %44 = and i64 %43, 2, !dbg !10 + %.not.i = icmp eq i64 %44, 0, !dbg !10 + br i1 %.not.i, label %__barray_mask_borrow.exit.1.i, label %cond_171_case_1.2.i + +__barray_mask_borrow.exit.1.i: ; preds = %cond_171_case_1.1.i + %45 = or disjoint i64 %43, 2, !dbg !21 + store i64 %45, ptr %1, align 4, !dbg !21 + %46 = load i64, ptr %8, align 4, !dbg !23 + tail call void @___qfree(i64 %46), !dbg !24 + %.pre337.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.2.i + +cond_171_case_1.2.i: ; preds = %__barray_mask_borrow.exit.1.i, %cond_171_case_1.1.i + %47 = phi i64 [ %.pre337.i, %__barray_mask_borrow.exit.1.i ], [ %43, %cond_171_case_1.1.i ], !dbg !10 + %48 = and i64 %47, 4, !dbg !10 + %.not345.i = icmp eq i64 %48, 0, !dbg !10 + br i1 %.not345.i, label %__barray_mask_borrow.exit.2.i, label %cond_171_case_1.3.i + +__barray_mask_borrow.exit.2.i: ; preds = %cond_171_case_1.2.i + %49 = or disjoint i64 %47, 4, !dbg !21 + store i64 %49, ptr %1, align 4, !dbg !21 + %50 = load i64, ptr %12, align 4, !dbg !23 + tail call void @___qfree(i64 %50), !dbg !24 + %.pre338.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.3.i + +cond_171_case_1.3.i: ; preds = %__barray_mask_borrow.exit.2.i, %cond_171_case_1.2.i + %51 = phi i64 [ %.pre338.i, %__barray_mask_borrow.exit.2.i ], [ %47, %cond_171_case_1.2.i ], !dbg !10 + %52 = and i64 %51, 8, !dbg !10 + %.not346.i = icmp eq i64 %52, 0, !dbg !10 + br i1 %.not346.i, label %__barray_mask_borrow.exit.3.i, label %cond_171_case_1.4.i + +__barray_mask_borrow.exit.3.i: ; preds = %cond_171_case_1.3.i + %53 = or disjoint i64 %51, 8, !dbg !21 + store i64 %53, ptr %1, align 4, !dbg !21 + %54 = load i64, ptr %16, align 4, !dbg !23 + tail call void @___qfree(i64 %54), !dbg !24 + %.pre339.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.4.i + +cond_171_case_1.4.i: ; preds = %__barray_mask_borrow.exit.3.i, %cond_171_case_1.3.i + %55 = phi i64 [ %.pre339.i, %__barray_mask_borrow.exit.3.i ], [ %51, %cond_171_case_1.3.i ], !dbg !10 + %56 = and i64 %55, 16, !dbg !10 + %.not347.i = icmp eq i64 %56, 0, !dbg !10 + br i1 %.not347.i, label %__barray_mask_borrow.exit.4.i, label %cond_171_case_1.5.i + +__barray_mask_borrow.exit.4.i: ; preds = %cond_171_case_1.4.i + %57 = or disjoint i64 %55, 16, !dbg !21 + store i64 %57, ptr %1, align 4, !dbg !21 + %58 = load i64, ptr %20, align 4, !dbg !23 + tail call void @___qfree(i64 %58), !dbg !24 + %.pre340.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.5.i + +cond_171_case_1.5.i: ; preds = %__barray_mask_borrow.exit.4.i, %cond_171_case_1.4.i + %59 = phi i64 [ %.pre340.i, %__barray_mask_borrow.exit.4.i ], [ %55, %cond_171_case_1.4.i ], !dbg !10 + %60 = and i64 %59, 32, !dbg !10 + %.not348.i = icmp eq i64 %60, 0, !dbg !10 + br i1 %.not348.i, label %__barray_mask_borrow.exit.5.i, label %cond_171_case_1.6.i + +__barray_mask_borrow.exit.5.i: ; preds = %cond_171_case_1.5.i + %61 = or disjoint i64 %59, 32, !dbg !21 + store i64 %61, ptr %1, align 4, !dbg !21 + %62 = load i64, ptr %24, align 4, !dbg !23 + tail call void @___qfree(i64 %62), !dbg !24 + %.pre341.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.6.i + +cond_171_case_1.6.i: ; preds = %__barray_mask_borrow.exit.5.i, %cond_171_case_1.5.i + %63 = phi i64 [ %.pre341.i, %__barray_mask_borrow.exit.5.i ], [ %59, %cond_171_case_1.5.i ], !dbg !10 + %64 = and i64 %63, 64, !dbg !10 + %.not349.i = icmp eq i64 %64, 0, !dbg !10 + br i1 %.not349.i, label %__barray_mask_borrow.exit.6.i, label %cond_171_case_1.7.i + +__barray_mask_borrow.exit.6.i: ; preds = %cond_171_case_1.6.i + %65 = or disjoint i64 %63, 64, !dbg !21 + store i64 %65, ptr %1, align 4, !dbg !21 + %66 = load i64, ptr %28, align 4, !dbg !23 + tail call void @___qfree(i64 %66), !dbg !24 + %.pre342.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.7.i + +cond_171_case_1.7.i: ; preds = %__barray_mask_borrow.exit.6.i, %cond_171_case_1.6.i + %67 = phi i64 [ %.pre342.i, %__barray_mask_borrow.exit.6.i ], [ %63, %cond_171_case_1.6.i ], !dbg !10 + %68 = and i64 %67, 128, !dbg !10 + %.not350.i = icmp eq i64 %68, 0, !dbg !10 + br i1 %.not350.i, label %__barray_mask_borrow.exit.7.i, label %cond_171_case_1.8.i + +__barray_mask_borrow.exit.7.i: ; preds = %cond_171_case_1.7.i + %69 = or disjoint i64 %67, 128, !dbg !21 + store i64 %69, ptr %1, align 4, !dbg !21 + %70 = load i64, ptr %32, align 4, !dbg !23 + tail call void @___qfree(i64 %70), !dbg !24 + %.pre343.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.8.i + +cond_171_case_1.8.i: ; preds = %__barray_mask_borrow.exit.7.i, %cond_171_case_1.7.i + %71 = phi i64 [ %.pre343.i, %__barray_mask_borrow.exit.7.i ], [ %67, %cond_171_case_1.7.i ], !dbg !10 + %72 = and i64 %71, 256, !dbg !10 + %.not351.i = icmp eq i64 %72, 0, !dbg !10 + br i1 %.not351.i, label %__barray_mask_borrow.exit.8.i, label %__barray_check_bounds.exit.9.i + +__barray_mask_borrow.exit.8.i: ; preds = %cond_171_case_1.8.i + %73 = or disjoint i64 %71, 256, !dbg !21 + store i64 %73, ptr %1, align 4, !dbg !21 + %74 = load i64, ptr %36, align 4, !dbg !23 + tail call void @___qfree(i64 %74), !dbg !24 + %.pre = load i64, ptr %1, align 4, !dbg !10 + br label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %__barray_mask_borrow.exit.8.i, %cond_171_case_1.8.i + %75 = phi i64 [ %.pre, %__barray_mask_borrow.exit.8.i ], [ %71, %cond_171_case_1.8.i ], !dbg !10 + %76 = and i64 %75, 512, !dbg !10 + %.not352.i = icmp eq i64 %76, 0, !dbg !10 + br i1 %.not352.i, label %__barray_mask_borrow.exit.9.i, label %cond_exit_156.i + +__barray_mask_borrow.exit.9.i: ; preds = %__barray_check_bounds.exit.9.i + %77 = or disjoint i64 %75, 512, !dbg !21 + store i64 %77, ptr %1, align 4, !dbg !21 + %78 = load i64, ptr %40, align 4, !dbg !23 + tail call void @___qfree(i64 %78), !dbg !24 + %.pre344.i = load i64, ptr %1, align 4, !dbg !25 + br label %cond_exit_156.i + +cond_exit_156.i: ; preds = %__barray_mask_borrow.exit.9.i, %__barray_check_bounds.exit.9.i + %79 = phi i64 [ %.pre344.i, %__barray_mask_borrow.exit.9.i ], [ %75, %__barray_check_bounds.exit.9.i ], !dbg !25 + %80 = or i64 %79, -1024, !dbg !25 + store i64 %80, ptr %1, align 4, !dbg !25 + %81 = icmp eq i64 %80, -1, !dbg !25 + br i1 %81, label %"__hugr__.guppylang.std.quantum.discard_array$10.113.exit", label %mask_block_err.i.i, !dbg !25 + +mask_block_err.i.i: ; preds = %cond_exit_156.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !25 + unreachable, !dbg !25 + +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.9 + %82 = or disjoint i64 %41, 1, !dbg !21 + store i64 %82, ptr %1, align 4, !dbg !21 + %83 = load i64, ptr %0, align 4, !dbg !23 + tail call void @___qfree(i64 %83), !dbg !24 + %.pre.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.1.i + +"__hugr__.guppylang.std.quantum.discard_array$10.113.exit": ; preds = %cond_exit_156.i + tail call void @heap_free(ptr nonnull %0), !dbg !27 + tail call void @heap_free(ptr nonnull %1), !dbg !27 + ret void +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @___qfree(i64) local_unnamed_addr - declare void @heap_free(ptr) local_unnamed_addr +declare void @___qfree(i64) local_unnamed_addr + declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.i - -cond_213_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 - -__hugr__.__tk2_qalloc.218.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.218.exit.8.i, %__hugr__.__tk2_qalloc.218.exit.7.i, %__hugr__.__tk2_qalloc.218.exit.6.i, %__hugr__.__tk2_qalloc.218.exit.5.i, %__hugr__.__tk2_qalloc.218.exit.4.i, %__hugr__.__tk2_qalloc.218.exit.3.i, %__hugr__.__tk2_qalloc.218.exit.2.i, %__hugr__.__tk2_qalloc.218.exit.1.i, %__hugr__.__tk2_qalloc.218.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -cond_exit_20.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.1.i - -__hugr__.__tk2_qalloc.218.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.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.2.i - -__hugr__.__tk2_qalloc.218.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 - %.not106.i = icmp eq i64 %11, 0 - br i1 %.not106.i, label %panic.i.i, label %cond_exit_20.2.i - -cond_exit_20.2.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.3.i - -__hugr__.__tk2_qalloc.218.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 - %.not107.i = icmp eq i64 %15, 0 - br i1 %.not107.i, label %panic.i.i, label %cond_exit_20.3.i - -cond_exit_20.3.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.4.i - -__hugr__.__tk2_qalloc.218.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 - %.not108.i = icmp eq i64 %19, 0 - br i1 %.not108.i, label %panic.i.i, label %cond_exit_20.4.i - -cond_exit_20.4.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.5.i - -__hugr__.__tk2_qalloc.218.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 - %.not109.i = icmp eq i64 %23, 0 - br i1 %.not109.i, label %panic.i.i, label %cond_exit_20.5.i - -cond_exit_20.5.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.6.i - -__hugr__.__tk2_qalloc.218.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 - %.not110.i = icmp eq i64 %27, 0 - br i1 %.not110.i, label %panic.i.i, label %cond_exit_20.6.i - -cond_exit_20.6.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.7.i - -__hugr__.__tk2_qalloc.218.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 - %.not111.i = icmp eq i64 %31, 0 - br i1 %.not111.i, label %panic.i.i, label %cond_exit_20.7.i - -cond_exit_20.7.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_case_0.i.i, label %__hugr__.__tk2_qalloc.218.exit.8.i - -__hugr__.__tk2_qalloc.218.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 - %.not112.i = icmp eq i64 %35, 0 - br i1 %.not112.i, label %panic.i.i, label %cond_exit_20.8.i - -cond_exit_20.8.i: ; preds = %__hugr__.__tk2_qalloc.218.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_213_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 - %.not113.i = icmp eq i64 %39, 0 - br i1 %.not113.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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert.i", i64 0, 2 - %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert.i", 0 - br label %__barray_check_bounds.exit.i.i.i - -43: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i", %cond_exit_20.9.i - %.fca.2.extract82.i185.i.i = phi i64 [ 0, %cond_exit_20.9.i ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.1.extract81.i184.i.i = phi ptr [ %2, %cond_exit_20.9.i ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.0.extract80.i183.i.i = phi ptr [ %1, %cond_exit_20.9.i ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %"294_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.9.i ], [ %72, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.9.i ], [ %80, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %65 = add i64 %"294_0.0182.i.i", %.fca.2.extract82.i185.i.i - %66 = lshr i64 %65, 6 - %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i - %72 = add nuw nsw i64 %"294_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.extract80.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 %"294_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 + tail call void @setup(i64 %0), !dbg !32 + tail call void @"__hugr__.__main__.discard_qb_array..main.1"(), !dbg !32 + %1 = tail call i64 @teardown(), !dbg !32 + ret i64 %1, !dbg !32 } declare void @setup(i64) local_unnamed_addr @@ -290,6 +360,40 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "discard_qb_array..main", linkageName: "__hugr__.__main__.discard_qb_array..main.1", scope: null, file: !5, line: 92, type: !6, scopeLine: 93, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 93, column: 13, scope: !4) +!9 = !DILocation(line: 93, column: 19, scope: !4) +!10 = !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !19) +!11 = distinct !DISubprogram(name: "std.quantum.discard_array$10", linkageName: "__hugr__.guppylang.std.quantum.discard_array$10.113", scope: null, file: !12, line: 387, type: !13, scopeLine: 389, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!12 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!13 = !DISubroutineType(types: !14) +!14 = !{null, !15} +!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !16) +!16 = !{!17, !17, !18} +!17 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!18 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!19 = distinct !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !20) +!20 = distinct !DILocation(line: 94, column: 8, scope: !4) +!21 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !22) +!22 = distinct !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!23 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!24 = !DILocation(line: 391, column: 12, scope: !11, inlinedAt: !20) +!25 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !26) +!26 = distinct !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!27 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !30, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DISubroutineType(types: !31) +!31 = !{!18, !18} +!32 = !DILocation(line: 0, scope: !28) 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 938ef7cb9..2f6c7ab3e 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 @@ -9,6 +9,74 @@ target triple = "aarch64-apple-darwin" @res_c3.B223E16D.0 = private constant [13 x i8] c"\0CUSER:BOOL:c3" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.flip_some..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_40_case_0.i, label %__hugr__.__tk2_qalloc.36.exit, !dbg !8 + +cond_40_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.36.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !9 + %qalloc.i101 = tail call i64 @___qalloc(), !dbg !10 + %not_max.not.not.i102 = icmp eq i64 %qalloc.i101, -1, !dbg !10 + br i1 %not_max.not.not.i102, label %cond_54_case_0.i, label %__hugr__.__tk2_qalloc.50.exit, !dbg !10 + +cond_54_case_0.i: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !10 + unreachable, !dbg !10 + +__hugr__.__tk2_qalloc.50.exit: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @___reset(i64 %qalloc.i101), !dbg !10 + %qalloc.i103 = tail call i64 @___qalloc(), !dbg !11 + %not_max.not.not.i104 = icmp eq i64 %qalloc.i103, -1, !dbg !11 + br i1 %not_max.not.not.i104, label %cond_68_case_0.i, label %__hugr__.__tk2_qalloc.64.exit, !dbg !11 + +cond_68_case_0.i: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !11 + unreachable, !dbg !11 + +__hugr__.__tk2_qalloc.64.exit: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @___reset(i64 %qalloc.i103), !dbg !11 + tail call void @___rxy(i64 %qalloc.i103, double 0x400921FB54442D18, double 0.000000e+00), !dbg !12 + %qalloc.i105 = tail call i64 @___qalloc(), !dbg !13 + %not_max.not.not.i106 = icmp eq i64 %qalloc.i105, -1, !dbg !13 + br i1 %not_max.not.not.i106, label %cond_82_case_0.i, label %__hugr__.__tk2_qalloc.78.exit, !dbg !13 + +cond_82_case_0.i: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !13 + unreachable, !dbg !13 + +__hugr__.__tk2_qalloc.78.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @___reset(i64 %qalloc.i105), !dbg !13 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool), !dbg !14 + %lazy_measure22 = tail call i64 @___lazy_measure(i64 %qalloc.i101) + tail call void @___qfree(i64 %qalloc.i101) + %read_bool35 = tail call i1 @___read_future_bool(i64 %lazy_measure22) + tail call void @___dec_future_refcount(i64 %lazy_measure22) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35), !dbg !15 + %lazy_measure44 = tail call i64 @___lazy_measure(i64 %qalloc.i103) + tail call void @___qfree(i64 %qalloc.i103) + %read_bool57 = tail call i1 @___read_future_bool(i64 %lazy_measure44) + tail call void @___dec_future_refcount(i64 %lazy_measure44) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57), !dbg !16 + tail call void @___rxy(i64 %qalloc.i105, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %lazy_measure67 = tail call i64 @___lazy_measure(i64 %qalloc.i105) + tail call void @___qfree(i64 %qalloc.i105) + %read_bool80 = tail call i1 @___read_future_bool(i64 %lazy_measure67) + tail call void @___dec_future_refcount(i64 %lazy_measure67) + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80), !dbg !18 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -28,74 +96,12 @@ declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !19 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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.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 - -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 = %__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 = %__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 = %__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 = %__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(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(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(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(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !24 + tail call void @"__hugr__.__main__.flip_some..main.1"(), !dbg !24 + %1 = tail call i64 @teardown(), !dbg !24 + ret i64 %1, !dbg !24 } declare void @setup(i64) local_unnamed_addr @@ -104,6 +110,32 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "flip_some..main", linkageName: "__hugr__.__main__.flip_some..main.1", scope: null, file: !5, line: 74, type: !6, scopeLine: 75, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 75, column: 20, scope: !4) +!9 = !DILocation(line: 79, column: 8, scope: !4) +!10 = !DILocation(line: 76, column: 20, scope: !4) +!11 = !DILocation(line: 77, column: 20, scope: !4) +!12 = !DILocation(line: 80, column: 8, scope: !4) +!13 = !DILocation(line: 78, column: 20, scope: !4) +!14 = !DILocation(line: 82, column: 8, scope: !4) +!15 = !DILocation(line: 83, column: 8, scope: !4) +!16 = !DILocation(line: 84, column: 8, scope: !4) +!17 = !DILocation(line: 81, column: 8, scope: !4) +!18 = !DILocation(line: 85, column: 8, scope: !4) +!19 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !20, type: !21, spFlags: DISPFlagDefinition, unit: !1) +!20 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!21 = !DISubroutineType(types: !22) +!22 = !{!23, !23} +!23 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!24 = !DILocation(line: 0, scope: !19) 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 2d34acc98..cbc2ada33 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 @@ -8,6 +8,434 @@ 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." +define void @"__hugr__.__main__.measure_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit, !dbg !9 + +cond_299_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__hugr__.__tk2_qalloc.295.exit.8, %__hugr__.__tk2_qalloc.295.exit.7, %__hugr__.__tk2_qalloc.295.exit.6, %__hugr__.__tk2_qalloc.295.exit.5, %__hugr__.__tk2_qalloc.295.exit.4, %__hugr__.__tk2_qalloc.295.exit.3, %__hugr__.__tk2_qalloc.295.exit.2, %__hugr__.__tk2_qalloc.295.exit.1, %__hugr__.__tk2_qalloc.295.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__hugr__.__tk2_qalloc.295.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.1, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not280 = icmp eq i64 %6, 0 + br i1 %.not280, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__hugr__.__tk2_qalloc.295.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.2, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not281 = icmp eq i64 %10, 0 + br i1 %.not281, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__hugr__.__tk2_qalloc.295.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.3, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not282 = icmp eq i64 %14, 0 + br i1 %.not282, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__hugr__.__tk2_qalloc.295.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.4, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not283 = icmp eq i64 %18, 0 + br i1 %.not283, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__hugr__.__tk2_qalloc.295.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.5, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not284 = icmp eq i64 %22, 0 + br i1 %.not284, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__hugr__.__tk2_qalloc.295.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.6, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not285 = icmp eq i64 %26, 0 + br i1 %.not285, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__hugr__.__tk2_qalloc.295.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.7, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not286 = icmp eq i64 %30, 0 + br i1 %.not286, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__hugr__.__tk2_qalloc.295.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_299_case_0.i, label %__hugr__.__tk2_qalloc.295.exit.8, !dbg !9 + +__hugr__.__tk2_qalloc.295.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not287 = icmp eq i64 %34, 0 + br i1 %.not287, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__hugr__.__tk2_qalloc.295.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_299_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not288 = icmp eq i64 %38, 0 + br i1 %.not288, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %"116.fca.0.insert" = insertvalue { ptr, ptr, i64 } poison, ptr %0, 0 + %"116.fca.1.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert", ptr %1, 1 + %"116.fca.2.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert", i64 0, 2 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %panic.i238, label %__barray_mask_borrow.exit, !dbg !10 + +panic.i238: ; preds = %cond_exit_20.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !10 + unreachable, !dbg !10 + +__barray_mask_borrow.exit: ; preds = %cond_exit_20.9 + %43 = or disjoint i64 %41, 1, !dbg !10 + store i64 %43, ptr %1, align 4, !dbg !10 + %44 = load i64, ptr %0, align 4, !dbg !12 + tail call void @___rxy(i64 %44, double 0x400921FB54442D18, double 0.000000e+00), !dbg !13 + %45 = load i64, ptr %1, align 4, !dbg !12 + %46 = trunc i64 %45 to i1, !dbg !12 + br i1 %46, label %__barray_mask_return.exit240, label %panic.i239, !dbg !12 + +panic.i239: ; preds = %__barray_mask_borrow.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !12 + unreachable, !dbg !12 + +__barray_mask_return.exit240: ; preds = %__barray_mask_borrow.exit + %47 = and i64 %45, -2, !dbg !12 + store i64 %47, ptr %1, align 4, !dbg !12 + store i64 %44, ptr %0, align 4, !dbg !12 + %48 = load i64, ptr %1, align 4, !dbg !14 + %49 = and i64 %48, 4, !dbg !14 + %.not = icmp eq i64 %49, 0, !dbg !14 + br i1 %.not, label %__barray_mask_borrow.exit242, label %panic.i241, !dbg !14 + +panic.i241: ; preds = %__barray_mask_return.exit240 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !14 + unreachable, !dbg !14 + +__barray_mask_borrow.exit242: ; preds = %__barray_mask_return.exit240 + %50 = or disjoint i64 %48, 4, !dbg !14 + store i64 %50, ptr %1, align 4, !dbg !14 + %51 = load i64, ptr %12, align 4, !dbg !16 + tail call void @___rxy(i64 %51, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %52 = load i64, ptr %1, align 4, !dbg !16 + %53 = and i64 %52, 4, !dbg !16 + %.not268 = icmp eq i64 %53, 0, !dbg !16 + br i1 %.not268, label %panic.i243, label %__barray_mask_return.exit244, !dbg !16 + +panic.i243: ; preds = %__barray_mask_borrow.exit242 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !16 + unreachable, !dbg !16 + +__barray_mask_return.exit244: ; preds = %__barray_mask_borrow.exit242 + %54 = and i64 %52, -5, !dbg !16 + store i64 %54, ptr %1, align 4, !dbg !16 + store i64 %51, ptr %12, align 4, !dbg !16 + %55 = load i64, ptr %1, align 4, !dbg !18 + %56 = and i64 %55, 8, !dbg !18 + %.not269 = icmp eq i64 %56, 0, !dbg !18 + br i1 %.not269, label %__barray_mask_borrow.exit246, label %panic.i245, !dbg !18 + +panic.i245: ; preds = %__barray_mask_return.exit244 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !18 + unreachable, !dbg !18 + +__barray_mask_borrow.exit246: ; preds = %__barray_mask_return.exit244 + %57 = or disjoint i64 %55, 8, !dbg !18 + store i64 %57, ptr %1, align 4, !dbg !18 + %58 = load i64, ptr %16, align 4, !dbg !20 + tail call void @___rxy(i64 %58, double 0x400921FB54442D18, double 0.000000e+00), !dbg !21 + %59 = load i64, ptr %1, align 4, !dbg !20 + %60 = and i64 %59, 8, !dbg !20 + %.not270 = icmp eq i64 %60, 0, !dbg !20 + br i1 %.not270, label %panic.i247, label %__barray_mask_return.exit248, !dbg !20 + +panic.i247: ; preds = %__barray_mask_borrow.exit246 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !20 + unreachable, !dbg !20 + +__barray_mask_return.exit248: ; preds = %__barray_mask_borrow.exit246 + %61 = and i64 %59, -9, !dbg !20 + store i64 %61, ptr %1, align 4, !dbg !20 + store i64 %58, ptr %16, align 4, !dbg !20 + %62 = load i64, ptr %1, align 4, !dbg !22 + %63 = and i64 %62, 512, !dbg !22 + %.not271 = icmp eq i64 %63, 0, !dbg !22 + br i1 %.not271, label %__barray_mask_borrow.exit250, label %panic.i249, !dbg !22 + +panic.i249: ; preds = %__barray_mask_return.exit248 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !22 + unreachable, !dbg !22 + +__barray_mask_borrow.exit250: ; preds = %__barray_mask_return.exit248 + %64 = or disjoint i64 %62, 512, !dbg !22 + store i64 %64, ptr %1, align 4, !dbg !22 + %65 = load i64, ptr %40, align 4, !dbg !24 + tail call void @___rxy(i64 %65, double 0x400921FB54442D18, double 0.000000e+00), !dbg !25 + %66 = load i64, ptr %1, align 4, !dbg !24 + %67 = and i64 %66, 512, !dbg !24 + %.not272 = icmp eq i64 %67, 0, !dbg !24 + br i1 %.not272, label %panic.i251, label %__barray_mask_return.exit252, !dbg !24 + +panic.i251: ; preds = %__barray_mask_borrow.exit250 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !24 + unreachable, !dbg !24 + +__barray_mask_return.exit252: ; preds = %__barray_mask_borrow.exit250 + %68 = and i64 %66, -513, !dbg !24 + store i64 %68, ptr %1, align 4, !dbg !24 + store i64 %65, ptr %40, align 4, !dbg !24 + %69 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert", 0, !dbg !26 + %70 = tail call ptr @heap_alloc(i64 240), !dbg !43 + %71 = tail call ptr @heap_alloc(i64 8), !dbg !43 + store i64 -1, ptr %71, align 1, !dbg !43 + br label %__barray_check_bounds.exit.i.i + +72: ; preds = %loop_body.i + %73 = lshr i64 %.fca.2.extract82.i.i, 6, !dbg !44 + %74 = getelementptr i64, ptr %.fca.1.extract81.i.i, i64 %73, !dbg !44 + %75 = load i64, ptr %74, align 4, !dbg !44 + %76 = and i64 %.fca.2.extract82.i.i, 63, !dbg !44 + %77 = sub nuw nsw i64 64, %76, !dbg !44 + %78 = lshr i64 -1, %77, !dbg !44 + %79 = icmp eq i64 %76, 0, !dbg !44 + %80 = select i1 %79, i64 0, i64 %78, !dbg !44 + %81 = or i64 %75, %80, !dbg !44 + store i64 %81, ptr %74, align 4, !dbg !44 + %last_valid.i.i.i = add i64 %.fca.2.extract82.i.i, 9, !dbg !44 + %82 = lshr i64 %last_valid.i.i.i, 6, !dbg !44 + %83 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i.i, i64 %82, !dbg !44 + %84 = load i64, ptr %83, align 4, !dbg !44 + %85 = and i64 %last_valid.i.i.i, 63, !dbg !44 + %86 = shl nsw i64 -2, %85, !dbg !44 + %87 = icmp eq i64 %85, 63, !dbg !44 + %88 = select i1 %87, i64 0, i64 %86, !dbg !44 + %89 = or i64 %84, %88, !dbg !44 + store i64 %89, ptr %83, align 4, !dbg !44 + %reass.sub.i.i.i = sub nsw i64 %82, %73, !dbg !44 + %.not.i.i.i = icmp eq i64 %reass.sub.i.i.i, -1, !dbg !44 + br i1 %.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +90: ; preds = %mask_block_ok.i.i.i + %91 = add nuw i64 %.02.i.i.i, 1, !dbg !44 + %exitcond.not.i.i.i = icmp eq i64 %.02.i.i.i, %reass.sub.i.i.i, !dbg !44 + br i1 %exitcond.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +mask_block_ok.i.i.i: ; preds = %72, %90 + %.02.i.i.i = phi i64 [ %91, %90 ], [ 0, %72 ], !dbg !44 + %gep.i.i.i = getelementptr i64, ptr %74, i64 %.02.i.i.i, !dbg !44 + %92 = load i64, ptr %gep.i.i.i, align 4, !dbg !44 + %93 = icmp eq i64 %92, -1, !dbg !44 + br i1 %93, label %90, label %mask_block_err.i.i.i, !dbg !44 + +mask_block_err.i.i.i: ; preds = %mask_block_ok.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !44 + unreachable, !dbg !44 + +__barray_check_bounds.exit.i.i: ; preds = %loop_body.i, %__barray_mask_return.exit252 + %.fca.2.extract82.i187.i = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %.fca.2.extract82.i.i, %loop_body.i ] + %.fca.1.extract81.i186.i = phi ptr [ %1, %__barray_mask_return.exit252 ], [ %.fca.1.extract81.i.i, %loop_body.i ] + %.fca.0.extract80.i185.i = phi ptr [ %0, %__barray_mask_return.exit252 ], [ %.fca.0.extract80.i.i, %loop_body.i ] + %"163_0.sroa.15.0184.i" = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %94, %loop_body.i ] + %.pn165183.i = phi { { ptr, ptr, i64 }, i64 } [ %69, %__barray_mask_return.exit252 ], [ %109, %loop_body.i ] + %94 = add nuw nsw i64 %"163_0.sroa.15.0184.i", 1, !dbg !54 + %95 = add i64 %"163_0.sroa.15.0184.i", %.fca.2.extract82.i187.i, !dbg !55 + %96 = lshr i64 %95, 6, !dbg !56 + %97 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i186.i, i64 %96, !dbg !56 + %98 = load i64, ptr %97, align 4, !dbg !56 + %99 = and i64 %95, 63, !dbg !56 + %100 = lshr i64 %98, %99, !dbg !56 + %101 = trunc i64 %100 to i1, !dbg !56 + br i1 %101, label %panic.i.i.i, label %__barray_check_bounds.exit.i, !dbg !56 + +panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !56 + unreachable, !dbg !56 + +__barray_check_bounds.exit.i: ; preds = %__barray_check_bounds.exit.i.i + %102 = shl nuw i64 1, %99, !dbg !56 + %103 = xor i64 %102, %98, !dbg !56 + store i64 %103, ptr %97, align 4, !dbg !56 + %104 = getelementptr inbounds i64, ptr %.fca.0.extract80.i185.i, i64 %95, !dbg !55 + %105 = load i64, ptr %104, align 4, !dbg !55 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %105) + tail call void @___qfree(i64 %105) + %106 = load i64, ptr %71, align 4 + %107 = lshr i64 %106, %"163_0.sroa.15.0184.i" + %108 = trunc i64 %107 to i1 + br i1 %108, label %loop_body.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +loop_body.i: ; preds = %__barray_check_bounds.exit.i + %"182_054.fca.1.insert.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i, 1 + %"182_054.fca.2.insert.i" = insertvalue { i1, i64, i1 } %"182_054.fca.1.insert.i", i1 undef, 2 + %109 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, i64 %94, 1 + %110 = shl nuw nsw i64 1, %"163_0.sroa.15.0184.i" + %111 = xor i64 %106, %110 + store i64 %111, ptr %71, align 4 + %112 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %70, i64 %"163_0.sroa.15.0184.i" + store { i1, i64, i1 } %"182_054.fca.2.insert.i", ptr %112, align 4 + %113 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, 0 + %.fca.0.extract80.i.i = extractvalue { ptr, ptr, i64 } %113, 0 + %.fca.1.extract81.i.i = extractvalue { ptr, ptr, i64 } %113, 1 + %.fca.2.extract82.i.i = extractvalue { ptr, ptr, i64 } %113, 2 + %exitcond.not.i = icmp eq i64 %94, 10, !dbg !58 + br i1 %exitcond.not.i, label %72, label %__barray_check_bounds.exit.i.i + +"__hugr__.guppylang.std.quantum.measure_array$10.149.exit": ; preds = %90, %72 + tail call void @heap_free(ptr %.fca.0.extract80.i.i), !dbg !44 + tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i), !dbg !44 + br label %__barray_check_bounds.exit255 + +cond_369_case_0: ; preds = %cond_exit_369.thread + %114 = load i64, ptr %71, align 4 + %115 = or i64 %114, -1024 + store i64 %115, ptr %71, align 4 + %116 = icmp eq i64 %115, -1 + br i1 %116, label %cond_exit_369, label %mask_block_err.i + +cond_exit_369: ; preds = %cond_369_case_0 + tail call void @heap_free(ptr %70) + tail call void @heap_free(ptr nonnull %71) + ret void + +mask_block_err.i: ; preds = %cond_369_case_0 + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") + unreachable + +__barray_check_bounds.exit255: ; preds = %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", %cond_exit_369.thread + %"366_0.0279" = phi i64 [ 0, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" ], [ %117, %cond_exit_369.thread ] + %117 = add nuw nsw i64 %"366_0.0279", 1 + %118 = load i64, ptr %71, align 4 + %119 = lshr i64 %118, %"366_0.0279" + %120 = trunc i64 %119 to i1 + br i1 %120, label %cond_exit_369.thread, label %__barray_mask_borrow.exit259 + +__barray_mask_borrow.exit259: ; preds = %__barray_check_bounds.exit255 + %121 = shl nuw nsw i64 1, %"366_0.0279", !dbg !12 + %122 = xor i64 %118, %121, !dbg !12 + store i64 %122, ptr %71, align 4, !dbg !12 + %123 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %70, i64 %"366_0.0279" + %124 = load { i1, i64, i1 }, ptr %123, align 4 + %.fca.0.extract167 = extractvalue { i1, i64, i1 } %124, 0 + br i1 %.fca.0.extract167, label %cond_392_case_1, label %cond_exit_369.thread + +cond_exit_369.thread: ; preds = %cond_392_case_1, %__barray_mask_borrow.exit259, %__barray_check_bounds.exit255 + %exitcond = icmp eq i64 %117, 10 + br i1 %exitcond, label %cond_369_case_0, label %__barray_check_bounds.exit255 + +cond_392_case_1: ; preds = %__barray_mask_borrow.exit259 + %.fca.1.extract = extractvalue { i1, i64, i1 } %124, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract) + br label %cond_exit_369.thread +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn @@ -27,434 +455,12 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !59 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.i - -cond_207_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 - -__hugr__.__tk2_qalloc.210.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.210.exit.8.i, %__hugr__.__tk2_qalloc.210.exit.7.i, %__hugr__.__tk2_qalloc.210.exit.6.i, %__hugr__.__tk2_qalloc.210.exit.5.i, %__hugr__.__tk2_qalloc.210.exit.4.i, %__hugr__.__tk2_qalloc.210.exit.3.i, %__hugr__.__tk2_qalloc.210.exit.2.i, %__hugr__.__tk2_qalloc.210.exit.1.i, %__hugr__.__tk2_qalloc.210.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -cond_exit_20.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.1.i - -__hugr__.__tk2_qalloc.210.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 - %.not280.i = icmp eq i64 %7, 0 - br i1 %.not280.i, label %panic.i.i, label %cond_exit_20.1.i - -cond_exit_20.1.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.2.i - -__hugr__.__tk2_qalloc.210.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 - %.not281.i = icmp eq i64 %11, 0 - br i1 %.not281.i, label %panic.i.i, label %cond_exit_20.2.i - -cond_exit_20.2.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.3.i - -__hugr__.__tk2_qalloc.210.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 - %.not282.i = icmp eq i64 %15, 0 - br i1 %.not282.i, label %panic.i.i, label %cond_exit_20.3.i - -cond_exit_20.3.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.4.i - -__hugr__.__tk2_qalloc.210.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 - %.not283.i = icmp eq i64 %19, 0 - br i1 %.not283.i, label %panic.i.i, label %cond_exit_20.4.i - -cond_exit_20.4.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.5.i - -__hugr__.__tk2_qalloc.210.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 - %.not284.i = icmp eq i64 %23, 0 - br i1 %.not284.i, label %panic.i.i, label %cond_exit_20.5.i - -cond_exit_20.5.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.6.i - -__hugr__.__tk2_qalloc.210.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 - %.not285.i = icmp eq i64 %27, 0 - br i1 %.not285.i, label %panic.i.i, label %cond_exit_20.6.i - -cond_exit_20.6.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.7.i - -__hugr__.__tk2_qalloc.210.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 - %.not286.i = icmp eq i64 %31, 0 - br i1 %.not286.i, label %panic.i.i, label %cond_exit_20.7.i - -cond_exit_20.7.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_case_0.i.i, label %__hugr__.__tk2_qalloc.210.exit.8.i - -__hugr__.__tk2_qalloc.210.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 - %.not287.i = icmp eq i64 %35, 0 - br i1 %.not287.i, label %panic.i.i, label %cond_exit_20.8.i - -cond_exit_20.8.i: ; preds = %__hugr__.__tk2_qalloc.210.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_207_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 - %.not288.i = icmp eq i64 %39, 0 - br i1 %.not288.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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.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.i238.i, label %__barray_mask_borrow.exit.i - -panic.i238.i: ; preds = %cond_exit_20.9.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.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.exit240.i, label %panic.i239.i - -panic.i239.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit240.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.exit242.i, label %panic.i241.i - -panic.i241.i: ; preds = %__barray_mask_return.exit240.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit242.i: ; preds = %__barray_mask_return.exit240.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 - %.not268.i = icmp eq i64 %54, 0 - br i1 %.not268.i, label %panic.i243.i, label %__barray_mask_return.exit244.i - -panic.i243.i: ; preds = %__barray_mask_borrow.exit242.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit244.i: ; preds = %__barray_mask_borrow.exit242.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 - %.not269.i = icmp eq i64 %57, 0 - br i1 %.not269.i, label %__barray_mask_borrow.exit246.i, label %panic.i245.i - -panic.i245.i: ; preds = %__barray_mask_return.exit244.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit246.i: ; preds = %__barray_mask_return.exit244.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 - %.not270.i = icmp eq i64 %61, 0 - br i1 %.not270.i, label %panic.i247.i, label %__barray_mask_return.exit248.i - -panic.i247.i: ; preds = %__barray_mask_borrow.exit246.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit248.i: ; preds = %__barray_mask_borrow.exit246.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 - %.not271.i = icmp eq i64 %64, 0 - br i1 %.not271.i, label %__barray_mask_borrow.exit250.i, label %panic.i249.i - -panic.i249.i: ; preds = %__barray_mask_return.exit248.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit250.i: ; preds = %__barray_mask_return.exit248.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 - %.not272.i = icmp eq i64 %68, 0 - br i1 %.not272.i, label %panic.i251.i, label %__barray_mask_return.exit252.i - -panic.i251.i: ; preds = %__barray_mask_borrow.exit250.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit252.i: ; preds = %__barray_mask_borrow.exit250.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 } %"116.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.extract82.i.i.i, 6 - %75 = getelementptr i64, ptr %.fca.1.extract81.i.i.i, i64 %74 - %76 = load i64, ptr %75, align 4 - %77 = and i64 %.fca.2.extract82.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.extract82.i.i.i, 9 - %83 = lshr i64 %last_valid.i.i.i.i, 6 - %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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).280.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).280.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, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit252.i - %.fca.2.extract82.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %.fca.2.extract82.i.i.i, %loop_body.i.i ] - %.fca.1.extract81.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit252.i ], [ %.fca.1.extract81.i.i.i, %loop_body.i.i ] - %.fca.0.extract80.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit252.i ], [ %.fca.0.extract80.i.i.i, %loop_body.i.i ] - %"306_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %95, %loop_body.i.i ] - %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit252.i ], [ %110, %loop_body.i.i ] - %95 = add nuw nsw i64 %"306_0.sroa.15.0184.i.i", 1 - %96 = add i64 %"306_0.sroa.15.0184.i.i", %.fca.2.extract82.i187.i.i - %97 = lshr i64 %96, 6 - %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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 = %__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.extract80.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, %"306_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, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"371_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 - %"371_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"371_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, %"306_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 %"306_0.sroa.15.0184.i.i" - store { i1, i64, i1 } %"371_054.fca.2.insert.i.i", ptr %113, align 4 - %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 - %.fca.0.extract80.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 - %.fca.1.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 - %.fca.2.extract82.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).280.exit.i": ; preds = %91, %73 - tail call void @heap_free(ptr %.fca.0.extract80.i.i.i) - tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i.i) - br label %__barray_check_bounds.exit255.i - -cond_89_case_0.i: ; preds = %cond_exit_89.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_89_case_0.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_check_bounds.exit255.i: ; preds = %cond_exit_89.thread.i, %"__hugr__.$measure_array$$n(10).280.exit.i" - %"92_0.0279.i" = phi i64 [ 0, %"__hugr__.$measure_array$$n(10).280.exit.i" ], [ %118, %cond_exit_89.thread.i ] - %118 = add nuw nsw i64 %"92_0.0279.i", 1 - %119 = load i64, ptr %72, align 4 - %120 = lshr i64 %119, %"92_0.0279.i" - %121 = trunc i64 %120 to i1 - br i1 %121, label %cond_exit_89.thread.i, label %__barray_mask_borrow.exit259.i - -__barray_mask_borrow.exit259.i: ; preds = %__barray_check_bounds.exit255.i - %122 = shl nuw nsw i64 1, %"92_0.0279.i" - %123 = xor i64 %119, %122 - store i64 %123, ptr %72, align 4 - %124 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %71, i64 %"92_0.0279.i" - %125 = load { i1, i64, i1 }, ptr %124, align 4 - %.fca.0.extract167.i = extractvalue { i1, i64, i1 } %125, 0 - br i1 %.fca.0.extract167.i, label %cond_392_case_1.i, label %cond_exit_89.thread.i - -cond_exit_89.thread.i: ; preds = %cond_392_case_1.i, %__barray_mask_borrow.exit259.i, %__barray_check_bounds.exit255.i - %exitcond.i = icmp eq i64 %118, 10 - br i1 %exitcond.i, label %cond_89_case_0.i, label %__barray_check_bounds.exit255.i - -cond_392_case_1.i: ; preds = %__barray_mask_borrow.exit259.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_89.thread.i - -__hugr__.main.1.exit: ; preds = %cond_89_case_0.i - tail call void @heap_free(ptr %71) - tail call void @heap_free(ptr nonnull %72) - %126 = tail call i64 @teardown() - ret i64 %126 + tail call void @setup(i64 %0), !dbg !63 + tail call void @"__hugr__.__main__.measure_qb_array..main.1"(), !dbg !63 + %1 = tail call i64 @teardown(), !dbg !63 + ret i64 %1, !dbg !63 } declare void @setup(i64) local_unnamed_addr @@ -463,6 +469,71 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "measure_qb_array..main", linkageName: "__hugr__.__main__.measure_qb_array..main.1", scope: null, file: !5, line: 101, type: !6, scopeLine: 102, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 102, column: 13, scope: !4) +!9 = !DILocation(line: 102, column: 19, scope: !4) +!10 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !11) +!11 = distinct !DILocation(line: 103, column: 10, scope: !4) +!12 = !DILocation(line: 103, column: 10, scope: !4) +!13 = !DILocation(line: 103, column: 8, scope: !4) +!14 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !15) +!15 = distinct !DILocation(line: 104, column: 10, scope: !4) +!16 = !DILocation(line: 104, column: 10, scope: !4) +!17 = !DILocation(line: 104, column: 8, scope: !4) +!18 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !19) +!19 = distinct !DILocation(line: 105, column: 10, scope: !4) +!20 = !DILocation(line: 105, column: 10, scope: !4) +!21 = !DILocation(line: 105, column: 8, scope: !4) +!22 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !23) +!23 = distinct !DILocation(line: 106, column: 10, scope: !4) +!24 = !DILocation(line: 106, column: 10, scope: !4) +!25 = !DILocation(line: 106, column: 8, scope: !4) +!26 = !DILocation(line: 84, column: 25, scope: !27, inlinedAt: !37) +!27 = distinct !DISubprogram(name: "std.array.array.__iter__$qubit&10", linkageName: "__hugr__.guppylang.std.array.array.__iter__$qubit&10.190", scope: null, file: !28, line: 83, type: !29, scopeLine: 84, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!28 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/array.py", directory: "") +!29 = !DISubroutineType(types: !30) +!30 = !{!31, !33} +!31 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { ptr, ptr, i64 }, i64 }", file: !2, size: 32, align: 8, elements: !32) +!32 = !{!33, !36} +!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !34) +!34 = !{!35, !35, !36} +!35 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!36 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!37 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!38 = distinct !DISubprogram(name: "std.quantum.measure_array$10", linkageName: "__hugr__.guppylang.std.quantum.measure_array$10.149", scope: null, file: !39, line: 380, type: !40, scopeLine: 382, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!39 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!40 = !DISubroutineType(types: !41) +!41 = !{!33, !33} +!42 = distinct !DILocation(line: 107, column: 8, scope: !4) +!43 = !DILocation(line: 382, column: 11, scope: !38, inlinedAt: !42) +!44 = !DILocation(line: 276, column: 8, scope: !45, inlinedAt: !53) +!45 = distinct !DISubprogram(name: "std.array.ArrayIter.__next__$qubit&10", linkageName: "__hugr__.guppylang.std.array.ArrayIter.__next__$qubit&10.202", scope: null, file: !28, line: 270, type: !46, scopeLine: 273, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!46 = !DISubroutineType(types: !47) +!47 = !{!48, !31} +!48 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, { { { ptr, ptr, i64 }, i64 }, i64 } }", file: !2, size: 40, align: 8, elements: !49) +!49 = !{!50, !51} +!50 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!51 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { { ptr, ptr, i64 }, i64 }, i64 }", file: !2, size: 40, align: 8, elements: !52) +!52 = !{!31, !36} +!53 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!54 = !DILocation(line: 275, column: 50, scope: !45, inlinedAt: !53) +!55 = !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!56 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !57) +!57 = distinct !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!58 = !DILocation(line: 273, column: 11, scope: !45, inlinedAt: !53) +!59 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !60, type: !61, spFlags: DISPFlagDefinition, unit: !1) +!60 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!61 = !DISubroutineType(types: !62) +!62 = !{!36, !36} +!63 = !DILocation(line: 0, scope: !59) 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 50ddd8eca..df22866bb 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 @@ -5,6 +5,26 @@ 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." +define void @"__hugr__.__main__.no_results..bar.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_18_case_0.i, label %__hugr__.__tk2_qalloc.14.exit, !dbg !8 + +cond_18_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.14.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___dec_future_refcount(i64 %lazy_measure) + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -22,26 +42,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + tail call void @"__hugr__.__main__.no_results..bar.1"(), !dbg !15 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr @@ -50,6 +56,23 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "no_results..bar", linkageName: "__hugr__.__main__.no_results..bar.1", scope: null, file: !5, line: 64, type: !6, scopeLine: 65, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 65, column: 20, scope: !4) +!9 = !DILocation(line: 66, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) 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 531f2c607..358d4805b 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 @@ -7,6 +7,38 @@ target triple = "aarch64-apple-darwin" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_exit..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_45_case_0.i, label %__hugr__.__tk2_qalloc.41.exit, !dbg !8 + +cond_45_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.41.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_98_case_1 + +cond_98_case_1: ; preds = %__hugr__.__tk2_qalloc.41.exit + %read_bool66 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.41.exit + tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_45_case_0.i.i, label %__hugr__.__tk2_qalloc.41.exit.i - -cond_45_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.41.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - %read_bool66.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_exit..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_exit..main", linkageName: "__hugr__.__main__.postselect_exit..main.1", scope: null, file: !5, line: 131, type: !6, scopeLine: 132, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 132, column: 12, scope: !4) +!9 = !DILocation(line: 133, column: 8, scope: !4) +!10 = !DILocation(line: 137, column: 8, scope: !4) +!11 = !DILocation(line: 136, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 fb5d96cd4..7d1a561f7 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 @@ -7,6 +7,38 @@ target triple = "aarch64-apple-darwin" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_panic..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_43_case_0.i, label %__hugr__.__tk2_qalloc.39.exit, !dbg !8 + +cond_43_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.39.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_96_case_1 + +cond_96_case_1: ; preds = %__hugr__.__tk2_qalloc.39.exit + %read_bool65 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.39.exit + tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_43_case_0.i.i, label %__hugr__.__tk2_qalloc.39.exit.i - -cond_43_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.39.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - %read_bool65.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_panic..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_panic..main", linkageName: "__hugr__.__main__.postselect_panic..main.1", scope: null, file: !5, line: 144, type: !6, scopeLine: 145, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 145, column: 12, scope: !4) +!9 = !DILocation(line: 146, column: 8, scope: !4) +!10 = !DILocation(line: 150, column: 8, scope: !4) +!11 = !DILocation(line: 149, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 47a2a4968..ed52d3abc 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 @@ -5,23 +5,50 @@ target triple = "aarch64-apple-darwin" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" +define void @"__hugr__.__main__.print_current_shot..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %shot = tail call i64 @get_current_shot(), !dbg !8 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot), !dbg !9 + ret void +} + declare i64 @get_current_shot() local_unnamed_addr declare void @print_int(ptr, i64, i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + %shot.i = tail call i64 @get_current_shot(), !dbg !16 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i), !dbg !18 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "print_current_shot..main", linkageName: "__hugr__.__main__.print_current_shot..main.1", scope: null, file: !5, line: 194, type: !6, scopeLine: 195, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 195, column: 23, scope: !4) +!9 = !DILocation(line: 195, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) +!16 = !DILocation(line: 195, column: 23, scope: !4, inlinedAt: !17) +!17 = distinct !DILocation(line: 0, scope: !10) +!18 = !DILocation(line: 195, column: 8, scope: !4, inlinedAt: !17) 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 634388234..02d59c7f9 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 @@ -11,6 +11,32 @@ target triple = "aarch64-apple-darwin" @res_rfloat2.4DAB941F.0 = private constant [19 x i8] c"\12USER:FLOAT:rfloat2" @res_rint_bnd2.169DE399.0 = private constant [19 x i8] c"\12USER:INT:rint_bnd2" +define void @"__hugr__.__main__.rng..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + tail call void @random_seed(i64 42), !dbg !8 + %rint = tail call i32 @random_int(), !dbg !17 + %rint14 = tail call i32 @random_int(), !dbg !18 + %rfloat = tail call double @random_float(), !dbg !19 + %rintb = tail call i32 @random_rng(i32 100), !dbg !20 + %0 = sext i32 %rintb to i64, !dbg !20 + %1 = sext i32 %rint14 to i64, !dbg !18 + %2 = sext i32 %rint to i64, !dbg !17 + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %2), !dbg !21 + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %1), !dbg !22 + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat), !dbg !23 + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %0), !dbg !24 + tail call void @random_seed(i64 84), !dbg !25 + %rint47 = tail call i32 @random_int(), !dbg !27 + %rfloat49 = tail call double @random_float(), !dbg !28 + %rintb52 = tail call i32 @random_rng(i32 200), !dbg !29 + %3 = sext i32 %rintb52 to i64, !dbg !29 + %4 = sext i32 %rint47 to i64, !dbg !27 + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %4), !dbg !30 + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat49), !dbg !31 + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %3), !dbg !32 + ret void +} + declare i32 @random_int() local_unnamed_addr declare double @random_float() local_unnamed_addr @@ -23,38 +49,57 @@ declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !33 { entry: - tail call void @setup(i64 %0) - tail call void @random_seed(i64 42) - %rint.i = tail call i32 @random_int() - %rint14.i = tail call i32 @random_int() - %rfloat.i = tail call double @random_float() - %rintb.i = tail call i32 @random_rng(i32 100) - %1 = sext i32 %rintb.i to i64 - %2 = sext i32 %rint14.i to i64 - %3 = sext i32 %rint.i to i64 - 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) - %rint47.i = tail call i32 @random_int() - %rfloat49.i = tail call double @random_float() - %rintb52.i = tail call i32 @random_rng(i32 200) - %4 = sext i32 %rintb52.i to i64 - %5 = sext i32 %rint47.i to i64 - 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 %rfloat49.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 + tail call void @setup(i64 %0), !dbg !37 + tail call void @"__hugr__.__main__.rng..main.1"(), !dbg !37 + %1 = tail call i64 @teardown(), !dbg !37 + ret i64 %1, !dbg !37 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} -!0 = !{!"mainlib"} +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rng..main", linkageName: "__hugr__.__main__.rng..main.1", scope: null, file: !5, line: 202, type: !6, scopeLine: 203, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !16) +!9 = distinct !DISubprogram(name: "std.qsystem.random.RNG.__new__", linkageName: "__hugr__.guppylang.std.qsystem.random.RNG.__new__.72", scope: null, file: !10, line: 42, type: !11, scopeLine: 44, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!10 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/qsystem/random.py", directory: "") +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !15} +!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !14) +!14 = !{} +!15 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!16 = distinct !DILocation(line: 203, column: 14, scope: !4) +!17 = !DILocation(line: 204, column: 15, scope: !4) +!18 = !DILocation(line: 205, column: 16, scope: !4) +!19 = !DILocation(line: 206, column: 17, scope: !4) +!20 = !DILocation(line: 207, column: 19, scope: !4) +!21 = !DILocation(line: 209, column: 8, scope: !4) +!22 = !DILocation(line: 210, column: 8, scope: !4) +!23 = !DILocation(line: 211, column: 8, scope: !4) +!24 = !DILocation(line: 212, column: 8, scope: !4) +!25 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !26) +!26 = distinct !DILocation(line: 213, column: 14, scope: !4) +!27 = !DILocation(line: 214, column: 15, scope: !4) +!28 = !DILocation(line: 215, column: 17, scope: !4) +!29 = !DILocation(line: 216, column: 19, scope: !4) +!30 = !DILocation(line: 218, column: 8, scope: !4) +!31 = !DILocation(line: 219, column: 8, scope: !4) +!32 = !DILocation(line: 220, column: 8, scope: !4) +!33 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !34, type: !35, spFlags: DISPFlagDefinition, unit: !1) +!34 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!35 = !DISubroutineType(types: !36) +!36 = !{!15, !15} +!37 = !DILocation(line: 0, scope: !33) 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 95ddd2420..261e661bf 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 @@ -6,6 +6,93 @@ target triple = "aarch64-apple-darwin" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.rus..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_87_case_0.i, label %__hugr__.__tk2_qalloc.83.exit, !dbg !8 + +cond_87_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.83.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + %qalloc.i132.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i133.i = icmp eq i64 %qalloc.i132.i, -1, !dbg !9 + br i1 %not_max.not.not.i133.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_101_case_0.i.i: ; preds = %cond_242_case_1.backedge.i, %__hugr__.__tk2_qalloc.83.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.97.exit.i: ; preds = %__hugr__.__tk2_qalloc.83.exit, %cond_242_case_1.backedge.i + %qalloc.i134.i = phi i64 [ %qalloc.i.i, %cond_242_case_1.backedge.i ], [ %qalloc.i132.i, %__hugr__.__tk2_qalloc.83.exit ] + tail call void @___reset(i64 %qalloc.i134.i), !dbg !9 + %qalloc.i128.i = tail call i64 @___qalloc(), !dbg !15 + %not_max.not.not.i129.i = icmp eq i64 %qalloc.i128.i, -1, !dbg !15 + br i1 %not_max.not.not.i129.i, label %cond_115_case_0.i.i, label %__hugr__.__tk2_qalloc.111.exit.i, !dbg !15 + +cond_115_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !15 + unreachable, !dbg !15 + +__hugr__.__tk2_qalloc.111.exit.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @___reset(i64 %qalloc.i128.i), !dbg !15 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !16 + tail call void @___rz(i64 %qalloc.i128.i, double 0x400921FB54442D18), !dbg !16 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0x400921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFE921FB54442D18), !dbg !18 + tail call void @___rxy(i64 %qalloc.i134.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rzz(i64 %qalloc.i128.i, i64 %qalloc.i134.i, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0x3FE921FB54442D18), !dbg !20 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i) + tail call void @___qfree(i64 %qalloc.i134.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 %cond_256_case_1.i, label %0 + +0: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___qfree(i64 %qalloc.i128.i), !dbg !21 + br label %cond_242_case_1.backedge.i + +cond_242_case_1.backedge.i: ; preds = %1, %0 + %qalloc.i.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1, !dbg !9 + br i1 %not_max.not.not.i.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_256_case_1.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___rz(i64 %qalloc.i, double 0x3FE921FB54442D18), !dbg !22 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !23 + tail call void @___rxy(i64 %qalloc.i128.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rzz(i64 %qalloc.i, i64 %qalloc.i128.i, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0x3FE921FB54442D18), !dbg !25 + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i) + tail call void @___qfree(i64 %qalloc.i128.i) + %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) + tail call void @___dec_future_refcount(i64 %lazy_measure67.i) + br i1 %read_bool80.i, label %"__hugr__.__main__.rus..rus.17.exit", label %1 + +1: ; preds = %cond_256_case_1.i + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !26 + br label %cond_242_case_1.backedge.i + +"__hugr__.__main__.rus..rus.17.exit": ; preds = %cond_256_case_1.i + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool), !dbg !27 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -29,93 +116,12 @@ declare void @___rz(i64, double) local_unnamed_addr declare void @___rzz(i64, i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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 = %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 = %__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.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 - -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 = %__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 %1 - -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 %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 %2 - -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 %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(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) - %3 = tail call i64 @teardown() - ret i64 %3 + tail call void @setup(i64 %0), !dbg !30 + tail call void @"__hugr__.__main__.rus..main.1"(), !dbg !30 + %1 = tail call i64 @teardown(), !dbg !30 + ret i64 %1, !dbg !30 } declare void @setup(i64) local_unnamed_addr @@ -124,6 +130,38 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rus..main", linkageName: "__hugr__.__main__.rus..main.1", scope: null, file: !5, line: 184, type: !6, scopeLine: 185, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 185, column: 12, scope: !4) +!9 = !DILocation(line: 160, column: 19, scope: !10, inlinedAt: !14) +!10 = distinct !DISubprogram(name: "rus..rus", linkageName: "__hugr__.__main__.rus..rus.17", scope: null, file: !5, line: 157, type: !11, scopeLine: 158, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !13} +!13 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!14 = distinct !DILocation(line: 186, column: 8, scope: !4) +!15 = !DILocation(line: 160, column: 28, scope: !10, inlinedAt: !14) +!16 = !DILocation(line: 162, column: 12, scope: !10, inlinedAt: !14) +!17 = !DILocation(line: 161, column: 12, scope: !10, inlinedAt: !14) +!18 = !DILocation(line: 164, column: 12, scope: !10, inlinedAt: !14) +!19 = !DILocation(line: 165, column: 12, scope: !10, inlinedAt: !14) +!20 = !DILocation(line: 166, column: 12, scope: !10, inlinedAt: !14) +!21 = !DILocation(line: 169, column: 16, scope: !10, inlinedAt: !14) +!22 = !DILocation(line: 172, column: 12, scope: !10, inlinedAt: !14) +!23 = !DILocation(line: 173, column: 12, scope: !10, inlinedAt: !14) +!24 = !DILocation(line: 174, column: 12, scope: !10, inlinedAt: !14) +!25 = !DILocation(line: 175, column: 12, scope: !10, inlinedAt: !14) +!26 = !DILocation(line: 181, column: 12, scope: !10, inlinedAt: !14) +!27 = !DILocation(line: 187, column: 8, scope: !4) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !11, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DILocation(line: 0, scope: !28) 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 87a59b320..24ec6374c 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 @@ -4,284 +4,363 @@ target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80: 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" -@"e_Array elem.E746B1A3.0" = private constant [43 x i8] c"*EXIT:INT:Array element is already borrowed" @"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." +define void @"__hugr__.__main__.discard_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_233_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_233_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_233_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not = icmp eq i64 %6, 0 + br i1 %.not, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_233_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not108 = icmp eq i64 %10, 0 + br i1 %.not108, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_233_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not109 = icmp eq i64 %14, 0 + br i1 %.not109, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_233_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not110 = icmp eq i64 %18, 0 + br i1 %.not110, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_233_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not111 = icmp eq i64 %22, 0 + br i1 %.not111, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_233_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not112 = icmp eq i64 %26, 0 + br i1 %.not112, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_233_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not113 = icmp eq i64 %30, 0 + br i1 %.not113, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_233_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not114 = icmp eq i64 %34, 0 + br i1 %.not114, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_233_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not115 = icmp eq i64 %38, 0 + br i1 %.not115, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %cond_171_case_1.1.i, label %__barray_mask_borrow.exit.i + +cond_171_case_1.1.i: ; preds = %__barray_mask_borrow.exit.i, %cond_exit_20.9 + %43 = phi i64 [ %41, %cond_exit_20.9 ], [ %.pre.i, %__barray_mask_borrow.exit.i ], !dbg !10 + %44 = and i64 %43, 2, !dbg !10 + %.not.i = icmp eq i64 %44, 0, !dbg !10 + br i1 %.not.i, label %__barray_mask_borrow.exit.1.i, label %cond_171_case_1.2.i + +__barray_mask_borrow.exit.1.i: ; preds = %cond_171_case_1.1.i + %45 = or disjoint i64 %43, 2, !dbg !21 + store i64 %45, ptr %1, align 4, !dbg !21 + %46 = getelementptr inbounds nuw i8, ptr %0, i64 8, !dbg !23 + %47 = load i64, ptr %46, align 4, !dbg !23 + tail call void @___qfree(i64 %47), !dbg !24 + %.pre337.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.2.i + +cond_171_case_1.2.i: ; preds = %__barray_mask_borrow.exit.1.i, %cond_171_case_1.1.i + %48 = phi i64 [ %.pre337.i, %__barray_mask_borrow.exit.1.i ], [ %43, %cond_171_case_1.1.i ], !dbg !10 + %49 = and i64 %48, 4, !dbg !10 + %.not345.i = icmp eq i64 %49, 0, !dbg !10 + br i1 %.not345.i, label %__barray_mask_borrow.exit.2.i, label %cond_171_case_1.3.i + +__barray_mask_borrow.exit.2.i: ; preds = %cond_171_case_1.2.i + %50 = or disjoint i64 %48, 4, !dbg !21 + store i64 %50, ptr %1, align 4, !dbg !21 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !23 + %52 = load i64, ptr %51, align 4, !dbg !23 + tail call void @___qfree(i64 %52), !dbg !24 + %.pre338.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.3.i + +cond_171_case_1.3.i: ; preds = %__barray_mask_borrow.exit.2.i, %cond_171_case_1.2.i + %53 = phi i64 [ %.pre338.i, %__barray_mask_borrow.exit.2.i ], [ %48, %cond_171_case_1.2.i ], !dbg !10 + %54 = and i64 %53, 8, !dbg !10 + %.not346.i = icmp eq i64 %54, 0, !dbg !10 + br i1 %.not346.i, label %__barray_mask_borrow.exit.3.i, label %cond_171_case_1.4.i + +__barray_mask_borrow.exit.3.i: ; preds = %cond_171_case_1.3.i + %55 = or disjoint i64 %53, 8, !dbg !21 + store i64 %55, ptr %1, align 4, !dbg !21 + %56 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !23 + %57 = load i64, ptr %56, align 4, !dbg !23 + tail call void @___qfree(i64 %57), !dbg !24 + %.pre339.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.4.i + +cond_171_case_1.4.i: ; preds = %__barray_mask_borrow.exit.3.i, %cond_171_case_1.3.i + %58 = phi i64 [ %.pre339.i, %__barray_mask_borrow.exit.3.i ], [ %53, %cond_171_case_1.3.i ], !dbg !10 + %59 = and i64 %58, 16, !dbg !10 + %.not347.i = icmp eq i64 %59, 0, !dbg !10 + br i1 %.not347.i, label %__barray_mask_borrow.exit.4.i, label %cond_171_case_1.5.i + +__barray_mask_borrow.exit.4.i: ; preds = %cond_171_case_1.4.i + %60 = or disjoint i64 %58, 16, !dbg !21 + store i64 %60, ptr %1, align 4, !dbg !21 + %61 = getelementptr inbounds nuw i8, ptr %0, i64 32, !dbg !23 + %62 = load i64, ptr %61, align 4, !dbg !23 + tail call void @___qfree(i64 %62), !dbg !24 + %.pre340.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.5.i + +cond_171_case_1.5.i: ; preds = %__barray_mask_borrow.exit.4.i, %cond_171_case_1.4.i + %63 = phi i64 [ %.pre340.i, %__barray_mask_borrow.exit.4.i ], [ %58, %cond_171_case_1.4.i ], !dbg !10 + %64 = and i64 %63, 32, !dbg !10 + %.not348.i = icmp eq i64 %64, 0, !dbg !10 + br i1 %.not348.i, label %__barray_mask_borrow.exit.5.i, label %cond_171_case_1.6.i + +__barray_mask_borrow.exit.5.i: ; preds = %cond_171_case_1.5.i + %65 = or disjoint i64 %63, 32, !dbg !21 + store i64 %65, ptr %1, align 4, !dbg !21 + %66 = getelementptr inbounds nuw i8, ptr %0, i64 40, !dbg !23 + %67 = load i64, ptr %66, align 4, !dbg !23 + tail call void @___qfree(i64 %67), !dbg !24 + %.pre341.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.6.i + +cond_171_case_1.6.i: ; preds = %__barray_mask_borrow.exit.5.i, %cond_171_case_1.5.i + %68 = phi i64 [ %.pre341.i, %__barray_mask_borrow.exit.5.i ], [ %63, %cond_171_case_1.5.i ], !dbg !10 + %69 = and i64 %68, 64, !dbg !10 + %.not349.i = icmp eq i64 %69, 0, !dbg !10 + br i1 %.not349.i, label %__barray_mask_borrow.exit.6.i, label %cond_171_case_1.7.i + +__barray_mask_borrow.exit.6.i: ; preds = %cond_171_case_1.6.i + %70 = or disjoint i64 %68, 64, !dbg !21 + store i64 %70, ptr %1, align 4, !dbg !21 + %71 = getelementptr inbounds nuw i8, ptr %0, i64 48, !dbg !23 + %72 = load i64, ptr %71, align 4, !dbg !23 + tail call void @___qfree(i64 %72), !dbg !24 + %.pre342.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.7.i + +cond_171_case_1.7.i: ; preds = %__barray_mask_borrow.exit.6.i, %cond_171_case_1.6.i + %73 = phi i64 [ %.pre342.i, %__barray_mask_borrow.exit.6.i ], [ %68, %cond_171_case_1.6.i ], !dbg !10 + %74 = and i64 %73, 128, !dbg !10 + %.not350.i = icmp eq i64 %74, 0, !dbg !10 + br i1 %.not350.i, label %__barray_mask_borrow.exit.7.i, label %cond_171_case_1.8.i + +__barray_mask_borrow.exit.7.i: ; preds = %cond_171_case_1.7.i + %75 = or disjoint i64 %73, 128, !dbg !21 + store i64 %75, ptr %1, align 4, !dbg !21 + %76 = getelementptr inbounds nuw i8, ptr %0, i64 56, !dbg !23 + %77 = load i64, ptr %76, align 4, !dbg !23 + tail call void @___qfree(i64 %77), !dbg !24 + %.pre343.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.8.i + +cond_171_case_1.8.i: ; preds = %__barray_mask_borrow.exit.7.i, %cond_171_case_1.7.i + %78 = phi i64 [ %.pre343.i, %__barray_mask_borrow.exit.7.i ], [ %73, %cond_171_case_1.7.i ], !dbg !10 + %79 = and i64 %78, 256, !dbg !10 + %.not351.i = icmp eq i64 %79, 0, !dbg !10 + br i1 %.not351.i, label %__barray_mask_borrow.exit.8.i, label %__barray_check_bounds.exit.9.i + +__barray_mask_borrow.exit.8.i: ; preds = %cond_171_case_1.8.i + %80 = or disjoint i64 %78, 256, !dbg !21 + store i64 %80, ptr %1, align 4, !dbg !21 + %81 = getelementptr inbounds nuw i8, ptr %0, i64 64, !dbg !23 + %82 = load i64, ptr %81, align 4, !dbg !23 + tail call void @___qfree(i64 %82), !dbg !24 + %.pre = load i64, ptr %1, align 4, !dbg !10 + br label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %__barray_mask_borrow.exit.8.i, %cond_171_case_1.8.i + %83 = phi i64 [ %.pre, %__barray_mask_borrow.exit.8.i ], [ %78, %cond_171_case_1.8.i ], !dbg !10 + %84 = and i64 %83, 512, !dbg !10 + %.not352.i = icmp eq i64 %84, 0, !dbg !10 + br i1 %.not352.i, label %__barray_mask_borrow.exit.9.i, label %cond_exit_156.i + +__barray_mask_borrow.exit.9.i: ; preds = %__barray_check_bounds.exit.9.i + %85 = or disjoint i64 %83, 512, !dbg !21 + store i64 %85, ptr %1, align 4, !dbg !21 + %86 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !23 + %87 = load i64, ptr %86, align 4, !dbg !23 + tail call void @___qfree(i64 %87), !dbg !24 + %.pre344.i = load i64, ptr %1, align 4, !dbg !25 + br label %cond_exit_156.i + +cond_exit_156.i: ; preds = %__barray_mask_borrow.exit.9.i, %__barray_check_bounds.exit.9.i + %88 = phi i64 [ %.pre344.i, %__barray_mask_borrow.exit.9.i ], [ %83, %__barray_check_bounds.exit.9.i ], !dbg !25 + %89 = or i64 %88, -1024, !dbg !25 + store i64 %89, ptr %1, align 4, !dbg !25 + %90 = icmp eq i64 %89, -1, !dbg !25 + br i1 %90, label %"__hugr__.guppylang.std.quantum.discard_array$10.113.exit", label %mask_block_err.i.i, !dbg !25 + +mask_block_err.i.i: ; preds = %cond_exit_156.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !25 + unreachable, !dbg !25 + +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.9 + %91 = or disjoint i64 %41, 1, !dbg !21 + store i64 %91, ptr %1, align 4, !dbg !21 + %92 = load i64, ptr %0, align 4, !dbg !23 + tail call void @___qfree(i64 %92), !dbg !24 + %.pre.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.1.i + +"__hugr__.guppylang.std.quantum.discard_array$10.113.exit": ; preds = %cond_exit_156.i + tail call void @heap_free(ptr nonnull %0), !dbg !27 + tail call void @heap_free(ptr nonnull %1), !dbg !27 + ret void +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @___qfree(i64) local_unnamed_addr - declare void @heap_free(ptr) local_unnamed_addr +declare void @___qfree(i64) local_unnamed_addr + declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_213_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_213_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 = %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 - %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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert.i", i64 0, 2 - %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert.i", 0 - br label %__barray_check_bounds.exit.i.i.i - -43: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i", %cond_exit_20.i.9 - %.fca.2.extract82.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.1.extract81.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.0.extract80.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %"294_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %65 = add i64 %"294_0.0182.i.i", %.fca.2.extract82.i185.i.i - %66 = lshr i64 %65, 6 - %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i - %72 = add nuw nsw i64 %"294_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.extract80.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 %"294_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 + tail call void @setup(i64 %0), !dbg !32 + tail call void @"__hugr__.__main__.discard_qb_array..main.1"(), !dbg !32 + %1 = tail call i64 @teardown(), !dbg !32 + ret i64 %1, !dbg !32 } declare void @setup(i64) local_unnamed_addr @@ -290,6 +369,40 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "discard_qb_array..main", linkageName: "__hugr__.__main__.discard_qb_array..main.1", scope: null, file: !5, line: 92, type: !6, scopeLine: 93, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 93, column: 13, scope: !4) +!9 = !DILocation(line: 93, column: 19, scope: !4) +!10 = !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !19) +!11 = distinct !DISubprogram(name: "std.quantum.discard_array$10", linkageName: "__hugr__.guppylang.std.quantum.discard_array$10.113", scope: null, file: !12, line: 387, type: !13, scopeLine: 389, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!12 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!13 = !DISubroutineType(types: !14) +!14 = !{null, !15} +!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !16) +!16 = !{!17, !17, !18} +!17 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!18 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!19 = distinct !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !20) +!20 = distinct !DILocation(line: 94, column: 8, scope: !4) +!21 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !22) +!22 = distinct !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!23 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!24 = !DILocation(line: 391, column: 12, scope: !11, inlinedAt: !20) +!25 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !26) +!26 = distinct !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!27 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !30, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DISubroutineType(types: !31) +!31 = !{!18, !18} +!32 = !DILocation(line: 0, scope: !28) 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 692aab40e..591fc3b9f 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 @@ -9,6 +9,74 @@ target triple = "x86_64-apple-darwin" @res_c3.B223E16D.0 = private constant [13 x i8] c"\0CUSER:BOOL:c3" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.flip_some..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_40_case_0.i, label %__hugr__.__tk2_qalloc.36.exit, !dbg !8 + +cond_40_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.36.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !9 + %qalloc.i101 = tail call i64 @___qalloc(), !dbg !10 + %not_max.not.not.i102 = icmp eq i64 %qalloc.i101, -1, !dbg !10 + br i1 %not_max.not.not.i102, label %cond_54_case_0.i, label %__hugr__.__tk2_qalloc.50.exit, !dbg !10 + +cond_54_case_0.i: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !10 + unreachable, !dbg !10 + +__hugr__.__tk2_qalloc.50.exit: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @___reset(i64 %qalloc.i101), !dbg !10 + %qalloc.i103 = tail call i64 @___qalloc(), !dbg !11 + %not_max.not.not.i104 = icmp eq i64 %qalloc.i103, -1, !dbg !11 + br i1 %not_max.not.not.i104, label %cond_68_case_0.i, label %__hugr__.__tk2_qalloc.64.exit, !dbg !11 + +cond_68_case_0.i: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !11 + unreachable, !dbg !11 + +__hugr__.__tk2_qalloc.64.exit: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @___reset(i64 %qalloc.i103), !dbg !11 + tail call void @___rxy(i64 %qalloc.i103, double 0x400921FB54442D18, double 0.000000e+00), !dbg !12 + %qalloc.i105 = tail call i64 @___qalloc(), !dbg !13 + %not_max.not.not.i106 = icmp eq i64 %qalloc.i105, -1, !dbg !13 + br i1 %not_max.not.not.i106, label %cond_82_case_0.i, label %__hugr__.__tk2_qalloc.78.exit, !dbg !13 + +cond_82_case_0.i: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !13 + unreachable, !dbg !13 + +__hugr__.__tk2_qalloc.78.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @___reset(i64 %qalloc.i105), !dbg !13 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool), !dbg !14 + %lazy_measure22 = tail call i64 @___lazy_measure(i64 %qalloc.i101) + tail call void @___qfree(i64 %qalloc.i101) + %read_bool35 = tail call i1 @___read_future_bool(i64 %lazy_measure22) + tail call void @___dec_future_refcount(i64 %lazy_measure22) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35), !dbg !15 + %lazy_measure44 = tail call i64 @___lazy_measure(i64 %qalloc.i103) + tail call void @___qfree(i64 %qalloc.i103) + %read_bool57 = tail call i1 @___read_future_bool(i64 %lazy_measure44) + tail call void @___dec_future_refcount(i64 %lazy_measure44) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57), !dbg !16 + tail call void @___rxy(i64 %qalloc.i105, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %lazy_measure67 = tail call i64 @___lazy_measure(i64 %qalloc.i105) + tail call void @___qfree(i64 %qalloc.i105) + %read_bool80 = tail call i1 @___read_future_bool(i64 %lazy_measure67) + tail call void @___dec_future_refcount(i64 %lazy_measure67) + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80), !dbg !18 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -28,74 +96,12 @@ declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !19 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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.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 - -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 = %__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 = %__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 = %__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 = %__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(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(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(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(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !24 + tail call void @"__hugr__.__main__.flip_some..main.1"(), !dbg !24 + %1 = tail call i64 @teardown(), !dbg !24 + ret i64 %1, !dbg !24 } declare void @setup(i64) local_unnamed_addr @@ -104,6 +110,32 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "flip_some..main", linkageName: "__hugr__.__main__.flip_some..main.1", scope: null, file: !5, line: 74, type: !6, scopeLine: 75, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 75, column: 20, scope: !4) +!9 = !DILocation(line: 79, column: 8, scope: !4) +!10 = !DILocation(line: 76, column: 20, scope: !4) +!11 = !DILocation(line: 77, column: 20, scope: !4) +!12 = !DILocation(line: 80, column: 8, scope: !4) +!13 = !DILocation(line: 78, column: 20, scope: !4) +!14 = !DILocation(line: 82, column: 8, scope: !4) +!15 = !DILocation(line: 83, column: 8, scope: !4) +!16 = !DILocation(line: 84, column: 8, scope: !4) +!17 = !DILocation(line: 81, column: 8, scope: !4) +!18 = !DILocation(line: 85, column: 8, scope: !4) +!19 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !20, type: !21, spFlags: DISPFlagDefinition, unit: !1) +!20 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!21 = !DISubroutineType(types: !22) +!22 = !{!23, !23} +!23 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!24 = !DILocation(line: 0, scope: !19) 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 e17eddfda..f3acc089a 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 @@ -8,6 +8,606 @@ 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." +define void @"__hugr__.__main__.measure_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_299_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_299_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_299_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not299 = icmp eq i64 %6, 0 + br i1 %.not299, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_299_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not300 = icmp eq i64 %10, 0 + br i1 %.not300, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_299_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not301 = icmp eq i64 %14, 0 + br i1 %.not301, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_299_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not302 = icmp eq i64 %18, 0 + br i1 %.not302, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_299_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not303 = icmp eq i64 %22, 0 + br i1 %.not303, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_299_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not304 = icmp eq i64 %26, 0 + br i1 %.not304, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_299_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not305 = icmp eq i64 %30, 0 + br i1 %.not305, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_299_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not306 = icmp eq i64 %34, 0 + br i1 %.not306, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_299_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not307 = icmp eq i64 %38, 0 + br i1 %.not307, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %"116.fca.0.insert" = insertvalue { ptr, ptr, i64 } poison, ptr %0, 0 + %"116.fca.1.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert", ptr %1, 1 + %"116.fca.2.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert", i64 0, 2 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %panic.i238, label %__barray_mask_borrow.exit, !dbg !10 + +panic.i238: ; preds = %cond_exit_20.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !10 + unreachable, !dbg !10 + +__barray_mask_borrow.exit: ; preds = %cond_exit_20.9 + %43 = or disjoint i64 %41, 1, !dbg !10 + store i64 %43, ptr %1, align 4, !dbg !10 + %44 = load i64, ptr %0, align 4, !dbg !12 + tail call void @___rxy(i64 %44, double 0x400921FB54442D18, double 0.000000e+00), !dbg !13 + %45 = load i64, ptr %1, align 4, !dbg !12 + %46 = trunc i64 %45 to i1, !dbg !12 + br i1 %46, label %__barray_mask_return.exit240, label %panic.i239, !dbg !12 + +panic.i239: ; preds = %__barray_mask_borrow.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !12 + unreachable, !dbg !12 + +__barray_mask_return.exit240: ; preds = %__barray_mask_borrow.exit + %47 = and i64 %45, -2, !dbg !12 + store i64 %47, ptr %1, align 4, !dbg !12 + store i64 %44, ptr %0, align 4, !dbg !12 + %48 = load i64, ptr %1, align 4, !dbg !14 + %49 = and i64 %48, 4, !dbg !14 + %.not = icmp eq i64 %49, 0, !dbg !14 + br i1 %.not, label %__barray_mask_borrow.exit242, label %panic.i241, !dbg !14 + +panic.i241: ; preds = %__barray_mask_return.exit240 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !14 + unreachable, !dbg !14 + +__barray_mask_borrow.exit242: ; preds = %__barray_mask_return.exit240 + %50 = or disjoint i64 %48, 4, !dbg !14 + store i64 %50, ptr %1, align 4, !dbg !14 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !16 + %52 = load i64, ptr %51, align 4, !dbg !16 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %53 = load i64, ptr %1, align 4, !dbg !16 + %54 = and i64 %53, 4, !dbg !16 + %.not268 = icmp eq i64 %54, 0, !dbg !16 + br i1 %.not268, label %panic.i243, label %__barray_mask_return.exit244, !dbg !16 + +panic.i243: ; preds = %__barray_mask_borrow.exit242 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !16 + unreachable, !dbg !16 + +__barray_mask_return.exit244: ; preds = %__barray_mask_borrow.exit242 + %55 = and i64 %53, -5, !dbg !16 + store i64 %55, ptr %1, align 4, !dbg !16 + store i64 %52, ptr %51, align 4, !dbg !16 + %56 = load i64, ptr %1, align 4, !dbg !18 + %57 = and i64 %56, 8, !dbg !18 + %.not269 = icmp eq i64 %57, 0, !dbg !18 + br i1 %.not269, label %__barray_mask_borrow.exit246, label %panic.i245, !dbg !18 + +panic.i245: ; preds = %__barray_mask_return.exit244 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !18 + unreachable, !dbg !18 + +__barray_mask_borrow.exit246: ; preds = %__barray_mask_return.exit244 + %58 = or disjoint i64 %56, 8, !dbg !18 + store i64 %58, ptr %1, align 4, !dbg !18 + %59 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !20 + %60 = load i64, ptr %59, align 4, !dbg !20 + tail call void @___rxy(i64 %60, double 0x400921FB54442D18, double 0.000000e+00), !dbg !21 + %61 = load i64, ptr %1, align 4, !dbg !20 + %62 = and i64 %61, 8, !dbg !20 + %.not270 = icmp eq i64 %62, 0, !dbg !20 + br i1 %.not270, label %panic.i247, label %__barray_mask_return.exit248, !dbg !20 + +panic.i247: ; preds = %__barray_mask_borrow.exit246 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !20 + unreachable, !dbg !20 + +__barray_mask_return.exit248: ; preds = %__barray_mask_borrow.exit246 + %63 = and i64 %61, -9, !dbg !20 + store i64 %63, ptr %1, align 4, !dbg !20 + store i64 %60, ptr %59, align 4, !dbg !20 + %64 = load i64, ptr %1, align 4, !dbg !22 + %65 = and i64 %64, 512, !dbg !22 + %.not271 = icmp eq i64 %65, 0, !dbg !22 + br i1 %.not271, label %__barray_mask_borrow.exit250, label %panic.i249, !dbg !22 + +panic.i249: ; preds = %__barray_mask_return.exit248 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !22 + unreachable, !dbg !22 + +__barray_mask_borrow.exit250: ; preds = %__barray_mask_return.exit248 + %66 = or disjoint i64 %64, 512, !dbg !22 + store i64 %66, ptr %1, align 4, !dbg !22 + %67 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !24 + %68 = load i64, ptr %67, align 4, !dbg !24 + tail call void @___rxy(i64 %68, double 0x400921FB54442D18, double 0.000000e+00), !dbg !25 + %69 = load i64, ptr %1, align 4, !dbg !24 + %70 = and i64 %69, 512, !dbg !24 + %.not272 = icmp eq i64 %70, 0, !dbg !24 + br i1 %.not272, label %panic.i251, label %__barray_mask_return.exit252, !dbg !24 + +panic.i251: ; preds = %__barray_mask_borrow.exit250 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !24 + unreachable, !dbg !24 + +__barray_mask_return.exit252: ; preds = %__barray_mask_borrow.exit250 + %71 = and i64 %69, -513, !dbg !24 + store i64 %71, ptr %1, align 4, !dbg !24 + store i64 %68, ptr %67, align 4, !dbg !24 + %72 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert", 0, !dbg !26 + %73 = tail call ptr @heap_alloc(i64 240), !dbg !43 + %74 = tail call ptr @heap_alloc(i64 8), !dbg !43 + store i64 -1, ptr %74, align 1, !dbg !43 + br label %__barray_check_bounds.exit.i.i + +75: ; preds = %loop_body.i + %76 = lshr i64 %.fca.2.extract82.i.i, 6, !dbg !44 + %77 = getelementptr i64, ptr %.fca.1.extract81.i.i, i64 %76, !dbg !44 + %78 = load i64, ptr %77, align 4, !dbg !44 + %79 = and i64 %.fca.2.extract82.i.i, 63, !dbg !44 + %80 = sub nuw nsw i64 64, %79, !dbg !44 + %81 = lshr i64 -1, %80, !dbg !44 + %82 = icmp eq i64 %79, 0, !dbg !44 + %83 = select i1 %82, i64 0, i64 %81, !dbg !44 + %84 = or i64 %78, %83, !dbg !44 + store i64 %84, ptr %77, align 4, !dbg !44 + %last_valid.i.i.i = add i64 %.fca.2.extract82.i.i, 9, !dbg !44 + %85 = lshr i64 %last_valid.i.i.i, 6, !dbg !44 + %86 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i.i, i64 %85, !dbg !44 + %87 = load i64, ptr %86, align 4, !dbg !44 + %88 = and i64 %last_valid.i.i.i, 63, !dbg !44 + %89 = shl nsw i64 -2, %88, !dbg !44 + %90 = icmp eq i64 %88, 63, !dbg !44 + %91 = select i1 %90, i64 0, i64 %89, !dbg !44 + %92 = or i64 %87, %91, !dbg !44 + store i64 %92, ptr %86, align 4, !dbg !44 + %reass.sub.i.i.i = sub nsw i64 %85, %76, !dbg !44 + %.not.i.i.i = icmp eq i64 %reass.sub.i.i.i, -1, !dbg !44 + br i1 %.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +93: ; preds = %mask_block_ok.i.i.i + %94 = add nuw i64 %.02.i.i.i, 1, !dbg !44 + %exitcond.not.i.i.i = icmp eq i64 %.02.i.i.i, %reass.sub.i.i.i, !dbg !44 + br i1 %exitcond.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +mask_block_ok.i.i.i: ; preds = %75, %93 + %.02.i.i.i = phi i64 [ %94, %93 ], [ 0, %75 ], !dbg !44 + %gep.i.i.i = getelementptr i64, ptr %77, i64 %.02.i.i.i, !dbg !44 + %95 = load i64, ptr %gep.i.i.i, align 4, !dbg !44 + %96 = icmp eq i64 %95, -1, !dbg !44 + br i1 %96, label %93, label %mask_block_err.i.i.i, !dbg !44 + +mask_block_err.i.i.i: ; preds = %mask_block_ok.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !44 + unreachable, !dbg !44 + +__barray_check_bounds.exit.i.i: ; preds = %loop_body.i, %__barray_mask_return.exit252 + %.fca.2.extract82.i187.i = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %.fca.2.extract82.i.i, %loop_body.i ] + %.fca.1.extract81.i186.i = phi ptr [ %1, %__barray_mask_return.exit252 ], [ %.fca.1.extract81.i.i, %loop_body.i ] + %.fca.0.extract80.i185.i = phi ptr [ %0, %__barray_mask_return.exit252 ], [ %.fca.0.extract80.i.i, %loop_body.i ] + %"163_0.sroa.15.0184.i" = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %97, %loop_body.i ] + %.pn165183.i = phi { { ptr, ptr, i64 }, i64 } [ %72, %__barray_mask_return.exit252 ], [ %112, %loop_body.i ] + %97 = add nuw nsw i64 %"163_0.sroa.15.0184.i", 1, !dbg !54 + %98 = add i64 %"163_0.sroa.15.0184.i", %.fca.2.extract82.i187.i, !dbg !55 + %99 = lshr i64 %98, 6, !dbg !56 + %100 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i186.i, i64 %99, !dbg !56 + %101 = load i64, ptr %100, align 4, !dbg !56 + %102 = and i64 %98, 63, !dbg !56 + %103 = lshr i64 %101, %102, !dbg !56 + %104 = trunc i64 %103 to i1, !dbg !56 + br i1 %104, label %panic.i.i.i, label %__barray_check_bounds.exit.i, !dbg !56 + +panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !56 + unreachable, !dbg !56 + +__barray_check_bounds.exit.i: ; preds = %__barray_check_bounds.exit.i.i + %105 = shl nuw i64 1, %102, !dbg !56 + %106 = xor i64 %105, %101, !dbg !56 + store i64 %106, ptr %100, align 4, !dbg !56 + %107 = getelementptr inbounds i64, ptr %.fca.0.extract80.i185.i, i64 %98, !dbg !55 + %108 = load i64, ptr %107, align 4, !dbg !55 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %108) + tail call void @___qfree(i64 %108) + %109 = load i64, ptr %74, align 4 + %110 = lshr i64 %109, %"163_0.sroa.15.0184.i" + %111 = trunc i64 %110 to i1 + br i1 %111, label %loop_body.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +loop_body.i: ; preds = %__barray_check_bounds.exit.i + %"182_054.fca.1.insert.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i, 1 + %"182_054.fca.2.insert.i" = insertvalue { i1, i64, i1 } %"182_054.fca.1.insert.i", i1 undef, 2 + %112 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, i64 %97, 1 + %113 = shl nuw nsw i64 1, %"163_0.sroa.15.0184.i" + %114 = xor i64 %109, %113 + store i64 %114, ptr %74, align 4 + %115 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %73, i64 %"163_0.sroa.15.0184.i" + store { i1, i64, i1 } %"182_054.fca.2.insert.i", ptr %115, align 4 + %116 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, 0 + %.fca.0.extract80.i.i = extractvalue { ptr, ptr, i64 } %116, 0 + %.fca.1.extract81.i.i = extractvalue { ptr, ptr, i64 } %116, 1 + %.fca.2.extract82.i.i = extractvalue { ptr, ptr, i64 } %116, 2 + %exitcond.not.i = icmp eq i64 %97, 10, !dbg !58 + br i1 %exitcond.not.i, label %75, label %__barray_check_bounds.exit.i.i + +"__hugr__.guppylang.std.quantum.measure_array$10.149.exit": ; preds = %93, %75 + tail call void @heap_free(ptr %.fca.0.extract80.i.i), !dbg !44 + tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i), !dbg !44 + %117 = load i64, ptr %74, align 4 + %118 = trunc i64 %117 to i1 + br i1 %118, label %cond_exit_369.thread, label %__barray_mask_borrow.exit259 + +cond_exit_369: ; preds = %cond_exit_369.thread.9 + tail call void @heap_free(ptr %73) + tail call void @heap_free(ptr nonnull %74) + ret void + +mask_block_err.i: ; preds = %cond_exit_369.thread.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") + unreachable + +__barray_mask_borrow.exit259: ; preds = %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %119 = or disjoint i64 %117, 1, !dbg !12 + store i64 %119, ptr %74, align 4, !dbg !12 + %120 = load { i1, i64, i1 }, ptr %73, align 4 + %.fca.0.extract167 = extractvalue { i1, i64, i1 } %120, 0 + br i1 %.fca.0.extract167, label %cond_392_case_1, label %cond_exit_369.thread + +cond_exit_369.thread: ; preds = %cond_392_case_1, %__barray_mask_borrow.exit259, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %121 = phi i64 [ %.pre, %cond_392_case_1 ], [ %119, %__barray_mask_borrow.exit259 ], [ %117, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" ] + %122 = and i64 %121, 2 + %.not290 = icmp eq i64 %122, 0 + br i1 %.not290, label %__barray_mask_borrow.exit259.1, label %cond_exit_369.thread.1 + +__barray_mask_borrow.exit259.1: ; preds = %cond_exit_369.thread + %123 = or disjoint i64 %121, 2, !dbg !12 + store i64 %123, ptr %74, align 4, !dbg !12 + %124 = getelementptr inbounds nuw i8, ptr %73, i64 24 + %125 = load { i1, i64, i1 }, ptr %124, align 4 + %.fca.0.extract167.1 = extractvalue { i1, i64, i1 } %125, 0 + br i1 %.fca.0.extract167.1, label %cond_392_case_1.1, label %cond_exit_369.thread.1 + +cond_392_case_1.1: ; preds = %__barray_mask_borrow.exit259.1 + %.fca.1.extract.1 = extractvalue { i1, i64, i1 } %125, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1) + %.pre281 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.1 + +cond_exit_369.thread.1: ; preds = %cond_392_case_1.1, %__barray_mask_borrow.exit259.1, %cond_exit_369.thread + %126 = phi i64 [ %.pre281, %cond_392_case_1.1 ], [ %123, %__barray_mask_borrow.exit259.1 ], [ %121, %cond_exit_369.thread ] + %127 = and i64 %126, 4 + %.not291 = icmp eq i64 %127, 0 + br i1 %.not291, label %__barray_mask_borrow.exit259.2, label %cond_exit_369.thread.2 + +__barray_mask_borrow.exit259.2: ; preds = %cond_exit_369.thread.1 + %128 = or disjoint i64 %126, 4, !dbg !12 + store i64 %128, ptr %74, align 4, !dbg !12 + %129 = getelementptr inbounds nuw i8, ptr %73, i64 48 + %130 = load { i1, i64, i1 }, ptr %129, align 4 + %.fca.0.extract167.2 = extractvalue { i1, i64, i1 } %130, 0 + br i1 %.fca.0.extract167.2, label %cond_392_case_1.2, label %cond_exit_369.thread.2 + +cond_392_case_1.2: ; preds = %__barray_mask_borrow.exit259.2 + %.fca.1.extract.2 = extractvalue { i1, i64, i1 } %130, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2) + %.pre282 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.2 + +cond_exit_369.thread.2: ; preds = %cond_392_case_1.2, %__barray_mask_borrow.exit259.2, %cond_exit_369.thread.1 + %131 = phi i64 [ %.pre282, %cond_392_case_1.2 ], [ %128, %__barray_mask_borrow.exit259.2 ], [ %126, %cond_exit_369.thread.1 ] + %132 = and i64 %131, 8 + %.not292 = icmp eq i64 %132, 0 + br i1 %.not292, label %__barray_mask_borrow.exit259.3, label %cond_exit_369.thread.3 + +__barray_mask_borrow.exit259.3: ; preds = %cond_exit_369.thread.2 + %133 = or disjoint i64 %131, 8, !dbg !12 + store i64 %133, ptr %74, align 4, !dbg !12 + %134 = getelementptr inbounds nuw i8, ptr %73, i64 72 + %135 = load { i1, i64, i1 }, ptr %134, align 4 + %.fca.0.extract167.3 = extractvalue { i1, i64, i1 } %135, 0 + br i1 %.fca.0.extract167.3, label %cond_392_case_1.3, label %cond_exit_369.thread.3 + +cond_392_case_1.3: ; preds = %__barray_mask_borrow.exit259.3 + %.fca.1.extract.3 = extractvalue { i1, i64, i1 } %135, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3) + %.pre283 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.3 + +cond_exit_369.thread.3: ; preds = %cond_392_case_1.3, %__barray_mask_borrow.exit259.3, %cond_exit_369.thread.2 + %136 = phi i64 [ %.pre283, %cond_392_case_1.3 ], [ %133, %__barray_mask_borrow.exit259.3 ], [ %131, %cond_exit_369.thread.2 ] + %137 = and i64 %136, 16 + %.not293 = icmp eq i64 %137, 0 + br i1 %.not293, label %__barray_mask_borrow.exit259.4, label %cond_exit_369.thread.4 + +__barray_mask_borrow.exit259.4: ; preds = %cond_exit_369.thread.3 + %138 = or disjoint i64 %136, 16, !dbg !12 + store i64 %138, ptr %74, align 4, !dbg !12 + %139 = getelementptr inbounds nuw i8, ptr %73, i64 96 + %140 = load { i1, i64, i1 }, ptr %139, align 4 + %.fca.0.extract167.4 = extractvalue { i1, i64, i1 } %140, 0 + br i1 %.fca.0.extract167.4, label %cond_392_case_1.4, label %cond_exit_369.thread.4 + +cond_392_case_1.4: ; preds = %__barray_mask_borrow.exit259.4 + %.fca.1.extract.4 = extractvalue { i1, i64, i1 } %140, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4) + %.pre284 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.4 + +cond_exit_369.thread.4: ; preds = %cond_392_case_1.4, %__barray_mask_borrow.exit259.4, %cond_exit_369.thread.3 + %141 = phi i64 [ %.pre284, %cond_392_case_1.4 ], [ %138, %__barray_mask_borrow.exit259.4 ], [ %136, %cond_exit_369.thread.3 ] + %142 = and i64 %141, 32 + %.not294 = icmp eq i64 %142, 0 + br i1 %.not294, label %__barray_mask_borrow.exit259.5, label %cond_exit_369.thread.5 + +__barray_mask_borrow.exit259.5: ; preds = %cond_exit_369.thread.4 + %143 = or disjoint i64 %141, 32, !dbg !12 + store i64 %143, ptr %74, align 4, !dbg !12 + %144 = getelementptr inbounds nuw i8, ptr %73, i64 120 + %145 = load { i1, i64, i1 }, ptr %144, align 4 + %.fca.0.extract167.5 = extractvalue { i1, i64, i1 } %145, 0 + br i1 %.fca.0.extract167.5, label %cond_392_case_1.5, label %cond_exit_369.thread.5 + +cond_392_case_1.5: ; preds = %__barray_mask_borrow.exit259.5 + %.fca.1.extract.5 = extractvalue { i1, i64, i1 } %145, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5) + %.pre285 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.5 + +cond_exit_369.thread.5: ; preds = %cond_392_case_1.5, %__barray_mask_borrow.exit259.5, %cond_exit_369.thread.4 + %146 = phi i64 [ %.pre285, %cond_392_case_1.5 ], [ %143, %__barray_mask_borrow.exit259.5 ], [ %141, %cond_exit_369.thread.4 ] + %147 = and i64 %146, 64 + %.not295 = icmp eq i64 %147, 0 + br i1 %.not295, label %__barray_mask_borrow.exit259.6, label %cond_exit_369.thread.6 + +__barray_mask_borrow.exit259.6: ; preds = %cond_exit_369.thread.5 + %148 = or disjoint i64 %146, 64, !dbg !12 + store i64 %148, ptr %74, align 4, !dbg !12 + %149 = getelementptr inbounds nuw i8, ptr %73, i64 144 + %150 = load { i1, i64, i1 }, ptr %149, align 4 + %.fca.0.extract167.6 = extractvalue { i1, i64, i1 } %150, 0 + br i1 %.fca.0.extract167.6, label %cond_392_case_1.6, label %cond_exit_369.thread.6 + +cond_392_case_1.6: ; preds = %__barray_mask_borrow.exit259.6 + %.fca.1.extract.6 = extractvalue { i1, i64, i1 } %150, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6) + %.pre286 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.6 + +cond_exit_369.thread.6: ; preds = %cond_392_case_1.6, %__barray_mask_borrow.exit259.6, %cond_exit_369.thread.5 + %151 = phi i64 [ %.pre286, %cond_392_case_1.6 ], [ %148, %__barray_mask_borrow.exit259.6 ], [ %146, %cond_exit_369.thread.5 ] + %152 = and i64 %151, 128 + %.not296 = icmp eq i64 %152, 0 + br i1 %.not296, label %__barray_mask_borrow.exit259.7, label %cond_exit_369.thread.7 + +__barray_mask_borrow.exit259.7: ; preds = %cond_exit_369.thread.6 + %153 = or disjoint i64 %151, 128, !dbg !12 + store i64 %153, ptr %74, align 4, !dbg !12 + %154 = getelementptr inbounds nuw i8, ptr %73, i64 168 + %155 = load { i1, i64, i1 }, ptr %154, align 4 + %.fca.0.extract167.7 = extractvalue { i1, i64, i1 } %155, 0 + br i1 %.fca.0.extract167.7, label %cond_392_case_1.7, label %cond_exit_369.thread.7 + +cond_392_case_1.7: ; preds = %__barray_mask_borrow.exit259.7 + %.fca.1.extract.7 = extractvalue { i1, i64, i1 } %155, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7) + %.pre287 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.7 + +cond_exit_369.thread.7: ; preds = %cond_392_case_1.7, %__barray_mask_borrow.exit259.7, %cond_exit_369.thread.6 + %156 = phi i64 [ %.pre287, %cond_392_case_1.7 ], [ %153, %__barray_mask_borrow.exit259.7 ], [ %151, %cond_exit_369.thread.6 ] + %157 = and i64 %156, 256 + %.not297 = icmp eq i64 %157, 0 + br i1 %.not297, label %__barray_mask_borrow.exit259.8, label %cond_exit_369.thread.8 + +__barray_mask_borrow.exit259.8: ; preds = %cond_exit_369.thread.7 + %158 = or disjoint i64 %156, 256, !dbg !12 + store i64 %158, ptr %74, align 4, !dbg !12 + %159 = getelementptr inbounds nuw i8, ptr %73, i64 192 + %160 = load { i1, i64, i1 }, ptr %159, align 4 + %.fca.0.extract167.8 = extractvalue { i1, i64, i1 } %160, 0 + br i1 %.fca.0.extract167.8, label %cond_392_case_1.8, label %cond_exit_369.thread.8 + +cond_392_case_1.8: ; preds = %__barray_mask_borrow.exit259.8 + %.fca.1.extract.8 = extractvalue { i1, i64, i1 } %160, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8) + %.pre288 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.8 + +cond_exit_369.thread.8: ; preds = %cond_392_case_1.8, %__barray_mask_borrow.exit259.8, %cond_exit_369.thread.7 + %161 = phi i64 [ %.pre288, %cond_392_case_1.8 ], [ %158, %__barray_mask_borrow.exit259.8 ], [ %156, %cond_exit_369.thread.7 ] + %162 = and i64 %161, 512 + %.not298 = icmp eq i64 %162, 0 + br i1 %.not298, label %__barray_mask_borrow.exit259.9, label %cond_exit_369.thread.9 + +__barray_mask_borrow.exit259.9: ; preds = %cond_exit_369.thread.8 + %163 = or disjoint i64 %161, 512, !dbg !12 + store i64 %163, ptr %74, align 4, !dbg !12 + %164 = getelementptr inbounds nuw i8, ptr %73, i64 216 + %165 = load { i1, i64, i1 }, ptr %164, align 4 + %.fca.0.extract167.9 = extractvalue { i1, i64, i1 } %165, 0 + br i1 %.fca.0.extract167.9, label %cond_392_case_1.9, label %cond_exit_369.thread.9 + +cond_392_case_1.9: ; preds = %__barray_mask_borrow.exit259.9 + %.fca.1.extract.9 = extractvalue { i1, i64, i1 } %165, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9) + %.pre289 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.9 + +cond_exit_369.thread.9: ; preds = %cond_392_case_1.9, %__barray_mask_borrow.exit259.9, %cond_exit_369.thread.8 + %166 = phi i64 [ %.pre289, %cond_392_case_1.9 ], [ %163, %__barray_mask_borrow.exit259.9 ], [ %161, %cond_exit_369.thread.8 ] + %167 = or i64 %166, -1024 + store i64 %167, ptr %74, align 4 + %168 = icmp eq i64 %167, -1 + br i1 %168, label %cond_exit_369, label %mask_block_err.i + +cond_392_case_1: ; preds = %__barray_mask_borrow.exit259 + %.fca.1.extract = extractvalue { i1, i64, i1 } %120, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract) + %.pre = load i64, ptr %74, align 4 + br label %cond_exit_369.thread +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn @@ -27,603 +627,12 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !59 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_207_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_207_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 = %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 - %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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.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.i238.i, label %__barray_mask_borrow.exit.i - -panic.i238.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 = %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.exit240.i, label %panic.i239.i - -panic.i239.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit240.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.exit242.i, label %panic.i241.i - -panic.i241.i: ; preds = %__barray_mask_return.exit240.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit242.i: ; preds = %__barray_mask_return.exit240.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 - %.not268.i = icmp eq i64 %54, 0 - br i1 %.not268.i, label %panic.i243.i, label %__barray_mask_return.exit244.i - -panic.i243.i: ; preds = %__barray_mask_borrow.exit242.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit244.i: ; preds = %__barray_mask_borrow.exit242.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 - %.not269.i = icmp eq i64 %57, 0 - br i1 %.not269.i, label %__barray_mask_borrow.exit246.i, label %panic.i245.i - -panic.i245.i: ; preds = %__barray_mask_return.exit244.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit246.i: ; preds = %__barray_mask_return.exit244.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 - %.not270.i = icmp eq i64 %61, 0 - br i1 %.not270.i, label %panic.i247.i, label %__barray_mask_return.exit248.i - -panic.i247.i: ; preds = %__barray_mask_borrow.exit246.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit248.i: ; preds = %__barray_mask_borrow.exit246.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 - %.not271.i = icmp eq i64 %64, 0 - br i1 %.not271.i, label %__barray_mask_borrow.exit250.i, label %panic.i249.i - -panic.i249.i: ; preds = %__barray_mask_return.exit248.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit250.i: ; preds = %__barray_mask_return.exit248.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 - %.not272.i = icmp eq i64 %68, 0 - br i1 %.not272.i, label %panic.i251.i, label %__barray_mask_return.exit252.i - -panic.i251.i: ; preds = %__barray_mask_borrow.exit250.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit252.i: ; preds = %__barray_mask_borrow.exit250.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 } %"116.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.extract82.i.i.i, 6 - %75 = getelementptr i64, ptr %.fca.1.extract81.i.i.i, i64 %74 - %76 = load i64, ptr %75, align 4 - %77 = and i64 %.fca.2.extract82.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.extract82.i.i.i, 9 - %83 = lshr i64 %last_valid.i.i.i.i, 6 - %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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).280.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).280.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, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit252.i - %.fca.2.extract82.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %.fca.2.extract82.i.i.i, %loop_body.i.i ] - %.fca.1.extract81.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit252.i ], [ %.fca.1.extract81.i.i.i, %loop_body.i.i ] - %.fca.0.extract80.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit252.i ], [ %.fca.0.extract80.i.i.i, %loop_body.i.i ] - %"306_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %95, %loop_body.i.i ] - %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit252.i ], [ %110, %loop_body.i.i ] - %95 = add nuw nsw i64 %"306_0.sroa.15.0184.i.i", 1 - %96 = add i64 %"306_0.sroa.15.0184.i.i", %.fca.2.extract82.i187.i.i - %97 = lshr i64 %96, 6 - %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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 = %__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.extract80.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, %"306_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, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"371_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 - %"371_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"371_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, %"306_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 %"306_0.sroa.15.0184.i.i" - store { i1, i64, i1 } %"371_054.fca.2.insert.i.i", ptr %113, align 4 - %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 - %.fca.0.extract80.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 - %.fca.1.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 - %.fca.2.extract82.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).280.exit.i": ; preds = %91, %73 - tail call void @heap_free(ptr %.fca.0.extract80.i.i.i) - tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i.i) - %115 = load i64, ptr %72, align 4 - %116 = trunc i64 %115 to i1 - br i1 %116, label %cond_exit_89.thread.i, label %__barray_mask_borrow.exit259.i - -mask_block_err.i.i: ; preds = %cond_exit_89.thread.9.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_mask_borrow.exit259.i: ; preds = %"__hugr__.$measure_array$$n(10).280.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.extract167.i = extractvalue { i1, i64, i1 } %118, 0 - br i1 %.fca.0.extract167.i, label %cond_392_case_1.i, label %cond_exit_89.thread.i - -cond_exit_89.thread.i: ; preds = %cond_392_case_1.i, %__barray_mask_borrow.exit259.i, %"__hugr__.$measure_array$$n(10).280.exit.i" - %119 = phi i64 [ %.pre.i, %cond_392_case_1.i ], [ %117, %__barray_mask_borrow.exit259.i ], [ %115, %"__hugr__.$measure_array$$n(10).280.exit.i" ] - %120 = and i64 %119, 2 - %.not290.i = icmp eq i64 %120, 0 - br i1 %.not290.i, label %__barray_mask_borrow.exit259.1.i, label %cond_exit_89.thread.1.i - -__barray_mask_borrow.exit259.1.i: ; preds = %cond_exit_89.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.extract167.1.i = extractvalue { i1, i64, i1 } %123, 0 - br i1 %.fca.0.extract167.1.i, label %cond_392_case_1.1.i, label %cond_exit_89.thread.1.i - -cond_392_case_1.1.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre281.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.1.i - -cond_exit_89.thread.1.i: ; preds = %cond_392_case_1.1.i, %__barray_mask_borrow.exit259.1.i, %cond_exit_89.thread.i - %124 = phi i64 [ %.pre281.i, %cond_392_case_1.1.i ], [ %121, %__barray_mask_borrow.exit259.1.i ], [ %119, %cond_exit_89.thread.i ] - %125 = and i64 %124, 4 - %.not291.i = icmp eq i64 %125, 0 - br i1 %.not291.i, label %__barray_mask_borrow.exit259.2.i, label %cond_exit_89.thread.2.i - -__barray_mask_borrow.exit259.2.i: ; preds = %cond_exit_89.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.extract167.2.i = extractvalue { i1, i64, i1 } %128, 0 - br i1 %.fca.0.extract167.2.i, label %cond_392_case_1.2.i, label %cond_exit_89.thread.2.i - -cond_392_case_1.2.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre282.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.2.i - -cond_exit_89.thread.2.i: ; preds = %cond_392_case_1.2.i, %__barray_mask_borrow.exit259.2.i, %cond_exit_89.thread.1.i - %129 = phi i64 [ %.pre282.i, %cond_392_case_1.2.i ], [ %126, %__barray_mask_borrow.exit259.2.i ], [ %124, %cond_exit_89.thread.1.i ] - %130 = and i64 %129, 8 - %.not292.i = icmp eq i64 %130, 0 - br i1 %.not292.i, label %__barray_mask_borrow.exit259.3.i, label %cond_exit_89.thread.3.i - -__barray_mask_borrow.exit259.3.i: ; preds = %cond_exit_89.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.extract167.3.i = extractvalue { i1, i64, i1 } %133, 0 - br i1 %.fca.0.extract167.3.i, label %cond_392_case_1.3.i, label %cond_exit_89.thread.3.i - -cond_392_case_1.3.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre283.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.3.i - -cond_exit_89.thread.3.i: ; preds = %cond_392_case_1.3.i, %__barray_mask_borrow.exit259.3.i, %cond_exit_89.thread.2.i - %134 = phi i64 [ %.pre283.i, %cond_392_case_1.3.i ], [ %131, %__barray_mask_borrow.exit259.3.i ], [ %129, %cond_exit_89.thread.2.i ] - %135 = and i64 %134, 16 - %.not293.i = icmp eq i64 %135, 0 - br i1 %.not293.i, label %__barray_mask_borrow.exit259.4.i, label %cond_exit_89.thread.4.i - -__barray_mask_borrow.exit259.4.i: ; preds = %cond_exit_89.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.extract167.4.i = extractvalue { i1, i64, i1 } %138, 0 - br i1 %.fca.0.extract167.4.i, label %cond_392_case_1.4.i, label %cond_exit_89.thread.4.i - -cond_392_case_1.4.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre284.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.4.i - -cond_exit_89.thread.4.i: ; preds = %cond_392_case_1.4.i, %__barray_mask_borrow.exit259.4.i, %cond_exit_89.thread.3.i - %139 = phi i64 [ %.pre284.i, %cond_392_case_1.4.i ], [ %136, %__barray_mask_borrow.exit259.4.i ], [ %134, %cond_exit_89.thread.3.i ] - %140 = and i64 %139, 32 - %.not294.i = icmp eq i64 %140, 0 - br i1 %.not294.i, label %__barray_mask_borrow.exit259.5.i, label %cond_exit_89.thread.5.i - -__barray_mask_borrow.exit259.5.i: ; preds = %cond_exit_89.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.extract167.5.i = extractvalue { i1, i64, i1 } %143, 0 - br i1 %.fca.0.extract167.5.i, label %cond_392_case_1.5.i, label %cond_exit_89.thread.5.i - -cond_392_case_1.5.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre285.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.5.i - -cond_exit_89.thread.5.i: ; preds = %cond_392_case_1.5.i, %__barray_mask_borrow.exit259.5.i, %cond_exit_89.thread.4.i - %144 = phi i64 [ %.pre285.i, %cond_392_case_1.5.i ], [ %141, %__barray_mask_borrow.exit259.5.i ], [ %139, %cond_exit_89.thread.4.i ] - %145 = and i64 %144, 64 - %.not295.i = icmp eq i64 %145, 0 - br i1 %.not295.i, label %__barray_mask_borrow.exit259.6.i, label %cond_exit_89.thread.6.i - -__barray_mask_borrow.exit259.6.i: ; preds = %cond_exit_89.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.extract167.6.i = extractvalue { i1, i64, i1 } %148, 0 - br i1 %.fca.0.extract167.6.i, label %cond_392_case_1.6.i, label %cond_exit_89.thread.6.i - -cond_392_case_1.6.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre286.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.6.i - -cond_exit_89.thread.6.i: ; preds = %cond_392_case_1.6.i, %__barray_mask_borrow.exit259.6.i, %cond_exit_89.thread.5.i - %149 = phi i64 [ %.pre286.i, %cond_392_case_1.6.i ], [ %146, %__barray_mask_borrow.exit259.6.i ], [ %144, %cond_exit_89.thread.5.i ] - %150 = and i64 %149, 128 - %.not296.i = icmp eq i64 %150, 0 - br i1 %.not296.i, label %__barray_mask_borrow.exit259.7.i, label %cond_exit_89.thread.7.i - -__barray_mask_borrow.exit259.7.i: ; preds = %cond_exit_89.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.extract167.7.i = extractvalue { i1, i64, i1 } %153, 0 - br i1 %.fca.0.extract167.7.i, label %cond_392_case_1.7.i, label %cond_exit_89.thread.7.i - -cond_392_case_1.7.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre287.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.7.i - -cond_exit_89.thread.7.i: ; preds = %cond_392_case_1.7.i, %__barray_mask_borrow.exit259.7.i, %cond_exit_89.thread.6.i - %154 = phi i64 [ %.pre287.i, %cond_392_case_1.7.i ], [ %151, %__barray_mask_borrow.exit259.7.i ], [ %149, %cond_exit_89.thread.6.i ] - %155 = and i64 %154, 256 - %.not297.i = icmp eq i64 %155, 0 - br i1 %.not297.i, label %__barray_mask_borrow.exit259.8.i, label %cond_exit_89.thread.8.i - -__barray_mask_borrow.exit259.8.i: ; preds = %cond_exit_89.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.extract167.8.i = extractvalue { i1, i64, i1 } %158, 0 - br i1 %.fca.0.extract167.8.i, label %cond_392_case_1.8.i, label %cond_exit_89.thread.8.i - -cond_392_case_1.8.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre288.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.8.i - -cond_exit_89.thread.8.i: ; preds = %cond_392_case_1.8.i, %__barray_mask_borrow.exit259.8.i, %cond_exit_89.thread.7.i - %159 = phi i64 [ %.pre288.i, %cond_392_case_1.8.i ], [ %156, %__barray_mask_borrow.exit259.8.i ], [ %154, %cond_exit_89.thread.7.i ] - %160 = and i64 %159, 512 - %.not298.i = icmp eq i64 %160, 0 - br i1 %.not298.i, label %__barray_mask_borrow.exit259.9.i, label %cond_exit_89.thread.9.i - -__barray_mask_borrow.exit259.9.i: ; preds = %cond_exit_89.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.extract167.9.i = extractvalue { i1, i64, i1 } %163, 0 - br i1 %.fca.0.extract167.9.i, label %cond_392_case_1.9.i, label %cond_exit_89.thread.9.i - -cond_392_case_1.9.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre289.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.9.i - -cond_exit_89.thread.9.i: ; preds = %cond_392_case_1.9.i, %__barray_mask_borrow.exit259.9.i, %cond_exit_89.thread.8.i - %164 = phi i64 [ %.pre289.i, %cond_392_case_1.9.i ], [ %161, %__barray_mask_borrow.exit259.9.i ], [ %159, %cond_exit_89.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_392_case_1.i: ; preds = %__barray_mask_borrow.exit259.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 - tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - %.pre.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.i - -__hugr__.main.1.exit: ; preds = %cond_exit_89.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 + tail call void @setup(i64 %0), !dbg !63 + tail call void @"__hugr__.__main__.measure_qb_array..main.1"(), !dbg !63 + %1 = tail call i64 @teardown(), !dbg !63 + ret i64 %1, !dbg !63 } declare void @setup(i64) local_unnamed_addr @@ -632,6 +641,71 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "measure_qb_array..main", linkageName: "__hugr__.__main__.measure_qb_array..main.1", scope: null, file: !5, line: 101, type: !6, scopeLine: 102, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 102, column: 13, scope: !4) +!9 = !DILocation(line: 102, column: 19, scope: !4) +!10 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !11) +!11 = distinct !DILocation(line: 103, column: 10, scope: !4) +!12 = !DILocation(line: 103, column: 10, scope: !4) +!13 = !DILocation(line: 103, column: 8, scope: !4) +!14 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !15) +!15 = distinct !DILocation(line: 104, column: 10, scope: !4) +!16 = !DILocation(line: 104, column: 10, scope: !4) +!17 = !DILocation(line: 104, column: 8, scope: !4) +!18 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !19) +!19 = distinct !DILocation(line: 105, column: 10, scope: !4) +!20 = !DILocation(line: 105, column: 10, scope: !4) +!21 = !DILocation(line: 105, column: 8, scope: !4) +!22 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !23) +!23 = distinct !DILocation(line: 106, column: 10, scope: !4) +!24 = !DILocation(line: 106, column: 10, scope: !4) +!25 = !DILocation(line: 106, column: 8, scope: !4) +!26 = !DILocation(line: 84, column: 25, scope: !27, inlinedAt: !37) +!27 = distinct !DISubprogram(name: "std.array.array.__iter__$qubit&10", linkageName: "__hugr__.guppylang.std.array.array.__iter__$qubit&10.190", scope: null, file: !28, line: 83, type: !29, scopeLine: 84, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!28 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/array.py", directory: "") +!29 = !DISubroutineType(types: !30) +!30 = !{!31, !33} +!31 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { ptr, ptr, i64 }, i64 }", file: !2, size: 32, align: 8, elements: !32) +!32 = !{!33, !36} +!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !34) +!34 = !{!35, !35, !36} +!35 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!36 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!37 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!38 = distinct !DISubprogram(name: "std.quantum.measure_array$10", linkageName: "__hugr__.guppylang.std.quantum.measure_array$10.149", scope: null, file: !39, line: 380, type: !40, scopeLine: 382, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!39 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!40 = !DISubroutineType(types: !41) +!41 = !{!33, !33} +!42 = distinct !DILocation(line: 107, column: 8, scope: !4) +!43 = !DILocation(line: 382, column: 11, scope: !38, inlinedAt: !42) +!44 = !DILocation(line: 276, column: 8, scope: !45, inlinedAt: !53) +!45 = distinct !DISubprogram(name: "std.array.ArrayIter.__next__$qubit&10", linkageName: "__hugr__.guppylang.std.array.ArrayIter.__next__$qubit&10.202", scope: null, file: !28, line: 270, type: !46, scopeLine: 273, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!46 = !DISubroutineType(types: !47) +!47 = !{!48, !31} +!48 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, { { { ptr, ptr, i64 }, i64 }, i64 } }", file: !2, size: 40, align: 8, elements: !49) +!49 = !{!50, !51} +!50 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!51 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { { ptr, ptr, i64 }, i64 }, i64 }", file: !2, size: 40, align: 8, elements: !52) +!52 = !{!31, !36} +!53 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!54 = !DILocation(line: 275, column: 50, scope: !45, inlinedAt: !53) +!55 = !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!56 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !57) +!57 = distinct !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!58 = !DILocation(line: 273, column: 11, scope: !45, inlinedAt: !53) +!59 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !60, type: !61, spFlags: DISPFlagDefinition, unit: !1) +!60 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!61 = !DISubroutineType(types: !62) +!62 = !{!36, !36} +!63 = !DILocation(line: 0, scope: !59) 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 ee3bf9879..a4231ba53 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 @@ -5,6 +5,26 @@ 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." +define void @"__hugr__.__main__.no_results..bar.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_18_case_0.i, label %__hugr__.__tk2_qalloc.14.exit, !dbg !8 + +cond_18_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.14.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___dec_future_refcount(i64 %lazy_measure) + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -22,26 +42,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + tail call void @"__hugr__.__main__.no_results..bar.1"(), !dbg !15 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr @@ -50,6 +56,23 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "no_results..bar", linkageName: "__hugr__.__main__.no_results..bar.1", scope: null, file: !5, line: 64, type: !6, scopeLine: 65, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 65, column: 20, scope: !4) +!9 = !DILocation(line: 66, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) 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 dc9f382c5..871710e73 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 @@ -7,6 +7,38 @@ target triple = "x86_64-apple-darwin" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_exit..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_45_case_0.i, label %__hugr__.__tk2_qalloc.41.exit, !dbg !8 + +cond_45_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.41.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_98_case_1 + +cond_98_case_1: ; preds = %__hugr__.__tk2_qalloc.41.exit + %read_bool66 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.41.exit + tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_45_case_0.i.i, label %__hugr__.__tk2_qalloc.41.exit.i - -cond_45_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.41.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - %read_bool66.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_exit..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_exit..main", linkageName: "__hugr__.__main__.postselect_exit..main.1", scope: null, file: !5, line: 131, type: !6, scopeLine: 132, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 132, column: 12, scope: !4) +!9 = !DILocation(line: 133, column: 8, scope: !4) +!10 = !DILocation(line: 137, column: 8, scope: !4) +!11 = !DILocation(line: 136, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 dd808af13..f22baba7c 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 @@ -7,6 +7,38 @@ target triple = "x86_64-apple-darwin" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_panic..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_43_case_0.i, label %__hugr__.__tk2_qalloc.39.exit, !dbg !8 + +cond_43_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.39.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_96_case_1 + +cond_96_case_1: ; preds = %__hugr__.__tk2_qalloc.39.exit + %read_bool65 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.39.exit + tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_43_case_0.i.i, label %__hugr__.__tk2_qalloc.39.exit.i - -cond_43_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.39.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - %read_bool65.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_panic..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_panic..main", linkageName: "__hugr__.__main__.postselect_panic..main.1", scope: null, file: !5, line: 144, type: !6, scopeLine: 145, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 145, column: 12, scope: !4) +!9 = !DILocation(line: 146, column: 8, scope: !4) +!10 = !DILocation(line: 150, column: 8, scope: !4) +!11 = !DILocation(line: 149, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 2f2765e7d..bfef10ffc 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 @@ -5,23 +5,50 @@ target triple = "x86_64-apple-darwin" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" +define void @"__hugr__.__main__.print_current_shot..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %shot = tail call i64 @get_current_shot(), !dbg !8 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot), !dbg !9 + ret void +} + declare i64 @get_current_shot() local_unnamed_addr declare void @print_int(ptr, i64, i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + %shot.i = tail call i64 @get_current_shot(), !dbg !16 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i), !dbg !18 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "print_current_shot..main", linkageName: "__hugr__.__main__.print_current_shot..main.1", scope: null, file: !5, line: 194, type: !6, scopeLine: 195, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 195, column: 23, scope: !4) +!9 = !DILocation(line: 195, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) +!16 = !DILocation(line: 195, column: 23, scope: !4, inlinedAt: !17) +!17 = distinct !DILocation(line: 0, scope: !10) +!18 = !DILocation(line: 195, column: 8, scope: !4, inlinedAt: !17) 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 015a87c68..2543ea77b 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 @@ -11,6 +11,32 @@ target triple = "x86_64-apple-darwin" @res_rfloat2.4DAB941F.0 = private constant [19 x i8] c"\12USER:FLOAT:rfloat2" @res_rint_bnd2.169DE399.0 = private constant [19 x i8] c"\12USER:INT:rint_bnd2" +define void @"__hugr__.__main__.rng..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + tail call void @random_seed(i64 42), !dbg !8 + %rint = tail call i32 @random_int(), !dbg !17 + %rint14 = tail call i32 @random_int(), !dbg !18 + %rfloat = tail call double @random_float(), !dbg !19 + %rintb = tail call i32 @random_rng(i32 100), !dbg !20 + %0 = sext i32 %rintb to i64, !dbg !20 + %1 = sext i32 %rint14 to i64, !dbg !18 + %2 = sext i32 %rint to i64, !dbg !17 + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %2), !dbg !21 + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %1), !dbg !22 + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat), !dbg !23 + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %0), !dbg !24 + tail call void @random_seed(i64 84), !dbg !25 + %rint47 = tail call i32 @random_int(), !dbg !27 + %rfloat49 = tail call double @random_float(), !dbg !28 + %rintb52 = tail call i32 @random_rng(i32 200), !dbg !29 + %3 = sext i32 %rintb52 to i64, !dbg !29 + %4 = sext i32 %rint47 to i64, !dbg !27 + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %4), !dbg !30 + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat49), !dbg !31 + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %3), !dbg !32 + ret void +} + declare i32 @random_int() local_unnamed_addr declare double @random_float() local_unnamed_addr @@ -23,38 +49,57 @@ declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !33 { entry: - tail call void @setup(i64 %0) - tail call void @random_seed(i64 42) - %rint.i = tail call i32 @random_int() - %rint14.i = tail call i32 @random_int() - %rfloat.i = tail call double @random_float() - %rintb.i = tail call i32 @random_rng(i32 100) - %1 = sext i32 %rintb.i to i64 - %2 = sext i32 %rint14.i to i64 - %3 = sext i32 %rint.i to i64 - 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) - %rint47.i = tail call i32 @random_int() - %rfloat49.i = tail call double @random_float() - %rintb52.i = tail call i32 @random_rng(i32 200) - %4 = sext i32 %rintb52.i to i64 - %5 = sext i32 %rint47.i to i64 - 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 %rfloat49.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 + tail call void @setup(i64 %0), !dbg !37 + tail call void @"__hugr__.__main__.rng..main.1"(), !dbg !37 + %1 = tail call i64 @teardown(), !dbg !37 + ret i64 %1, !dbg !37 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} -!0 = !{!"mainlib"} +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rng..main", linkageName: "__hugr__.__main__.rng..main.1", scope: null, file: !5, line: 202, type: !6, scopeLine: 203, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !16) +!9 = distinct !DISubprogram(name: "std.qsystem.random.RNG.__new__", linkageName: "__hugr__.guppylang.std.qsystem.random.RNG.__new__.72", scope: null, file: !10, line: 42, type: !11, scopeLine: 44, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!10 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/qsystem/random.py", directory: "") +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !15} +!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !14) +!14 = !{} +!15 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!16 = distinct !DILocation(line: 203, column: 14, scope: !4) +!17 = !DILocation(line: 204, column: 15, scope: !4) +!18 = !DILocation(line: 205, column: 16, scope: !4) +!19 = !DILocation(line: 206, column: 17, scope: !4) +!20 = !DILocation(line: 207, column: 19, scope: !4) +!21 = !DILocation(line: 209, column: 8, scope: !4) +!22 = !DILocation(line: 210, column: 8, scope: !4) +!23 = !DILocation(line: 211, column: 8, scope: !4) +!24 = !DILocation(line: 212, column: 8, scope: !4) +!25 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !26) +!26 = distinct !DILocation(line: 213, column: 14, scope: !4) +!27 = !DILocation(line: 214, column: 15, scope: !4) +!28 = !DILocation(line: 215, column: 17, scope: !4) +!29 = !DILocation(line: 216, column: 19, scope: !4) +!30 = !DILocation(line: 218, column: 8, scope: !4) +!31 = !DILocation(line: 219, column: 8, scope: !4) +!32 = !DILocation(line: 220, column: 8, scope: !4) +!33 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !34, type: !35, spFlags: DISPFlagDefinition, unit: !1) +!34 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!35 = !DISubroutineType(types: !36) +!36 = !{!15, !15} +!37 = !DILocation(line: 0, scope: !33) 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 77f401c44..a97de453f 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 @@ -6,6 +6,93 @@ target triple = "x86_64-apple-darwin" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.rus..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_87_case_0.i, label %__hugr__.__tk2_qalloc.83.exit, !dbg !8 + +cond_87_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.83.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + %qalloc.i132.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i133.i = icmp eq i64 %qalloc.i132.i, -1, !dbg !9 + br i1 %not_max.not.not.i133.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_101_case_0.i.i: ; preds = %cond_242_case_1.backedge.i, %__hugr__.__tk2_qalloc.83.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.97.exit.i: ; preds = %__hugr__.__tk2_qalloc.83.exit, %cond_242_case_1.backedge.i + %qalloc.i134.i = phi i64 [ %qalloc.i.i, %cond_242_case_1.backedge.i ], [ %qalloc.i132.i, %__hugr__.__tk2_qalloc.83.exit ] + tail call void @___reset(i64 %qalloc.i134.i), !dbg !9 + %qalloc.i128.i = tail call i64 @___qalloc(), !dbg !15 + %not_max.not.not.i129.i = icmp eq i64 %qalloc.i128.i, -1, !dbg !15 + br i1 %not_max.not.not.i129.i, label %cond_115_case_0.i.i, label %__hugr__.__tk2_qalloc.111.exit.i, !dbg !15 + +cond_115_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !15 + unreachable, !dbg !15 + +__hugr__.__tk2_qalloc.111.exit.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @___reset(i64 %qalloc.i128.i), !dbg !15 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !16 + tail call void @___rz(i64 %qalloc.i128.i, double 0x400921FB54442D18), !dbg !16 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0x400921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFE921FB54442D18), !dbg !18 + tail call void @___rxy(i64 %qalloc.i134.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rzz(i64 %qalloc.i128.i, i64 %qalloc.i134.i, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0x3FE921FB54442D18), !dbg !20 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i) + tail call void @___qfree(i64 %qalloc.i134.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 %cond_256_case_1.i, label %0 + +0: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___qfree(i64 %qalloc.i128.i), !dbg !21 + br label %cond_242_case_1.backedge.i + +cond_242_case_1.backedge.i: ; preds = %1, %0 + %qalloc.i.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1, !dbg !9 + br i1 %not_max.not.not.i.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_256_case_1.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___rz(i64 %qalloc.i, double 0x3FE921FB54442D18), !dbg !22 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !23 + tail call void @___rxy(i64 %qalloc.i128.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rzz(i64 %qalloc.i, i64 %qalloc.i128.i, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0x3FE921FB54442D18), !dbg !25 + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i) + tail call void @___qfree(i64 %qalloc.i128.i) + %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) + tail call void @___dec_future_refcount(i64 %lazy_measure67.i) + br i1 %read_bool80.i, label %"__hugr__.__main__.rus..rus.17.exit", label %1 + +1: ; preds = %cond_256_case_1.i + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !26 + br label %cond_242_case_1.backedge.i + +"__hugr__.__main__.rus..rus.17.exit": ; preds = %cond_256_case_1.i + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool), !dbg !27 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -29,93 +116,12 @@ declare void @___rz(i64, double) local_unnamed_addr declare void @___rzz(i64, i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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 = %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 = %__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.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 - -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 = %__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 %1 - -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 %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 %2 - -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 %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(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) - %3 = tail call i64 @teardown() - ret i64 %3 + tail call void @setup(i64 %0), !dbg !30 + tail call void @"__hugr__.__main__.rus..main.1"(), !dbg !30 + %1 = tail call i64 @teardown(), !dbg !30 + ret i64 %1, !dbg !30 } declare void @setup(i64) local_unnamed_addr @@ -124,6 +130,38 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rus..main", linkageName: "__hugr__.__main__.rus..main.1", scope: null, file: !5, line: 184, type: !6, scopeLine: 185, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 185, column: 12, scope: !4) +!9 = !DILocation(line: 160, column: 19, scope: !10, inlinedAt: !14) +!10 = distinct !DISubprogram(name: "rus..rus", linkageName: "__hugr__.__main__.rus..rus.17", scope: null, file: !5, line: 157, type: !11, scopeLine: 158, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !13} +!13 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!14 = distinct !DILocation(line: 186, column: 8, scope: !4) +!15 = !DILocation(line: 160, column: 28, scope: !10, inlinedAt: !14) +!16 = !DILocation(line: 162, column: 12, scope: !10, inlinedAt: !14) +!17 = !DILocation(line: 161, column: 12, scope: !10, inlinedAt: !14) +!18 = !DILocation(line: 164, column: 12, scope: !10, inlinedAt: !14) +!19 = !DILocation(line: 165, column: 12, scope: !10, inlinedAt: !14) +!20 = !DILocation(line: 166, column: 12, scope: !10, inlinedAt: !14) +!21 = !DILocation(line: 169, column: 16, scope: !10, inlinedAt: !14) +!22 = !DILocation(line: 172, column: 12, scope: !10, inlinedAt: !14) +!23 = !DILocation(line: 173, column: 12, scope: !10, inlinedAt: !14) +!24 = !DILocation(line: 174, column: 12, scope: !10, inlinedAt: !14) +!25 = !DILocation(line: 175, column: 12, scope: !10, inlinedAt: !14) +!26 = !DILocation(line: 181, column: 12, scope: !10, inlinedAt: !14) +!27 = !DILocation(line: 187, column: 8, scope: !4) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !11, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DILocation(line: 0, scope: !28) 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 9d0d0dbab..86eb72ab6 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 @@ -4,284 +4,363 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80: 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" -@"e_Array elem.E746B1A3.0" = private constant [43 x i8] c"*EXIT:INT:Array element is already borrowed" @"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." +define void @"__hugr__.__main__.discard_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_233_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_233_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_233_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not = icmp eq i64 %6, 0 + br i1 %.not, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_233_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not108 = icmp eq i64 %10, 0 + br i1 %.not108, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_233_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not109 = icmp eq i64 %14, 0 + br i1 %.not109, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_233_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not110 = icmp eq i64 %18, 0 + br i1 %.not110, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_233_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not111 = icmp eq i64 %22, 0 + br i1 %.not111, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_233_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not112 = icmp eq i64 %26, 0 + br i1 %.not112, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_233_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not113 = icmp eq i64 %30, 0 + br i1 %.not113, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_233_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not114 = icmp eq i64 %34, 0 + br i1 %.not114, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_233_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not115 = icmp eq i64 %38, 0 + br i1 %.not115, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %cond_171_case_1.1.i, label %__barray_mask_borrow.exit.i + +cond_171_case_1.1.i: ; preds = %__barray_mask_borrow.exit.i, %cond_exit_20.9 + %43 = phi i64 [ %41, %cond_exit_20.9 ], [ %.pre.i, %__barray_mask_borrow.exit.i ], !dbg !10 + %44 = and i64 %43, 2, !dbg !10 + %.not.i = icmp eq i64 %44, 0, !dbg !10 + br i1 %.not.i, label %__barray_mask_borrow.exit.1.i, label %cond_171_case_1.2.i + +__barray_mask_borrow.exit.1.i: ; preds = %cond_171_case_1.1.i + %45 = or disjoint i64 %43, 2, !dbg !21 + store i64 %45, ptr %1, align 4, !dbg !21 + %46 = getelementptr inbounds nuw i8, ptr %0, i64 8, !dbg !23 + %47 = load i64, ptr %46, align 4, !dbg !23 + tail call void @___qfree(i64 %47), !dbg !24 + %.pre337.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.2.i + +cond_171_case_1.2.i: ; preds = %__barray_mask_borrow.exit.1.i, %cond_171_case_1.1.i + %48 = phi i64 [ %.pre337.i, %__barray_mask_borrow.exit.1.i ], [ %43, %cond_171_case_1.1.i ], !dbg !10 + %49 = and i64 %48, 4, !dbg !10 + %.not345.i = icmp eq i64 %49, 0, !dbg !10 + br i1 %.not345.i, label %__barray_mask_borrow.exit.2.i, label %cond_171_case_1.3.i + +__barray_mask_borrow.exit.2.i: ; preds = %cond_171_case_1.2.i + %50 = or disjoint i64 %48, 4, !dbg !21 + store i64 %50, ptr %1, align 4, !dbg !21 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !23 + %52 = load i64, ptr %51, align 4, !dbg !23 + tail call void @___qfree(i64 %52), !dbg !24 + %.pre338.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.3.i + +cond_171_case_1.3.i: ; preds = %__barray_mask_borrow.exit.2.i, %cond_171_case_1.2.i + %53 = phi i64 [ %.pre338.i, %__barray_mask_borrow.exit.2.i ], [ %48, %cond_171_case_1.2.i ], !dbg !10 + %54 = and i64 %53, 8, !dbg !10 + %.not346.i = icmp eq i64 %54, 0, !dbg !10 + br i1 %.not346.i, label %__barray_mask_borrow.exit.3.i, label %cond_171_case_1.4.i + +__barray_mask_borrow.exit.3.i: ; preds = %cond_171_case_1.3.i + %55 = or disjoint i64 %53, 8, !dbg !21 + store i64 %55, ptr %1, align 4, !dbg !21 + %56 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !23 + %57 = load i64, ptr %56, align 4, !dbg !23 + tail call void @___qfree(i64 %57), !dbg !24 + %.pre339.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.4.i + +cond_171_case_1.4.i: ; preds = %__barray_mask_borrow.exit.3.i, %cond_171_case_1.3.i + %58 = phi i64 [ %.pre339.i, %__barray_mask_borrow.exit.3.i ], [ %53, %cond_171_case_1.3.i ], !dbg !10 + %59 = and i64 %58, 16, !dbg !10 + %.not347.i = icmp eq i64 %59, 0, !dbg !10 + br i1 %.not347.i, label %__barray_mask_borrow.exit.4.i, label %cond_171_case_1.5.i + +__barray_mask_borrow.exit.4.i: ; preds = %cond_171_case_1.4.i + %60 = or disjoint i64 %58, 16, !dbg !21 + store i64 %60, ptr %1, align 4, !dbg !21 + %61 = getelementptr inbounds nuw i8, ptr %0, i64 32, !dbg !23 + %62 = load i64, ptr %61, align 4, !dbg !23 + tail call void @___qfree(i64 %62), !dbg !24 + %.pre340.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.5.i + +cond_171_case_1.5.i: ; preds = %__barray_mask_borrow.exit.4.i, %cond_171_case_1.4.i + %63 = phi i64 [ %.pre340.i, %__barray_mask_borrow.exit.4.i ], [ %58, %cond_171_case_1.4.i ], !dbg !10 + %64 = and i64 %63, 32, !dbg !10 + %.not348.i = icmp eq i64 %64, 0, !dbg !10 + br i1 %.not348.i, label %__barray_mask_borrow.exit.5.i, label %cond_171_case_1.6.i + +__barray_mask_borrow.exit.5.i: ; preds = %cond_171_case_1.5.i + %65 = or disjoint i64 %63, 32, !dbg !21 + store i64 %65, ptr %1, align 4, !dbg !21 + %66 = getelementptr inbounds nuw i8, ptr %0, i64 40, !dbg !23 + %67 = load i64, ptr %66, align 4, !dbg !23 + tail call void @___qfree(i64 %67), !dbg !24 + %.pre341.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.6.i + +cond_171_case_1.6.i: ; preds = %__barray_mask_borrow.exit.5.i, %cond_171_case_1.5.i + %68 = phi i64 [ %.pre341.i, %__barray_mask_borrow.exit.5.i ], [ %63, %cond_171_case_1.5.i ], !dbg !10 + %69 = and i64 %68, 64, !dbg !10 + %.not349.i = icmp eq i64 %69, 0, !dbg !10 + br i1 %.not349.i, label %__barray_mask_borrow.exit.6.i, label %cond_171_case_1.7.i + +__barray_mask_borrow.exit.6.i: ; preds = %cond_171_case_1.6.i + %70 = or disjoint i64 %68, 64, !dbg !21 + store i64 %70, ptr %1, align 4, !dbg !21 + %71 = getelementptr inbounds nuw i8, ptr %0, i64 48, !dbg !23 + %72 = load i64, ptr %71, align 4, !dbg !23 + tail call void @___qfree(i64 %72), !dbg !24 + %.pre342.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.7.i + +cond_171_case_1.7.i: ; preds = %__barray_mask_borrow.exit.6.i, %cond_171_case_1.6.i + %73 = phi i64 [ %.pre342.i, %__barray_mask_borrow.exit.6.i ], [ %68, %cond_171_case_1.6.i ], !dbg !10 + %74 = and i64 %73, 128, !dbg !10 + %.not350.i = icmp eq i64 %74, 0, !dbg !10 + br i1 %.not350.i, label %__barray_mask_borrow.exit.7.i, label %cond_171_case_1.8.i + +__barray_mask_borrow.exit.7.i: ; preds = %cond_171_case_1.7.i + %75 = or disjoint i64 %73, 128, !dbg !21 + store i64 %75, ptr %1, align 4, !dbg !21 + %76 = getelementptr inbounds nuw i8, ptr %0, i64 56, !dbg !23 + %77 = load i64, ptr %76, align 4, !dbg !23 + tail call void @___qfree(i64 %77), !dbg !24 + %.pre343.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.8.i + +cond_171_case_1.8.i: ; preds = %__barray_mask_borrow.exit.7.i, %cond_171_case_1.7.i + %78 = phi i64 [ %.pre343.i, %__barray_mask_borrow.exit.7.i ], [ %73, %cond_171_case_1.7.i ], !dbg !10 + %79 = and i64 %78, 256, !dbg !10 + %.not351.i = icmp eq i64 %79, 0, !dbg !10 + br i1 %.not351.i, label %__barray_mask_borrow.exit.8.i, label %__barray_check_bounds.exit.9.i + +__barray_mask_borrow.exit.8.i: ; preds = %cond_171_case_1.8.i + %80 = or disjoint i64 %78, 256, !dbg !21 + store i64 %80, ptr %1, align 4, !dbg !21 + %81 = getelementptr inbounds nuw i8, ptr %0, i64 64, !dbg !23 + %82 = load i64, ptr %81, align 4, !dbg !23 + tail call void @___qfree(i64 %82), !dbg !24 + %.pre = load i64, ptr %1, align 4, !dbg !10 + br label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %__barray_mask_borrow.exit.8.i, %cond_171_case_1.8.i + %83 = phi i64 [ %.pre, %__barray_mask_borrow.exit.8.i ], [ %78, %cond_171_case_1.8.i ], !dbg !10 + %84 = and i64 %83, 512, !dbg !10 + %.not352.i = icmp eq i64 %84, 0, !dbg !10 + br i1 %.not352.i, label %__barray_mask_borrow.exit.9.i, label %cond_exit_156.i + +__barray_mask_borrow.exit.9.i: ; preds = %__barray_check_bounds.exit.9.i + %85 = or disjoint i64 %83, 512, !dbg !21 + store i64 %85, ptr %1, align 4, !dbg !21 + %86 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !23 + %87 = load i64, ptr %86, align 4, !dbg !23 + tail call void @___qfree(i64 %87), !dbg !24 + %.pre344.i = load i64, ptr %1, align 4, !dbg !25 + br label %cond_exit_156.i + +cond_exit_156.i: ; preds = %__barray_mask_borrow.exit.9.i, %__barray_check_bounds.exit.9.i + %88 = phi i64 [ %.pre344.i, %__barray_mask_borrow.exit.9.i ], [ %83, %__barray_check_bounds.exit.9.i ], !dbg !25 + %89 = or i64 %88, -1024, !dbg !25 + store i64 %89, ptr %1, align 4, !dbg !25 + %90 = icmp eq i64 %89, -1, !dbg !25 + br i1 %90, label %"__hugr__.guppylang.std.quantum.discard_array$10.113.exit", label %mask_block_err.i.i, !dbg !25 + +mask_block_err.i.i: ; preds = %cond_exit_156.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !25 + unreachable, !dbg !25 + +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.9 + %91 = or disjoint i64 %41, 1, !dbg !21 + store i64 %91, ptr %1, align 4, !dbg !21 + %92 = load i64, ptr %0, align 4, !dbg !23 + tail call void @___qfree(i64 %92), !dbg !24 + %.pre.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.1.i + +"__hugr__.guppylang.std.quantum.discard_array$10.113.exit": ; preds = %cond_exit_156.i + tail call void @heap_free(ptr nonnull %0), !dbg !27 + tail call void @heap_free(ptr nonnull %1), !dbg !27 + ret void +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @___qfree(i64) local_unnamed_addr - declare void @heap_free(ptr) local_unnamed_addr +declare void @___qfree(i64) local_unnamed_addr + declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_213_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_213_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 = %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 - %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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert.i", i64 0, 2 - %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert.i", 0 - br label %__barray_check_bounds.exit.i.i.i - -43: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i", %cond_exit_20.i.9 - %.fca.2.extract82.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.1.extract81.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.0.extract80.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %"294_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %65 = add i64 %"294_0.0182.i.i", %.fca.2.extract82.i185.i.i - %66 = lshr i64 %65, 6 - %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i - %72 = add nuw nsw i64 %"294_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.extract80.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 %"294_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 + tail call void @setup(i64 %0), !dbg !32 + tail call void @"__hugr__.__main__.discard_qb_array..main.1"(), !dbg !32 + %1 = tail call i64 @teardown(), !dbg !32 + ret i64 %1, !dbg !32 } declare void @setup(i64) local_unnamed_addr @@ -290,6 +369,40 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "discard_qb_array..main", linkageName: "__hugr__.__main__.discard_qb_array..main.1", scope: null, file: !5, line: 92, type: !6, scopeLine: 93, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 93, column: 13, scope: !4) +!9 = !DILocation(line: 93, column: 19, scope: !4) +!10 = !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !19) +!11 = distinct !DISubprogram(name: "std.quantum.discard_array$10", linkageName: "__hugr__.guppylang.std.quantum.discard_array$10.113", scope: null, file: !12, line: 387, type: !13, scopeLine: 389, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!12 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!13 = !DISubroutineType(types: !14) +!14 = !{null, !15} +!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !16) +!16 = !{!17, !17, !18} +!17 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!18 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!19 = distinct !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !20) +!20 = distinct !DILocation(line: 94, column: 8, scope: !4) +!21 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !22) +!22 = distinct !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!23 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!24 = !DILocation(line: 391, column: 12, scope: !11, inlinedAt: !20) +!25 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !26) +!26 = distinct !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!27 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !30, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DISubroutineType(types: !31) +!31 = !{!18, !18} +!32 = !DILocation(line: 0, scope: !28) 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 9dced28f8..8b43e04cd 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 @@ -9,6 +9,74 @@ target triple = "x86_64-unknown-linux-gnu" @res_c3.B223E16D.0 = private constant [13 x i8] c"\0CUSER:BOOL:c3" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.flip_some..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_40_case_0.i, label %__hugr__.__tk2_qalloc.36.exit, !dbg !8 + +cond_40_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.36.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !9 + %qalloc.i101 = tail call i64 @___qalloc(), !dbg !10 + %not_max.not.not.i102 = icmp eq i64 %qalloc.i101, -1, !dbg !10 + br i1 %not_max.not.not.i102, label %cond_54_case_0.i, label %__hugr__.__tk2_qalloc.50.exit, !dbg !10 + +cond_54_case_0.i: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !10 + unreachable, !dbg !10 + +__hugr__.__tk2_qalloc.50.exit: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @___reset(i64 %qalloc.i101), !dbg !10 + %qalloc.i103 = tail call i64 @___qalloc(), !dbg !11 + %not_max.not.not.i104 = icmp eq i64 %qalloc.i103, -1, !dbg !11 + br i1 %not_max.not.not.i104, label %cond_68_case_0.i, label %__hugr__.__tk2_qalloc.64.exit, !dbg !11 + +cond_68_case_0.i: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !11 + unreachable, !dbg !11 + +__hugr__.__tk2_qalloc.64.exit: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @___reset(i64 %qalloc.i103), !dbg !11 + tail call void @___rxy(i64 %qalloc.i103, double 0x400921FB54442D18, double 0.000000e+00), !dbg !12 + %qalloc.i105 = tail call i64 @___qalloc(), !dbg !13 + %not_max.not.not.i106 = icmp eq i64 %qalloc.i105, -1, !dbg !13 + br i1 %not_max.not.not.i106, label %cond_82_case_0.i, label %__hugr__.__tk2_qalloc.78.exit, !dbg !13 + +cond_82_case_0.i: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !13 + unreachable, !dbg !13 + +__hugr__.__tk2_qalloc.78.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @___reset(i64 %qalloc.i105), !dbg !13 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool), !dbg !14 + %lazy_measure22 = tail call i64 @___lazy_measure(i64 %qalloc.i101) + tail call void @___qfree(i64 %qalloc.i101) + %read_bool35 = tail call i1 @___read_future_bool(i64 %lazy_measure22) + tail call void @___dec_future_refcount(i64 %lazy_measure22) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35), !dbg !15 + %lazy_measure44 = tail call i64 @___lazy_measure(i64 %qalloc.i103) + tail call void @___qfree(i64 %qalloc.i103) + %read_bool57 = tail call i1 @___read_future_bool(i64 %lazy_measure44) + tail call void @___dec_future_refcount(i64 %lazy_measure44) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57), !dbg !16 + tail call void @___rxy(i64 %qalloc.i105, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %lazy_measure67 = tail call i64 @___lazy_measure(i64 %qalloc.i105) + tail call void @___qfree(i64 %qalloc.i105) + %read_bool80 = tail call i1 @___read_future_bool(i64 %lazy_measure67) + tail call void @___dec_future_refcount(i64 %lazy_measure67) + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80), !dbg !18 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -28,74 +96,12 @@ declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !19 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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.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 - -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 = %__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 = %__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 = %__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 = %__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(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(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(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(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !24 + tail call void @"__hugr__.__main__.flip_some..main.1"(), !dbg !24 + %1 = tail call i64 @teardown(), !dbg !24 + ret i64 %1, !dbg !24 } declare void @setup(i64) local_unnamed_addr @@ -104,6 +110,32 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "flip_some..main", linkageName: "__hugr__.__main__.flip_some..main.1", scope: null, file: !5, line: 74, type: !6, scopeLine: 75, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 75, column: 20, scope: !4) +!9 = !DILocation(line: 79, column: 8, scope: !4) +!10 = !DILocation(line: 76, column: 20, scope: !4) +!11 = !DILocation(line: 77, column: 20, scope: !4) +!12 = !DILocation(line: 80, column: 8, scope: !4) +!13 = !DILocation(line: 78, column: 20, scope: !4) +!14 = !DILocation(line: 82, column: 8, scope: !4) +!15 = !DILocation(line: 83, column: 8, scope: !4) +!16 = !DILocation(line: 84, column: 8, scope: !4) +!17 = !DILocation(line: 81, column: 8, scope: !4) +!18 = !DILocation(line: 85, column: 8, scope: !4) +!19 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !20, type: !21, spFlags: DISPFlagDefinition, unit: !1) +!20 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!21 = !DISubroutineType(types: !22) +!22 = !{!23, !23} +!23 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!24 = !DILocation(line: 0, scope: !19) 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 a61cea991..770237bf2 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 @@ -8,6 +8,606 @@ 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." +define void @"__hugr__.__main__.measure_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_299_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_299_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_299_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not299 = icmp eq i64 %6, 0 + br i1 %.not299, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_299_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not300 = icmp eq i64 %10, 0 + br i1 %.not300, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_299_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not301 = icmp eq i64 %14, 0 + br i1 %.not301, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_299_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not302 = icmp eq i64 %18, 0 + br i1 %.not302, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_299_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not303 = icmp eq i64 %22, 0 + br i1 %.not303, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_299_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not304 = icmp eq i64 %26, 0 + br i1 %.not304, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_299_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not305 = icmp eq i64 %30, 0 + br i1 %.not305, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_299_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not306 = icmp eq i64 %34, 0 + br i1 %.not306, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_299_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not307 = icmp eq i64 %38, 0 + br i1 %.not307, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %"116.fca.0.insert" = insertvalue { ptr, ptr, i64 } poison, ptr %0, 0 + %"116.fca.1.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert", ptr %1, 1 + %"116.fca.2.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert", i64 0, 2 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %panic.i238, label %__barray_mask_borrow.exit, !dbg !10 + +panic.i238: ; preds = %cond_exit_20.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !10 + unreachable, !dbg !10 + +__barray_mask_borrow.exit: ; preds = %cond_exit_20.9 + %43 = or disjoint i64 %41, 1, !dbg !10 + store i64 %43, ptr %1, align 4, !dbg !10 + %44 = load i64, ptr %0, align 4, !dbg !12 + tail call void @___rxy(i64 %44, double 0x400921FB54442D18, double 0.000000e+00), !dbg !13 + %45 = load i64, ptr %1, align 4, !dbg !12 + %46 = trunc i64 %45 to i1, !dbg !12 + br i1 %46, label %__barray_mask_return.exit240, label %panic.i239, !dbg !12 + +panic.i239: ; preds = %__barray_mask_borrow.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !12 + unreachable, !dbg !12 + +__barray_mask_return.exit240: ; preds = %__barray_mask_borrow.exit + %47 = and i64 %45, -2, !dbg !12 + store i64 %47, ptr %1, align 4, !dbg !12 + store i64 %44, ptr %0, align 4, !dbg !12 + %48 = load i64, ptr %1, align 4, !dbg !14 + %49 = and i64 %48, 4, !dbg !14 + %.not = icmp eq i64 %49, 0, !dbg !14 + br i1 %.not, label %__barray_mask_borrow.exit242, label %panic.i241, !dbg !14 + +panic.i241: ; preds = %__barray_mask_return.exit240 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !14 + unreachable, !dbg !14 + +__barray_mask_borrow.exit242: ; preds = %__barray_mask_return.exit240 + %50 = or disjoint i64 %48, 4, !dbg !14 + store i64 %50, ptr %1, align 4, !dbg !14 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !16 + %52 = load i64, ptr %51, align 4, !dbg !16 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %53 = load i64, ptr %1, align 4, !dbg !16 + %54 = and i64 %53, 4, !dbg !16 + %.not268 = icmp eq i64 %54, 0, !dbg !16 + br i1 %.not268, label %panic.i243, label %__barray_mask_return.exit244, !dbg !16 + +panic.i243: ; preds = %__barray_mask_borrow.exit242 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !16 + unreachable, !dbg !16 + +__barray_mask_return.exit244: ; preds = %__barray_mask_borrow.exit242 + %55 = and i64 %53, -5, !dbg !16 + store i64 %55, ptr %1, align 4, !dbg !16 + store i64 %52, ptr %51, align 4, !dbg !16 + %56 = load i64, ptr %1, align 4, !dbg !18 + %57 = and i64 %56, 8, !dbg !18 + %.not269 = icmp eq i64 %57, 0, !dbg !18 + br i1 %.not269, label %__barray_mask_borrow.exit246, label %panic.i245, !dbg !18 + +panic.i245: ; preds = %__barray_mask_return.exit244 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !18 + unreachable, !dbg !18 + +__barray_mask_borrow.exit246: ; preds = %__barray_mask_return.exit244 + %58 = or disjoint i64 %56, 8, !dbg !18 + store i64 %58, ptr %1, align 4, !dbg !18 + %59 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !20 + %60 = load i64, ptr %59, align 4, !dbg !20 + tail call void @___rxy(i64 %60, double 0x400921FB54442D18, double 0.000000e+00), !dbg !21 + %61 = load i64, ptr %1, align 4, !dbg !20 + %62 = and i64 %61, 8, !dbg !20 + %.not270 = icmp eq i64 %62, 0, !dbg !20 + br i1 %.not270, label %panic.i247, label %__barray_mask_return.exit248, !dbg !20 + +panic.i247: ; preds = %__barray_mask_borrow.exit246 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !20 + unreachable, !dbg !20 + +__barray_mask_return.exit248: ; preds = %__barray_mask_borrow.exit246 + %63 = and i64 %61, -9, !dbg !20 + store i64 %63, ptr %1, align 4, !dbg !20 + store i64 %60, ptr %59, align 4, !dbg !20 + %64 = load i64, ptr %1, align 4, !dbg !22 + %65 = and i64 %64, 512, !dbg !22 + %.not271 = icmp eq i64 %65, 0, !dbg !22 + br i1 %.not271, label %__barray_mask_borrow.exit250, label %panic.i249, !dbg !22 + +panic.i249: ; preds = %__barray_mask_return.exit248 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !22 + unreachable, !dbg !22 + +__barray_mask_borrow.exit250: ; preds = %__barray_mask_return.exit248 + %66 = or disjoint i64 %64, 512, !dbg !22 + store i64 %66, ptr %1, align 4, !dbg !22 + %67 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !24 + %68 = load i64, ptr %67, align 4, !dbg !24 + tail call void @___rxy(i64 %68, double 0x400921FB54442D18, double 0.000000e+00), !dbg !25 + %69 = load i64, ptr %1, align 4, !dbg !24 + %70 = and i64 %69, 512, !dbg !24 + %.not272 = icmp eq i64 %70, 0, !dbg !24 + br i1 %.not272, label %panic.i251, label %__barray_mask_return.exit252, !dbg !24 + +panic.i251: ; preds = %__barray_mask_borrow.exit250 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !24 + unreachable, !dbg !24 + +__barray_mask_return.exit252: ; preds = %__barray_mask_borrow.exit250 + %71 = and i64 %69, -513, !dbg !24 + store i64 %71, ptr %1, align 4, !dbg !24 + store i64 %68, ptr %67, align 4, !dbg !24 + %72 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert", 0, !dbg !26 + %73 = tail call ptr @heap_alloc(i64 240), !dbg !43 + %74 = tail call ptr @heap_alloc(i64 8), !dbg !43 + store i64 -1, ptr %74, align 1, !dbg !43 + br label %__barray_check_bounds.exit.i.i + +75: ; preds = %loop_body.i + %76 = lshr i64 %.fca.2.extract82.i.i, 6, !dbg !44 + %77 = getelementptr i64, ptr %.fca.1.extract81.i.i, i64 %76, !dbg !44 + %78 = load i64, ptr %77, align 4, !dbg !44 + %79 = and i64 %.fca.2.extract82.i.i, 63, !dbg !44 + %80 = sub nuw nsw i64 64, %79, !dbg !44 + %81 = lshr i64 -1, %80, !dbg !44 + %82 = icmp eq i64 %79, 0, !dbg !44 + %83 = select i1 %82, i64 0, i64 %81, !dbg !44 + %84 = or i64 %78, %83, !dbg !44 + store i64 %84, ptr %77, align 4, !dbg !44 + %last_valid.i.i.i = add i64 %.fca.2.extract82.i.i, 9, !dbg !44 + %85 = lshr i64 %last_valid.i.i.i, 6, !dbg !44 + %86 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i.i, i64 %85, !dbg !44 + %87 = load i64, ptr %86, align 4, !dbg !44 + %88 = and i64 %last_valid.i.i.i, 63, !dbg !44 + %89 = shl nsw i64 -2, %88, !dbg !44 + %90 = icmp eq i64 %88, 63, !dbg !44 + %91 = select i1 %90, i64 0, i64 %89, !dbg !44 + %92 = or i64 %87, %91, !dbg !44 + store i64 %92, ptr %86, align 4, !dbg !44 + %reass.sub.i.i.i = sub nsw i64 %85, %76, !dbg !44 + %.not.i.i.i = icmp eq i64 %reass.sub.i.i.i, -1, !dbg !44 + br i1 %.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +93: ; preds = %mask_block_ok.i.i.i + %94 = add nuw i64 %.02.i.i.i, 1, !dbg !44 + %exitcond.not.i.i.i = icmp eq i64 %.02.i.i.i, %reass.sub.i.i.i, !dbg !44 + br i1 %exitcond.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +mask_block_ok.i.i.i: ; preds = %75, %93 + %.02.i.i.i = phi i64 [ %94, %93 ], [ 0, %75 ], !dbg !44 + %gep.i.i.i = getelementptr i64, ptr %77, i64 %.02.i.i.i, !dbg !44 + %95 = load i64, ptr %gep.i.i.i, align 4, !dbg !44 + %96 = icmp eq i64 %95, -1, !dbg !44 + br i1 %96, label %93, label %mask_block_err.i.i.i, !dbg !44 + +mask_block_err.i.i.i: ; preds = %mask_block_ok.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !44 + unreachable, !dbg !44 + +__barray_check_bounds.exit.i.i: ; preds = %loop_body.i, %__barray_mask_return.exit252 + %.fca.2.extract82.i187.i = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %.fca.2.extract82.i.i, %loop_body.i ] + %.fca.1.extract81.i186.i = phi ptr [ %1, %__barray_mask_return.exit252 ], [ %.fca.1.extract81.i.i, %loop_body.i ] + %.fca.0.extract80.i185.i = phi ptr [ %0, %__barray_mask_return.exit252 ], [ %.fca.0.extract80.i.i, %loop_body.i ] + %"163_0.sroa.15.0184.i" = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %97, %loop_body.i ] + %.pn165183.i = phi { { ptr, ptr, i64 }, i64 } [ %72, %__barray_mask_return.exit252 ], [ %112, %loop_body.i ] + %97 = add nuw nsw i64 %"163_0.sroa.15.0184.i", 1, !dbg !54 + %98 = add i64 %"163_0.sroa.15.0184.i", %.fca.2.extract82.i187.i, !dbg !55 + %99 = lshr i64 %98, 6, !dbg !56 + %100 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i186.i, i64 %99, !dbg !56 + %101 = load i64, ptr %100, align 4, !dbg !56 + %102 = and i64 %98, 63, !dbg !56 + %103 = lshr i64 %101, %102, !dbg !56 + %104 = trunc i64 %103 to i1, !dbg !56 + br i1 %104, label %panic.i.i.i, label %__barray_check_bounds.exit.i, !dbg !56 + +panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !56 + unreachable, !dbg !56 + +__barray_check_bounds.exit.i: ; preds = %__barray_check_bounds.exit.i.i + %105 = shl nuw i64 1, %102, !dbg !56 + %106 = xor i64 %105, %101, !dbg !56 + store i64 %106, ptr %100, align 4, !dbg !56 + %107 = getelementptr inbounds i64, ptr %.fca.0.extract80.i185.i, i64 %98, !dbg !55 + %108 = load i64, ptr %107, align 4, !dbg !55 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %108) + tail call void @___qfree(i64 %108) + %109 = load i64, ptr %74, align 4 + %110 = lshr i64 %109, %"163_0.sroa.15.0184.i" + %111 = trunc i64 %110 to i1 + br i1 %111, label %loop_body.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +loop_body.i: ; preds = %__barray_check_bounds.exit.i + %"182_054.fca.1.insert.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i, 1 + %"182_054.fca.2.insert.i" = insertvalue { i1, i64, i1 } %"182_054.fca.1.insert.i", i1 undef, 2 + %112 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, i64 %97, 1 + %113 = shl nuw nsw i64 1, %"163_0.sroa.15.0184.i" + %114 = xor i64 %109, %113 + store i64 %114, ptr %74, align 4 + %115 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %73, i64 %"163_0.sroa.15.0184.i" + store { i1, i64, i1 } %"182_054.fca.2.insert.i", ptr %115, align 4 + %116 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, 0 + %.fca.0.extract80.i.i = extractvalue { ptr, ptr, i64 } %116, 0 + %.fca.1.extract81.i.i = extractvalue { ptr, ptr, i64 } %116, 1 + %.fca.2.extract82.i.i = extractvalue { ptr, ptr, i64 } %116, 2 + %exitcond.not.i = icmp eq i64 %97, 10, !dbg !58 + br i1 %exitcond.not.i, label %75, label %__barray_check_bounds.exit.i.i + +"__hugr__.guppylang.std.quantum.measure_array$10.149.exit": ; preds = %93, %75 + tail call void @heap_free(ptr %.fca.0.extract80.i.i), !dbg !44 + tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i), !dbg !44 + %117 = load i64, ptr %74, align 4 + %118 = trunc i64 %117 to i1 + br i1 %118, label %cond_exit_369.thread, label %__barray_mask_borrow.exit259 + +cond_exit_369: ; preds = %cond_exit_369.thread.9 + tail call void @heap_free(ptr %73) + tail call void @heap_free(ptr nonnull %74) + ret void + +mask_block_err.i: ; preds = %cond_exit_369.thread.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") + unreachable + +__barray_mask_borrow.exit259: ; preds = %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %119 = or disjoint i64 %117, 1, !dbg !12 + store i64 %119, ptr %74, align 4, !dbg !12 + %120 = load { i1, i64, i1 }, ptr %73, align 4 + %.fca.0.extract167 = extractvalue { i1, i64, i1 } %120, 0 + br i1 %.fca.0.extract167, label %cond_392_case_1, label %cond_exit_369.thread + +cond_exit_369.thread: ; preds = %cond_392_case_1, %__barray_mask_borrow.exit259, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %121 = phi i64 [ %.pre, %cond_392_case_1 ], [ %119, %__barray_mask_borrow.exit259 ], [ %117, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" ] + %122 = and i64 %121, 2 + %.not290 = icmp eq i64 %122, 0 + br i1 %.not290, label %__barray_mask_borrow.exit259.1, label %cond_exit_369.thread.1 + +__barray_mask_borrow.exit259.1: ; preds = %cond_exit_369.thread + %123 = or disjoint i64 %121, 2, !dbg !12 + store i64 %123, ptr %74, align 4, !dbg !12 + %124 = getelementptr inbounds nuw i8, ptr %73, i64 24 + %125 = load { i1, i64, i1 }, ptr %124, align 4 + %.fca.0.extract167.1 = extractvalue { i1, i64, i1 } %125, 0 + br i1 %.fca.0.extract167.1, label %cond_392_case_1.1, label %cond_exit_369.thread.1 + +cond_392_case_1.1: ; preds = %__barray_mask_borrow.exit259.1 + %.fca.1.extract.1 = extractvalue { i1, i64, i1 } %125, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1) + %.pre281 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.1 + +cond_exit_369.thread.1: ; preds = %cond_392_case_1.1, %__barray_mask_borrow.exit259.1, %cond_exit_369.thread + %126 = phi i64 [ %.pre281, %cond_392_case_1.1 ], [ %123, %__barray_mask_borrow.exit259.1 ], [ %121, %cond_exit_369.thread ] + %127 = and i64 %126, 4 + %.not291 = icmp eq i64 %127, 0 + br i1 %.not291, label %__barray_mask_borrow.exit259.2, label %cond_exit_369.thread.2 + +__barray_mask_borrow.exit259.2: ; preds = %cond_exit_369.thread.1 + %128 = or disjoint i64 %126, 4, !dbg !12 + store i64 %128, ptr %74, align 4, !dbg !12 + %129 = getelementptr inbounds nuw i8, ptr %73, i64 48 + %130 = load { i1, i64, i1 }, ptr %129, align 4 + %.fca.0.extract167.2 = extractvalue { i1, i64, i1 } %130, 0 + br i1 %.fca.0.extract167.2, label %cond_392_case_1.2, label %cond_exit_369.thread.2 + +cond_392_case_1.2: ; preds = %__barray_mask_borrow.exit259.2 + %.fca.1.extract.2 = extractvalue { i1, i64, i1 } %130, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2) + %.pre282 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.2 + +cond_exit_369.thread.2: ; preds = %cond_392_case_1.2, %__barray_mask_borrow.exit259.2, %cond_exit_369.thread.1 + %131 = phi i64 [ %.pre282, %cond_392_case_1.2 ], [ %128, %__barray_mask_borrow.exit259.2 ], [ %126, %cond_exit_369.thread.1 ] + %132 = and i64 %131, 8 + %.not292 = icmp eq i64 %132, 0 + br i1 %.not292, label %__barray_mask_borrow.exit259.3, label %cond_exit_369.thread.3 + +__barray_mask_borrow.exit259.3: ; preds = %cond_exit_369.thread.2 + %133 = or disjoint i64 %131, 8, !dbg !12 + store i64 %133, ptr %74, align 4, !dbg !12 + %134 = getelementptr inbounds nuw i8, ptr %73, i64 72 + %135 = load { i1, i64, i1 }, ptr %134, align 4 + %.fca.0.extract167.3 = extractvalue { i1, i64, i1 } %135, 0 + br i1 %.fca.0.extract167.3, label %cond_392_case_1.3, label %cond_exit_369.thread.3 + +cond_392_case_1.3: ; preds = %__barray_mask_borrow.exit259.3 + %.fca.1.extract.3 = extractvalue { i1, i64, i1 } %135, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3) + %.pre283 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.3 + +cond_exit_369.thread.3: ; preds = %cond_392_case_1.3, %__barray_mask_borrow.exit259.3, %cond_exit_369.thread.2 + %136 = phi i64 [ %.pre283, %cond_392_case_1.3 ], [ %133, %__barray_mask_borrow.exit259.3 ], [ %131, %cond_exit_369.thread.2 ] + %137 = and i64 %136, 16 + %.not293 = icmp eq i64 %137, 0 + br i1 %.not293, label %__barray_mask_borrow.exit259.4, label %cond_exit_369.thread.4 + +__barray_mask_borrow.exit259.4: ; preds = %cond_exit_369.thread.3 + %138 = or disjoint i64 %136, 16, !dbg !12 + store i64 %138, ptr %74, align 4, !dbg !12 + %139 = getelementptr inbounds nuw i8, ptr %73, i64 96 + %140 = load { i1, i64, i1 }, ptr %139, align 4 + %.fca.0.extract167.4 = extractvalue { i1, i64, i1 } %140, 0 + br i1 %.fca.0.extract167.4, label %cond_392_case_1.4, label %cond_exit_369.thread.4 + +cond_392_case_1.4: ; preds = %__barray_mask_borrow.exit259.4 + %.fca.1.extract.4 = extractvalue { i1, i64, i1 } %140, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4) + %.pre284 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.4 + +cond_exit_369.thread.4: ; preds = %cond_392_case_1.4, %__barray_mask_borrow.exit259.4, %cond_exit_369.thread.3 + %141 = phi i64 [ %.pre284, %cond_392_case_1.4 ], [ %138, %__barray_mask_borrow.exit259.4 ], [ %136, %cond_exit_369.thread.3 ] + %142 = and i64 %141, 32 + %.not294 = icmp eq i64 %142, 0 + br i1 %.not294, label %__barray_mask_borrow.exit259.5, label %cond_exit_369.thread.5 + +__barray_mask_borrow.exit259.5: ; preds = %cond_exit_369.thread.4 + %143 = or disjoint i64 %141, 32, !dbg !12 + store i64 %143, ptr %74, align 4, !dbg !12 + %144 = getelementptr inbounds nuw i8, ptr %73, i64 120 + %145 = load { i1, i64, i1 }, ptr %144, align 4 + %.fca.0.extract167.5 = extractvalue { i1, i64, i1 } %145, 0 + br i1 %.fca.0.extract167.5, label %cond_392_case_1.5, label %cond_exit_369.thread.5 + +cond_392_case_1.5: ; preds = %__barray_mask_borrow.exit259.5 + %.fca.1.extract.5 = extractvalue { i1, i64, i1 } %145, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5) + %.pre285 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.5 + +cond_exit_369.thread.5: ; preds = %cond_392_case_1.5, %__barray_mask_borrow.exit259.5, %cond_exit_369.thread.4 + %146 = phi i64 [ %.pre285, %cond_392_case_1.5 ], [ %143, %__barray_mask_borrow.exit259.5 ], [ %141, %cond_exit_369.thread.4 ] + %147 = and i64 %146, 64 + %.not295 = icmp eq i64 %147, 0 + br i1 %.not295, label %__barray_mask_borrow.exit259.6, label %cond_exit_369.thread.6 + +__barray_mask_borrow.exit259.6: ; preds = %cond_exit_369.thread.5 + %148 = or disjoint i64 %146, 64, !dbg !12 + store i64 %148, ptr %74, align 4, !dbg !12 + %149 = getelementptr inbounds nuw i8, ptr %73, i64 144 + %150 = load { i1, i64, i1 }, ptr %149, align 4 + %.fca.0.extract167.6 = extractvalue { i1, i64, i1 } %150, 0 + br i1 %.fca.0.extract167.6, label %cond_392_case_1.6, label %cond_exit_369.thread.6 + +cond_392_case_1.6: ; preds = %__barray_mask_borrow.exit259.6 + %.fca.1.extract.6 = extractvalue { i1, i64, i1 } %150, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6) + %.pre286 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.6 + +cond_exit_369.thread.6: ; preds = %cond_392_case_1.6, %__barray_mask_borrow.exit259.6, %cond_exit_369.thread.5 + %151 = phi i64 [ %.pre286, %cond_392_case_1.6 ], [ %148, %__barray_mask_borrow.exit259.6 ], [ %146, %cond_exit_369.thread.5 ] + %152 = and i64 %151, 128 + %.not296 = icmp eq i64 %152, 0 + br i1 %.not296, label %__barray_mask_borrow.exit259.7, label %cond_exit_369.thread.7 + +__barray_mask_borrow.exit259.7: ; preds = %cond_exit_369.thread.6 + %153 = or disjoint i64 %151, 128, !dbg !12 + store i64 %153, ptr %74, align 4, !dbg !12 + %154 = getelementptr inbounds nuw i8, ptr %73, i64 168 + %155 = load { i1, i64, i1 }, ptr %154, align 4 + %.fca.0.extract167.7 = extractvalue { i1, i64, i1 } %155, 0 + br i1 %.fca.0.extract167.7, label %cond_392_case_1.7, label %cond_exit_369.thread.7 + +cond_392_case_1.7: ; preds = %__barray_mask_borrow.exit259.7 + %.fca.1.extract.7 = extractvalue { i1, i64, i1 } %155, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7) + %.pre287 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.7 + +cond_exit_369.thread.7: ; preds = %cond_392_case_1.7, %__barray_mask_borrow.exit259.7, %cond_exit_369.thread.6 + %156 = phi i64 [ %.pre287, %cond_392_case_1.7 ], [ %153, %__barray_mask_borrow.exit259.7 ], [ %151, %cond_exit_369.thread.6 ] + %157 = and i64 %156, 256 + %.not297 = icmp eq i64 %157, 0 + br i1 %.not297, label %__barray_mask_borrow.exit259.8, label %cond_exit_369.thread.8 + +__barray_mask_borrow.exit259.8: ; preds = %cond_exit_369.thread.7 + %158 = or disjoint i64 %156, 256, !dbg !12 + store i64 %158, ptr %74, align 4, !dbg !12 + %159 = getelementptr inbounds nuw i8, ptr %73, i64 192 + %160 = load { i1, i64, i1 }, ptr %159, align 4 + %.fca.0.extract167.8 = extractvalue { i1, i64, i1 } %160, 0 + br i1 %.fca.0.extract167.8, label %cond_392_case_1.8, label %cond_exit_369.thread.8 + +cond_392_case_1.8: ; preds = %__barray_mask_borrow.exit259.8 + %.fca.1.extract.8 = extractvalue { i1, i64, i1 } %160, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8) + %.pre288 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.8 + +cond_exit_369.thread.8: ; preds = %cond_392_case_1.8, %__barray_mask_borrow.exit259.8, %cond_exit_369.thread.7 + %161 = phi i64 [ %.pre288, %cond_392_case_1.8 ], [ %158, %__barray_mask_borrow.exit259.8 ], [ %156, %cond_exit_369.thread.7 ] + %162 = and i64 %161, 512 + %.not298 = icmp eq i64 %162, 0 + br i1 %.not298, label %__barray_mask_borrow.exit259.9, label %cond_exit_369.thread.9 + +__barray_mask_borrow.exit259.9: ; preds = %cond_exit_369.thread.8 + %163 = or disjoint i64 %161, 512, !dbg !12 + store i64 %163, ptr %74, align 4, !dbg !12 + %164 = getelementptr inbounds nuw i8, ptr %73, i64 216 + %165 = load { i1, i64, i1 }, ptr %164, align 4 + %.fca.0.extract167.9 = extractvalue { i1, i64, i1 } %165, 0 + br i1 %.fca.0.extract167.9, label %cond_392_case_1.9, label %cond_exit_369.thread.9 + +cond_392_case_1.9: ; preds = %__barray_mask_borrow.exit259.9 + %.fca.1.extract.9 = extractvalue { i1, i64, i1 } %165, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9) + %.pre289 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.9 + +cond_exit_369.thread.9: ; preds = %cond_392_case_1.9, %__barray_mask_borrow.exit259.9, %cond_exit_369.thread.8 + %166 = phi i64 [ %.pre289, %cond_392_case_1.9 ], [ %163, %__barray_mask_borrow.exit259.9 ], [ %161, %cond_exit_369.thread.8 ] + %167 = or i64 %166, -1024 + store i64 %167, ptr %74, align 4 + %168 = icmp eq i64 %167, -1 + br i1 %168, label %cond_exit_369, label %mask_block_err.i + +cond_392_case_1: ; preds = %__barray_mask_borrow.exit259 + %.fca.1.extract = extractvalue { i1, i64, i1 } %120, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract) + %.pre = load i64, ptr %74, align 4 + br label %cond_exit_369.thread +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn @@ -27,603 +627,12 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !59 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_207_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_207_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 = %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 - %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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.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.i238.i, label %__barray_mask_borrow.exit.i - -panic.i238.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 = %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.exit240.i, label %panic.i239.i - -panic.i239.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit240.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.exit242.i, label %panic.i241.i - -panic.i241.i: ; preds = %__barray_mask_return.exit240.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit242.i: ; preds = %__barray_mask_return.exit240.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 - %.not268.i = icmp eq i64 %54, 0 - br i1 %.not268.i, label %panic.i243.i, label %__barray_mask_return.exit244.i - -panic.i243.i: ; preds = %__barray_mask_borrow.exit242.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit244.i: ; preds = %__barray_mask_borrow.exit242.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 - %.not269.i = icmp eq i64 %57, 0 - br i1 %.not269.i, label %__barray_mask_borrow.exit246.i, label %panic.i245.i - -panic.i245.i: ; preds = %__barray_mask_return.exit244.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit246.i: ; preds = %__barray_mask_return.exit244.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 - %.not270.i = icmp eq i64 %61, 0 - br i1 %.not270.i, label %panic.i247.i, label %__barray_mask_return.exit248.i - -panic.i247.i: ; preds = %__barray_mask_borrow.exit246.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit248.i: ; preds = %__barray_mask_borrow.exit246.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 - %.not271.i = icmp eq i64 %64, 0 - br i1 %.not271.i, label %__barray_mask_borrow.exit250.i, label %panic.i249.i - -panic.i249.i: ; preds = %__barray_mask_return.exit248.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit250.i: ; preds = %__barray_mask_return.exit248.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 - %.not272.i = icmp eq i64 %68, 0 - br i1 %.not272.i, label %panic.i251.i, label %__barray_mask_return.exit252.i - -panic.i251.i: ; preds = %__barray_mask_borrow.exit250.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit252.i: ; preds = %__barray_mask_borrow.exit250.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 } %"116.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.extract82.i.i.i, 6 - %75 = getelementptr i64, ptr %.fca.1.extract81.i.i.i, i64 %74 - %76 = load i64, ptr %75, align 4 - %77 = and i64 %.fca.2.extract82.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.extract82.i.i.i, 9 - %83 = lshr i64 %last_valid.i.i.i.i, 6 - %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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).280.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).280.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, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit252.i - %.fca.2.extract82.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %.fca.2.extract82.i.i.i, %loop_body.i.i ] - %.fca.1.extract81.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit252.i ], [ %.fca.1.extract81.i.i.i, %loop_body.i.i ] - %.fca.0.extract80.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit252.i ], [ %.fca.0.extract80.i.i.i, %loop_body.i.i ] - %"306_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %95, %loop_body.i.i ] - %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit252.i ], [ %110, %loop_body.i.i ] - %95 = add nuw nsw i64 %"306_0.sroa.15.0184.i.i", 1 - %96 = add i64 %"306_0.sroa.15.0184.i.i", %.fca.2.extract82.i187.i.i - %97 = lshr i64 %96, 6 - %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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 = %__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.extract80.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, %"306_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, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"371_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 - %"371_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"371_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, %"306_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 %"306_0.sroa.15.0184.i.i" - store { i1, i64, i1 } %"371_054.fca.2.insert.i.i", ptr %113, align 4 - %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 - %.fca.0.extract80.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 - %.fca.1.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 - %.fca.2.extract82.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).280.exit.i": ; preds = %91, %73 - tail call void @heap_free(ptr %.fca.0.extract80.i.i.i) - tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i.i) - %115 = load i64, ptr %72, align 4 - %116 = trunc i64 %115 to i1 - br i1 %116, label %cond_exit_89.thread.i, label %__barray_mask_borrow.exit259.i - -mask_block_err.i.i: ; preds = %cond_exit_89.thread.9.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_mask_borrow.exit259.i: ; preds = %"__hugr__.$measure_array$$n(10).280.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.extract167.i = extractvalue { i1, i64, i1 } %118, 0 - br i1 %.fca.0.extract167.i, label %cond_392_case_1.i, label %cond_exit_89.thread.i - -cond_exit_89.thread.i: ; preds = %cond_392_case_1.i, %__barray_mask_borrow.exit259.i, %"__hugr__.$measure_array$$n(10).280.exit.i" - %119 = phi i64 [ %.pre.i, %cond_392_case_1.i ], [ %117, %__barray_mask_borrow.exit259.i ], [ %115, %"__hugr__.$measure_array$$n(10).280.exit.i" ] - %120 = and i64 %119, 2 - %.not290.i = icmp eq i64 %120, 0 - br i1 %.not290.i, label %__barray_mask_borrow.exit259.1.i, label %cond_exit_89.thread.1.i - -__barray_mask_borrow.exit259.1.i: ; preds = %cond_exit_89.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.extract167.1.i = extractvalue { i1, i64, i1 } %123, 0 - br i1 %.fca.0.extract167.1.i, label %cond_392_case_1.1.i, label %cond_exit_89.thread.1.i - -cond_392_case_1.1.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre281.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.1.i - -cond_exit_89.thread.1.i: ; preds = %cond_392_case_1.1.i, %__barray_mask_borrow.exit259.1.i, %cond_exit_89.thread.i - %124 = phi i64 [ %.pre281.i, %cond_392_case_1.1.i ], [ %121, %__barray_mask_borrow.exit259.1.i ], [ %119, %cond_exit_89.thread.i ] - %125 = and i64 %124, 4 - %.not291.i = icmp eq i64 %125, 0 - br i1 %.not291.i, label %__barray_mask_borrow.exit259.2.i, label %cond_exit_89.thread.2.i - -__barray_mask_borrow.exit259.2.i: ; preds = %cond_exit_89.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.extract167.2.i = extractvalue { i1, i64, i1 } %128, 0 - br i1 %.fca.0.extract167.2.i, label %cond_392_case_1.2.i, label %cond_exit_89.thread.2.i - -cond_392_case_1.2.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre282.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.2.i - -cond_exit_89.thread.2.i: ; preds = %cond_392_case_1.2.i, %__barray_mask_borrow.exit259.2.i, %cond_exit_89.thread.1.i - %129 = phi i64 [ %.pre282.i, %cond_392_case_1.2.i ], [ %126, %__barray_mask_borrow.exit259.2.i ], [ %124, %cond_exit_89.thread.1.i ] - %130 = and i64 %129, 8 - %.not292.i = icmp eq i64 %130, 0 - br i1 %.not292.i, label %__barray_mask_borrow.exit259.3.i, label %cond_exit_89.thread.3.i - -__barray_mask_borrow.exit259.3.i: ; preds = %cond_exit_89.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.extract167.3.i = extractvalue { i1, i64, i1 } %133, 0 - br i1 %.fca.0.extract167.3.i, label %cond_392_case_1.3.i, label %cond_exit_89.thread.3.i - -cond_392_case_1.3.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre283.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.3.i - -cond_exit_89.thread.3.i: ; preds = %cond_392_case_1.3.i, %__barray_mask_borrow.exit259.3.i, %cond_exit_89.thread.2.i - %134 = phi i64 [ %.pre283.i, %cond_392_case_1.3.i ], [ %131, %__barray_mask_borrow.exit259.3.i ], [ %129, %cond_exit_89.thread.2.i ] - %135 = and i64 %134, 16 - %.not293.i = icmp eq i64 %135, 0 - br i1 %.not293.i, label %__barray_mask_borrow.exit259.4.i, label %cond_exit_89.thread.4.i - -__barray_mask_borrow.exit259.4.i: ; preds = %cond_exit_89.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.extract167.4.i = extractvalue { i1, i64, i1 } %138, 0 - br i1 %.fca.0.extract167.4.i, label %cond_392_case_1.4.i, label %cond_exit_89.thread.4.i - -cond_392_case_1.4.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre284.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.4.i - -cond_exit_89.thread.4.i: ; preds = %cond_392_case_1.4.i, %__barray_mask_borrow.exit259.4.i, %cond_exit_89.thread.3.i - %139 = phi i64 [ %.pre284.i, %cond_392_case_1.4.i ], [ %136, %__barray_mask_borrow.exit259.4.i ], [ %134, %cond_exit_89.thread.3.i ] - %140 = and i64 %139, 32 - %.not294.i = icmp eq i64 %140, 0 - br i1 %.not294.i, label %__barray_mask_borrow.exit259.5.i, label %cond_exit_89.thread.5.i - -__barray_mask_borrow.exit259.5.i: ; preds = %cond_exit_89.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.extract167.5.i = extractvalue { i1, i64, i1 } %143, 0 - br i1 %.fca.0.extract167.5.i, label %cond_392_case_1.5.i, label %cond_exit_89.thread.5.i - -cond_392_case_1.5.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre285.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.5.i - -cond_exit_89.thread.5.i: ; preds = %cond_392_case_1.5.i, %__barray_mask_borrow.exit259.5.i, %cond_exit_89.thread.4.i - %144 = phi i64 [ %.pre285.i, %cond_392_case_1.5.i ], [ %141, %__barray_mask_borrow.exit259.5.i ], [ %139, %cond_exit_89.thread.4.i ] - %145 = and i64 %144, 64 - %.not295.i = icmp eq i64 %145, 0 - br i1 %.not295.i, label %__barray_mask_borrow.exit259.6.i, label %cond_exit_89.thread.6.i - -__barray_mask_borrow.exit259.6.i: ; preds = %cond_exit_89.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.extract167.6.i = extractvalue { i1, i64, i1 } %148, 0 - br i1 %.fca.0.extract167.6.i, label %cond_392_case_1.6.i, label %cond_exit_89.thread.6.i - -cond_392_case_1.6.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre286.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.6.i - -cond_exit_89.thread.6.i: ; preds = %cond_392_case_1.6.i, %__barray_mask_borrow.exit259.6.i, %cond_exit_89.thread.5.i - %149 = phi i64 [ %.pre286.i, %cond_392_case_1.6.i ], [ %146, %__barray_mask_borrow.exit259.6.i ], [ %144, %cond_exit_89.thread.5.i ] - %150 = and i64 %149, 128 - %.not296.i = icmp eq i64 %150, 0 - br i1 %.not296.i, label %__barray_mask_borrow.exit259.7.i, label %cond_exit_89.thread.7.i - -__barray_mask_borrow.exit259.7.i: ; preds = %cond_exit_89.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.extract167.7.i = extractvalue { i1, i64, i1 } %153, 0 - br i1 %.fca.0.extract167.7.i, label %cond_392_case_1.7.i, label %cond_exit_89.thread.7.i - -cond_392_case_1.7.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre287.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.7.i - -cond_exit_89.thread.7.i: ; preds = %cond_392_case_1.7.i, %__barray_mask_borrow.exit259.7.i, %cond_exit_89.thread.6.i - %154 = phi i64 [ %.pre287.i, %cond_392_case_1.7.i ], [ %151, %__barray_mask_borrow.exit259.7.i ], [ %149, %cond_exit_89.thread.6.i ] - %155 = and i64 %154, 256 - %.not297.i = icmp eq i64 %155, 0 - br i1 %.not297.i, label %__barray_mask_borrow.exit259.8.i, label %cond_exit_89.thread.8.i - -__barray_mask_borrow.exit259.8.i: ; preds = %cond_exit_89.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.extract167.8.i = extractvalue { i1, i64, i1 } %158, 0 - br i1 %.fca.0.extract167.8.i, label %cond_392_case_1.8.i, label %cond_exit_89.thread.8.i - -cond_392_case_1.8.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre288.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.8.i - -cond_exit_89.thread.8.i: ; preds = %cond_392_case_1.8.i, %__barray_mask_borrow.exit259.8.i, %cond_exit_89.thread.7.i - %159 = phi i64 [ %.pre288.i, %cond_392_case_1.8.i ], [ %156, %__barray_mask_borrow.exit259.8.i ], [ %154, %cond_exit_89.thread.7.i ] - %160 = and i64 %159, 512 - %.not298.i = icmp eq i64 %160, 0 - br i1 %.not298.i, label %__barray_mask_borrow.exit259.9.i, label %cond_exit_89.thread.9.i - -__barray_mask_borrow.exit259.9.i: ; preds = %cond_exit_89.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.extract167.9.i = extractvalue { i1, i64, i1 } %163, 0 - br i1 %.fca.0.extract167.9.i, label %cond_392_case_1.9.i, label %cond_exit_89.thread.9.i - -cond_392_case_1.9.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre289.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.9.i - -cond_exit_89.thread.9.i: ; preds = %cond_392_case_1.9.i, %__barray_mask_borrow.exit259.9.i, %cond_exit_89.thread.8.i - %164 = phi i64 [ %.pre289.i, %cond_392_case_1.9.i ], [ %161, %__barray_mask_borrow.exit259.9.i ], [ %159, %cond_exit_89.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_392_case_1.i: ; preds = %__barray_mask_borrow.exit259.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 - tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - %.pre.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.i - -__hugr__.main.1.exit: ; preds = %cond_exit_89.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 + tail call void @setup(i64 %0), !dbg !63 + tail call void @"__hugr__.__main__.measure_qb_array..main.1"(), !dbg !63 + %1 = tail call i64 @teardown(), !dbg !63 + ret i64 %1, !dbg !63 } declare void @setup(i64) local_unnamed_addr @@ -632,6 +641,71 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "measure_qb_array..main", linkageName: "__hugr__.__main__.measure_qb_array..main.1", scope: null, file: !5, line: 101, type: !6, scopeLine: 102, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 102, column: 13, scope: !4) +!9 = !DILocation(line: 102, column: 19, scope: !4) +!10 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !11) +!11 = distinct !DILocation(line: 103, column: 10, scope: !4) +!12 = !DILocation(line: 103, column: 10, scope: !4) +!13 = !DILocation(line: 103, column: 8, scope: !4) +!14 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !15) +!15 = distinct !DILocation(line: 104, column: 10, scope: !4) +!16 = !DILocation(line: 104, column: 10, scope: !4) +!17 = !DILocation(line: 104, column: 8, scope: !4) +!18 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !19) +!19 = distinct !DILocation(line: 105, column: 10, scope: !4) +!20 = !DILocation(line: 105, column: 10, scope: !4) +!21 = !DILocation(line: 105, column: 8, scope: !4) +!22 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !23) +!23 = distinct !DILocation(line: 106, column: 10, scope: !4) +!24 = !DILocation(line: 106, column: 10, scope: !4) +!25 = !DILocation(line: 106, column: 8, scope: !4) +!26 = !DILocation(line: 84, column: 25, scope: !27, inlinedAt: !37) +!27 = distinct !DISubprogram(name: "std.array.array.__iter__$qubit&10", linkageName: "__hugr__.guppylang.std.array.array.__iter__$qubit&10.190", scope: null, file: !28, line: 83, type: !29, scopeLine: 84, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!28 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/array.py", directory: "") +!29 = !DISubroutineType(types: !30) +!30 = !{!31, !33} +!31 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { ptr, ptr, i64 }, i64 }", file: !2, size: 32, align: 8, elements: !32) +!32 = !{!33, !36} +!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !34) +!34 = !{!35, !35, !36} +!35 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!36 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!37 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!38 = distinct !DISubprogram(name: "std.quantum.measure_array$10", linkageName: "__hugr__.guppylang.std.quantum.measure_array$10.149", scope: null, file: !39, line: 380, type: !40, scopeLine: 382, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!39 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!40 = !DISubroutineType(types: !41) +!41 = !{!33, !33} +!42 = distinct !DILocation(line: 107, column: 8, scope: !4) +!43 = !DILocation(line: 382, column: 11, scope: !38, inlinedAt: !42) +!44 = !DILocation(line: 276, column: 8, scope: !45, inlinedAt: !53) +!45 = distinct !DISubprogram(name: "std.array.ArrayIter.__next__$qubit&10", linkageName: "__hugr__.guppylang.std.array.ArrayIter.__next__$qubit&10.202", scope: null, file: !28, line: 270, type: !46, scopeLine: 273, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!46 = !DISubroutineType(types: !47) +!47 = !{!48, !31} +!48 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, { { { ptr, ptr, i64 }, i64 }, i64 } }", file: !2, size: 40, align: 8, elements: !49) +!49 = !{!50, !51} +!50 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!51 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { { ptr, ptr, i64 }, i64 }, i64 }", file: !2, size: 40, align: 8, elements: !52) +!52 = !{!31, !36} +!53 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!54 = !DILocation(line: 275, column: 50, scope: !45, inlinedAt: !53) +!55 = !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!56 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !57) +!57 = distinct !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!58 = !DILocation(line: 273, column: 11, scope: !45, inlinedAt: !53) +!59 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !60, type: !61, spFlags: DISPFlagDefinition, unit: !1) +!60 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!61 = !DISubroutineType(types: !62) +!62 = !{!36, !36} +!63 = !DILocation(line: 0, scope: !59) 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 970d19465..2b0bd5a60 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 @@ -5,6 +5,26 @@ 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." +define void @"__hugr__.__main__.no_results..bar.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_18_case_0.i, label %__hugr__.__tk2_qalloc.14.exit, !dbg !8 + +cond_18_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.14.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___dec_future_refcount(i64 %lazy_measure) + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -22,26 +42,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + tail call void @"__hugr__.__main__.no_results..bar.1"(), !dbg !15 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr @@ -50,6 +56,23 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "no_results..bar", linkageName: "__hugr__.__main__.no_results..bar.1", scope: null, file: !5, line: 64, type: !6, scopeLine: 65, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 65, column: 20, scope: !4) +!9 = !DILocation(line: 66, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) 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 bb4c313a8..38469c430 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 @@ -7,6 +7,38 @@ target triple = "x86_64-unknown-linux-gnu" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_exit..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_45_case_0.i, label %__hugr__.__tk2_qalloc.41.exit, !dbg !8 + +cond_45_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.41.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_98_case_1 + +cond_98_case_1: ; preds = %__hugr__.__tk2_qalloc.41.exit + %read_bool66 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.41.exit + tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_45_case_0.i.i, label %__hugr__.__tk2_qalloc.41.exit.i - -cond_45_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.41.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - %read_bool66.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_exit..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_exit..main", linkageName: "__hugr__.__main__.postselect_exit..main.1", scope: null, file: !5, line: 131, type: !6, scopeLine: 132, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 132, column: 12, scope: !4) +!9 = !DILocation(line: 133, column: 8, scope: !4) +!10 = !DILocation(line: 137, column: 8, scope: !4) +!11 = !DILocation(line: 136, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 fa8c093df..70c237edc 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 @@ -7,6 +7,38 @@ target triple = "x86_64-unknown-linux-gnu" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_panic..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_43_case_0.i, label %__hugr__.__tk2_qalloc.39.exit, !dbg !8 + +cond_43_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.39.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_96_case_1 + +cond_96_case_1: ; preds = %__hugr__.__tk2_qalloc.39.exit + %read_bool65 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.39.exit + tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_43_case_0.i.i, label %__hugr__.__tk2_qalloc.39.exit.i - -cond_43_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.39.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - %read_bool65.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_panic..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_panic..main", linkageName: "__hugr__.__main__.postselect_panic..main.1", scope: null, file: !5, line: 144, type: !6, scopeLine: 145, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 145, column: 12, scope: !4) +!9 = !DILocation(line: 146, column: 8, scope: !4) +!10 = !DILocation(line: 150, column: 8, scope: !4) +!11 = !DILocation(line: 149, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 eac1eb476..5b6f4a73a 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 @@ -5,23 +5,50 @@ target triple = "x86_64-unknown-linux-gnu" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" +define void @"__hugr__.__main__.print_current_shot..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %shot = tail call i64 @get_current_shot(), !dbg !8 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot), !dbg !9 + ret void +} + declare i64 @get_current_shot() local_unnamed_addr declare void @print_int(ptr, i64, i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + %shot.i = tail call i64 @get_current_shot(), !dbg !16 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i), !dbg !18 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "print_current_shot..main", linkageName: "__hugr__.__main__.print_current_shot..main.1", scope: null, file: !5, line: 194, type: !6, scopeLine: 195, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 195, column: 23, scope: !4) +!9 = !DILocation(line: 195, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) +!16 = !DILocation(line: 195, column: 23, scope: !4, inlinedAt: !17) +!17 = distinct !DILocation(line: 0, scope: !10) +!18 = !DILocation(line: 195, column: 8, scope: !4, inlinedAt: !17) 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 2d92b14ca..802e05075 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 @@ -11,6 +11,32 @@ target triple = "x86_64-unknown-linux-gnu" @res_rfloat2.4DAB941F.0 = private constant [19 x i8] c"\12USER:FLOAT:rfloat2" @res_rint_bnd2.169DE399.0 = private constant [19 x i8] c"\12USER:INT:rint_bnd2" +define void @"__hugr__.__main__.rng..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + tail call void @random_seed(i64 42), !dbg !8 + %rint = tail call i32 @random_int(), !dbg !17 + %rint14 = tail call i32 @random_int(), !dbg !18 + %rfloat = tail call double @random_float(), !dbg !19 + %rintb = tail call i32 @random_rng(i32 100), !dbg !20 + %0 = sext i32 %rintb to i64, !dbg !20 + %1 = sext i32 %rint14 to i64, !dbg !18 + %2 = sext i32 %rint to i64, !dbg !17 + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %2), !dbg !21 + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %1), !dbg !22 + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat), !dbg !23 + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %0), !dbg !24 + tail call void @random_seed(i64 84), !dbg !25 + %rint47 = tail call i32 @random_int(), !dbg !27 + %rfloat49 = tail call double @random_float(), !dbg !28 + %rintb52 = tail call i32 @random_rng(i32 200), !dbg !29 + %3 = sext i32 %rintb52 to i64, !dbg !29 + %4 = sext i32 %rint47 to i64, !dbg !27 + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %4), !dbg !30 + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat49), !dbg !31 + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %3), !dbg !32 + ret void +} + declare i32 @random_int() local_unnamed_addr declare double @random_float() local_unnamed_addr @@ -23,38 +49,57 @@ declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !33 { entry: - tail call void @setup(i64 %0) - tail call void @random_seed(i64 42) - %rint.i = tail call i32 @random_int() - %rint14.i = tail call i32 @random_int() - %rfloat.i = tail call double @random_float() - %rintb.i = tail call i32 @random_rng(i32 100) - %1 = sext i32 %rintb.i to i64 - %2 = sext i32 %rint14.i to i64 - %3 = sext i32 %rint.i to i64 - 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) - %rint47.i = tail call i32 @random_int() - %rfloat49.i = tail call double @random_float() - %rintb52.i = tail call i32 @random_rng(i32 200) - %4 = sext i32 %rintb52.i to i64 - %5 = sext i32 %rint47.i to i64 - 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 %rfloat49.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 + tail call void @setup(i64 %0), !dbg !37 + tail call void @"__hugr__.__main__.rng..main.1"(), !dbg !37 + %1 = tail call i64 @teardown(), !dbg !37 + ret i64 %1, !dbg !37 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} -!0 = !{!"mainlib"} +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rng..main", linkageName: "__hugr__.__main__.rng..main.1", scope: null, file: !5, line: 202, type: !6, scopeLine: 203, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !16) +!9 = distinct !DISubprogram(name: "std.qsystem.random.RNG.__new__", linkageName: "__hugr__.guppylang.std.qsystem.random.RNG.__new__.72", scope: null, file: !10, line: 42, type: !11, scopeLine: 44, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!10 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/qsystem/random.py", directory: "") +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !15} +!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !14) +!14 = !{} +!15 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!16 = distinct !DILocation(line: 203, column: 14, scope: !4) +!17 = !DILocation(line: 204, column: 15, scope: !4) +!18 = !DILocation(line: 205, column: 16, scope: !4) +!19 = !DILocation(line: 206, column: 17, scope: !4) +!20 = !DILocation(line: 207, column: 19, scope: !4) +!21 = !DILocation(line: 209, column: 8, scope: !4) +!22 = !DILocation(line: 210, column: 8, scope: !4) +!23 = !DILocation(line: 211, column: 8, scope: !4) +!24 = !DILocation(line: 212, column: 8, scope: !4) +!25 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !26) +!26 = distinct !DILocation(line: 213, column: 14, scope: !4) +!27 = !DILocation(line: 214, column: 15, scope: !4) +!28 = !DILocation(line: 215, column: 17, scope: !4) +!29 = !DILocation(line: 216, column: 19, scope: !4) +!30 = !DILocation(line: 218, column: 8, scope: !4) +!31 = !DILocation(line: 219, column: 8, scope: !4) +!32 = !DILocation(line: 220, column: 8, scope: !4) +!33 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !34, type: !35, spFlags: DISPFlagDefinition, unit: !1) +!34 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!35 = !DISubroutineType(types: !36) +!36 = !{!15, !15} +!37 = !DILocation(line: 0, scope: !33) 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 ed9940c71..9b2a555e5 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 @@ -6,6 +6,93 @@ target triple = "x86_64-unknown-linux-gnu" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.rus..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_87_case_0.i, label %__hugr__.__tk2_qalloc.83.exit, !dbg !8 + +cond_87_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.83.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + %qalloc.i132.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i133.i = icmp eq i64 %qalloc.i132.i, -1, !dbg !9 + br i1 %not_max.not.not.i133.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_101_case_0.i.i: ; preds = %cond_242_case_1.backedge.i, %__hugr__.__tk2_qalloc.83.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.97.exit.i: ; preds = %__hugr__.__tk2_qalloc.83.exit, %cond_242_case_1.backedge.i + %qalloc.i134.i = phi i64 [ %qalloc.i.i, %cond_242_case_1.backedge.i ], [ %qalloc.i132.i, %__hugr__.__tk2_qalloc.83.exit ] + tail call void @___reset(i64 %qalloc.i134.i), !dbg !9 + %qalloc.i128.i = tail call i64 @___qalloc(), !dbg !15 + %not_max.not.not.i129.i = icmp eq i64 %qalloc.i128.i, -1, !dbg !15 + br i1 %not_max.not.not.i129.i, label %cond_115_case_0.i.i, label %__hugr__.__tk2_qalloc.111.exit.i, !dbg !15 + +cond_115_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !15 + unreachable, !dbg !15 + +__hugr__.__tk2_qalloc.111.exit.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @___reset(i64 %qalloc.i128.i), !dbg !15 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !16 + tail call void @___rz(i64 %qalloc.i128.i, double 0x400921FB54442D18), !dbg !16 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0x400921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFE921FB54442D18), !dbg !18 + tail call void @___rxy(i64 %qalloc.i134.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rzz(i64 %qalloc.i128.i, i64 %qalloc.i134.i, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0x3FE921FB54442D18), !dbg !20 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i) + tail call void @___qfree(i64 %qalloc.i134.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 %cond_256_case_1.i, label %0 + +0: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___qfree(i64 %qalloc.i128.i), !dbg !21 + br label %cond_242_case_1.backedge.i + +cond_242_case_1.backedge.i: ; preds = %1, %0 + %qalloc.i.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1, !dbg !9 + br i1 %not_max.not.not.i.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_256_case_1.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___rz(i64 %qalloc.i, double 0x3FE921FB54442D18), !dbg !22 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !23 + tail call void @___rxy(i64 %qalloc.i128.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rzz(i64 %qalloc.i, i64 %qalloc.i128.i, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0x3FE921FB54442D18), !dbg !25 + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i) + tail call void @___qfree(i64 %qalloc.i128.i) + %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) + tail call void @___dec_future_refcount(i64 %lazy_measure67.i) + br i1 %read_bool80.i, label %"__hugr__.__main__.rus..rus.17.exit", label %1 + +1: ; preds = %cond_256_case_1.i + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !26 + br label %cond_242_case_1.backedge.i + +"__hugr__.__main__.rus..rus.17.exit": ; preds = %cond_256_case_1.i + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool), !dbg !27 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -29,93 +116,12 @@ declare void @___rz(i64, double) local_unnamed_addr declare void @___rzz(i64, i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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 = %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 = %__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.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 - -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 = %__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 %1 - -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 %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 %2 - -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 %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(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) - %3 = tail call i64 @teardown() - ret i64 %3 + tail call void @setup(i64 %0), !dbg !30 + tail call void @"__hugr__.__main__.rus..main.1"(), !dbg !30 + %1 = tail call i64 @teardown(), !dbg !30 + ret i64 %1, !dbg !30 } declare void @setup(i64) local_unnamed_addr @@ -124,6 +130,38 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rus..main", linkageName: "__hugr__.__main__.rus..main.1", scope: null, file: !5, line: 184, type: !6, scopeLine: 185, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 185, column: 12, scope: !4) +!9 = !DILocation(line: 160, column: 19, scope: !10, inlinedAt: !14) +!10 = distinct !DISubprogram(name: "rus..rus", linkageName: "__hugr__.__main__.rus..rus.17", scope: null, file: !5, line: 157, type: !11, scopeLine: 158, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !13} +!13 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!14 = distinct !DILocation(line: 186, column: 8, scope: !4) +!15 = !DILocation(line: 160, column: 28, scope: !10, inlinedAt: !14) +!16 = !DILocation(line: 162, column: 12, scope: !10, inlinedAt: !14) +!17 = !DILocation(line: 161, column: 12, scope: !10, inlinedAt: !14) +!18 = !DILocation(line: 164, column: 12, scope: !10, inlinedAt: !14) +!19 = !DILocation(line: 165, column: 12, scope: !10, inlinedAt: !14) +!20 = !DILocation(line: 166, column: 12, scope: !10, inlinedAt: !14) +!21 = !DILocation(line: 169, column: 16, scope: !10, inlinedAt: !14) +!22 = !DILocation(line: 172, column: 12, scope: !10, inlinedAt: !14) +!23 = !DILocation(line: 173, column: 12, scope: !10, inlinedAt: !14) +!24 = !DILocation(line: 174, column: 12, scope: !10, inlinedAt: !14) +!25 = !DILocation(line: 175, column: 12, scope: !10, inlinedAt: !14) +!26 = !DILocation(line: 181, column: 12, scope: !10, inlinedAt: !14) +!27 = !DILocation(line: 187, column: 8, scope: !4) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !11, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DILocation(line: 0, scope: !28) 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 12ac202e7..f9bb0b2b8 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 @@ -4,284 +4,363 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80: 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" -@"e_Array elem.E746B1A3.0" = private constant [43 x i8] c"*EXIT:INT:Array element is already borrowed" @"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." +define void @"__hugr__.__main__.discard_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_233_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_233_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_233_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not = icmp eq i64 %6, 0 + br i1 %.not, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_233_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not108 = icmp eq i64 %10, 0 + br i1 %.not108, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_233_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not109 = icmp eq i64 %14, 0 + br i1 %.not109, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_233_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not110 = icmp eq i64 %18, 0 + br i1 %.not110, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_233_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not111 = icmp eq i64 %22, 0 + br i1 %.not111, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_233_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not112 = icmp eq i64 %26, 0 + br i1 %.not112, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_233_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not113 = icmp eq i64 %30, 0 + br i1 %.not113, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_233_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not114 = icmp eq i64 %34, 0 + br i1 %.not114, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_233_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not115 = icmp eq i64 %38, 0 + br i1 %.not115, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %cond_171_case_1.1.i, label %__barray_mask_borrow.exit.i + +cond_171_case_1.1.i: ; preds = %__barray_mask_borrow.exit.i, %cond_exit_20.9 + %43 = phi i64 [ %41, %cond_exit_20.9 ], [ %.pre.i, %__barray_mask_borrow.exit.i ], !dbg !10 + %44 = and i64 %43, 2, !dbg !10 + %.not.i = icmp eq i64 %44, 0, !dbg !10 + br i1 %.not.i, label %__barray_mask_borrow.exit.1.i, label %cond_171_case_1.2.i + +__barray_mask_borrow.exit.1.i: ; preds = %cond_171_case_1.1.i + %45 = or disjoint i64 %43, 2, !dbg !21 + store i64 %45, ptr %1, align 4, !dbg !21 + %46 = getelementptr inbounds nuw i8, ptr %0, i64 8, !dbg !23 + %47 = load i64, ptr %46, align 4, !dbg !23 + tail call void @___qfree(i64 %47), !dbg !24 + %.pre337.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.2.i + +cond_171_case_1.2.i: ; preds = %__barray_mask_borrow.exit.1.i, %cond_171_case_1.1.i + %48 = phi i64 [ %.pre337.i, %__barray_mask_borrow.exit.1.i ], [ %43, %cond_171_case_1.1.i ], !dbg !10 + %49 = and i64 %48, 4, !dbg !10 + %.not345.i = icmp eq i64 %49, 0, !dbg !10 + br i1 %.not345.i, label %__barray_mask_borrow.exit.2.i, label %cond_171_case_1.3.i + +__barray_mask_borrow.exit.2.i: ; preds = %cond_171_case_1.2.i + %50 = or disjoint i64 %48, 4, !dbg !21 + store i64 %50, ptr %1, align 4, !dbg !21 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !23 + %52 = load i64, ptr %51, align 4, !dbg !23 + tail call void @___qfree(i64 %52), !dbg !24 + %.pre338.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.3.i + +cond_171_case_1.3.i: ; preds = %__barray_mask_borrow.exit.2.i, %cond_171_case_1.2.i + %53 = phi i64 [ %.pre338.i, %__barray_mask_borrow.exit.2.i ], [ %48, %cond_171_case_1.2.i ], !dbg !10 + %54 = and i64 %53, 8, !dbg !10 + %.not346.i = icmp eq i64 %54, 0, !dbg !10 + br i1 %.not346.i, label %__barray_mask_borrow.exit.3.i, label %cond_171_case_1.4.i + +__barray_mask_borrow.exit.3.i: ; preds = %cond_171_case_1.3.i + %55 = or disjoint i64 %53, 8, !dbg !21 + store i64 %55, ptr %1, align 4, !dbg !21 + %56 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !23 + %57 = load i64, ptr %56, align 4, !dbg !23 + tail call void @___qfree(i64 %57), !dbg !24 + %.pre339.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.4.i + +cond_171_case_1.4.i: ; preds = %__barray_mask_borrow.exit.3.i, %cond_171_case_1.3.i + %58 = phi i64 [ %.pre339.i, %__barray_mask_borrow.exit.3.i ], [ %53, %cond_171_case_1.3.i ], !dbg !10 + %59 = and i64 %58, 16, !dbg !10 + %.not347.i = icmp eq i64 %59, 0, !dbg !10 + br i1 %.not347.i, label %__barray_mask_borrow.exit.4.i, label %cond_171_case_1.5.i + +__barray_mask_borrow.exit.4.i: ; preds = %cond_171_case_1.4.i + %60 = or disjoint i64 %58, 16, !dbg !21 + store i64 %60, ptr %1, align 4, !dbg !21 + %61 = getelementptr inbounds nuw i8, ptr %0, i64 32, !dbg !23 + %62 = load i64, ptr %61, align 4, !dbg !23 + tail call void @___qfree(i64 %62), !dbg !24 + %.pre340.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.5.i + +cond_171_case_1.5.i: ; preds = %__barray_mask_borrow.exit.4.i, %cond_171_case_1.4.i + %63 = phi i64 [ %.pre340.i, %__barray_mask_borrow.exit.4.i ], [ %58, %cond_171_case_1.4.i ], !dbg !10 + %64 = and i64 %63, 32, !dbg !10 + %.not348.i = icmp eq i64 %64, 0, !dbg !10 + br i1 %.not348.i, label %__barray_mask_borrow.exit.5.i, label %cond_171_case_1.6.i + +__barray_mask_borrow.exit.5.i: ; preds = %cond_171_case_1.5.i + %65 = or disjoint i64 %63, 32, !dbg !21 + store i64 %65, ptr %1, align 4, !dbg !21 + %66 = getelementptr inbounds nuw i8, ptr %0, i64 40, !dbg !23 + %67 = load i64, ptr %66, align 4, !dbg !23 + tail call void @___qfree(i64 %67), !dbg !24 + %.pre341.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.6.i + +cond_171_case_1.6.i: ; preds = %__barray_mask_borrow.exit.5.i, %cond_171_case_1.5.i + %68 = phi i64 [ %.pre341.i, %__barray_mask_borrow.exit.5.i ], [ %63, %cond_171_case_1.5.i ], !dbg !10 + %69 = and i64 %68, 64, !dbg !10 + %.not349.i = icmp eq i64 %69, 0, !dbg !10 + br i1 %.not349.i, label %__barray_mask_borrow.exit.6.i, label %cond_171_case_1.7.i + +__barray_mask_borrow.exit.6.i: ; preds = %cond_171_case_1.6.i + %70 = or disjoint i64 %68, 64, !dbg !21 + store i64 %70, ptr %1, align 4, !dbg !21 + %71 = getelementptr inbounds nuw i8, ptr %0, i64 48, !dbg !23 + %72 = load i64, ptr %71, align 4, !dbg !23 + tail call void @___qfree(i64 %72), !dbg !24 + %.pre342.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.7.i + +cond_171_case_1.7.i: ; preds = %__barray_mask_borrow.exit.6.i, %cond_171_case_1.6.i + %73 = phi i64 [ %.pre342.i, %__barray_mask_borrow.exit.6.i ], [ %68, %cond_171_case_1.6.i ], !dbg !10 + %74 = and i64 %73, 128, !dbg !10 + %.not350.i = icmp eq i64 %74, 0, !dbg !10 + br i1 %.not350.i, label %__barray_mask_borrow.exit.7.i, label %cond_171_case_1.8.i + +__barray_mask_borrow.exit.7.i: ; preds = %cond_171_case_1.7.i + %75 = or disjoint i64 %73, 128, !dbg !21 + store i64 %75, ptr %1, align 4, !dbg !21 + %76 = getelementptr inbounds nuw i8, ptr %0, i64 56, !dbg !23 + %77 = load i64, ptr %76, align 4, !dbg !23 + tail call void @___qfree(i64 %77), !dbg !24 + %.pre343.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.8.i + +cond_171_case_1.8.i: ; preds = %__barray_mask_borrow.exit.7.i, %cond_171_case_1.7.i + %78 = phi i64 [ %.pre343.i, %__barray_mask_borrow.exit.7.i ], [ %73, %cond_171_case_1.7.i ], !dbg !10 + %79 = and i64 %78, 256, !dbg !10 + %.not351.i = icmp eq i64 %79, 0, !dbg !10 + br i1 %.not351.i, label %__barray_mask_borrow.exit.8.i, label %__barray_check_bounds.exit.9.i + +__barray_mask_borrow.exit.8.i: ; preds = %cond_171_case_1.8.i + %80 = or disjoint i64 %78, 256, !dbg !21 + store i64 %80, ptr %1, align 4, !dbg !21 + %81 = getelementptr inbounds nuw i8, ptr %0, i64 64, !dbg !23 + %82 = load i64, ptr %81, align 4, !dbg !23 + tail call void @___qfree(i64 %82), !dbg !24 + %.pre = load i64, ptr %1, align 4, !dbg !10 + br label %__barray_check_bounds.exit.9.i + +__barray_check_bounds.exit.9.i: ; preds = %__barray_mask_borrow.exit.8.i, %cond_171_case_1.8.i + %83 = phi i64 [ %.pre, %__barray_mask_borrow.exit.8.i ], [ %78, %cond_171_case_1.8.i ], !dbg !10 + %84 = and i64 %83, 512, !dbg !10 + %.not352.i = icmp eq i64 %84, 0, !dbg !10 + br i1 %.not352.i, label %__barray_mask_borrow.exit.9.i, label %cond_exit_156.i + +__barray_mask_borrow.exit.9.i: ; preds = %__barray_check_bounds.exit.9.i + %85 = or disjoint i64 %83, 512, !dbg !21 + store i64 %85, ptr %1, align 4, !dbg !21 + %86 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !23 + %87 = load i64, ptr %86, align 4, !dbg !23 + tail call void @___qfree(i64 %87), !dbg !24 + %.pre344.i = load i64, ptr %1, align 4, !dbg !25 + br label %cond_exit_156.i + +cond_exit_156.i: ; preds = %__barray_mask_borrow.exit.9.i, %__barray_check_bounds.exit.9.i + %88 = phi i64 [ %.pre344.i, %__barray_mask_borrow.exit.9.i ], [ %83, %__barray_check_bounds.exit.9.i ], !dbg !25 + %89 = or i64 %88, -1024, !dbg !25 + store i64 %89, ptr %1, align 4, !dbg !25 + %90 = icmp eq i64 %89, -1, !dbg !25 + br i1 %90, label %"__hugr__.guppylang.std.quantum.discard_array$10.113.exit", label %mask_block_err.i.i, !dbg !25 + +mask_block_err.i.i: ; preds = %cond_exit_156.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !25 + unreachable, !dbg !25 + +__barray_mask_borrow.exit.i: ; preds = %cond_exit_20.9 + %91 = or disjoint i64 %41, 1, !dbg !21 + store i64 %91, ptr %1, align 4, !dbg !21 + %92 = load i64, ptr %0, align 4, !dbg !23 + tail call void @___qfree(i64 %92), !dbg !24 + %.pre.i = load i64, ptr %1, align 4, !dbg !10 + br label %cond_171_case_1.1.i + +"__hugr__.guppylang.std.quantum.discard_array$10.113.exit": ; preds = %cond_exit_156.i + tail call void @heap_free(ptr nonnull %0), !dbg !27 + tail call void @heap_free(ptr nonnull %1), !dbg !27 + ret void +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn declare void @panic(i32, ptr) local_unnamed_addr #0 -declare void @___qfree(i64) local_unnamed_addr - declare void @heap_free(ptr) local_unnamed_addr +declare void @___qfree(i64) local_unnamed_addr + declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_213_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_213_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 = %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 - %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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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_213_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert.i", i64 0, 2 - %42 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert.i", 0 - br label %__barray_check_bounds.exit.i.i.i - -43: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -__barray_check_bounds.exit.i.i.i: ; preds = %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i", %cond_exit_20.i.9 - %.fca.2.extract82.i185.i.i = phi i64 [ 0, %cond_exit_20.i.9 ], [ %.fca.1.0.0.2.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.1.extract81.i184.i.i = phi ptr [ %2, %cond_exit_20.i.9 ], [ %.fca.1.0.0.1.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.fca.0.extract80.i183.i.i = phi ptr [ %1, %cond_exit_20.i.9 ], [ %.fca.1.0.0.0.extract.i.i.i, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %"294_0.0182.i.i" = phi i64 [ 0, %cond_exit_20.i.9 ], [ %72, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %.pn181.i.i = phi { { ptr, ptr, i64 }, i64 } [ %42, %cond_exit_20.i.9 ], [ %80, %"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i" ] - %65 = add i64 %"294_0.0182.i.i", %.fca.2.extract82.i185.i.i - %66 = lshr i64 %65, 6 - %67 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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__.$ArrayIter.__next__$$t(qubit)$n(10).302.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 - -"__hugr__.$ArrayIter.__next__$$t(qubit)$n(10).302.exit.thread.i.i": ; preds = %__barray_check_bounds.exit.i.i.i - %72 = add nuw nsw i64 %"294_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.extract80.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 %"294_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 + tail call void @setup(i64 %0), !dbg !32 + tail call void @"__hugr__.__main__.discard_qb_array..main.1"(), !dbg !32 + %1 = tail call i64 @teardown(), !dbg !32 + ret i64 %1, !dbg !32 } declare void @setup(i64) local_unnamed_addr @@ -290,6 +369,40 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "discard_qb_array..main", linkageName: "__hugr__.__main__.discard_qb_array..main.1", scope: null, file: !5, line: 92, type: !6, scopeLine: 93, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 93, column: 13, scope: !4) +!9 = !DILocation(line: 93, column: 19, scope: !4) +!10 = !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !19) +!11 = distinct !DISubprogram(name: "std.quantum.discard_array$10", linkageName: "__hugr__.guppylang.std.quantum.discard_array$10.113", scope: null, file: !12, line: 387, type: !13, scopeLine: 389, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!12 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!13 = !DISubroutineType(types: !14) +!14 = !{null, !15} +!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !16) +!16 = !{!17, !17, !18} +!17 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!18 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!19 = distinct !DILocation(line: 390, column: 15, scope: !11, inlinedAt: !20) +!20 = distinct !DILocation(line: 94, column: 8, scope: !4) +!21 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !22) +!22 = distinct !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!23 = !DILocation(line: 391, column: 20, scope: !11, inlinedAt: !20) +!24 = !DILocation(line: 391, column: 12, scope: !11, inlinedAt: !20) +!25 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !26) +!26 = distinct !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!27 = !DILocation(line: 392, column: 4, scope: !11, inlinedAt: !20) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !30, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DISubroutineType(types: !31) +!31 = !{!18, !18} +!32 = !DILocation(line: 0, scope: !28) 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 9806d626b..4ff3138cb 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 @@ -9,6 +9,74 @@ target triple = "x86_64-windows-msvc" @res_c3.B223E16D.0 = private constant [13 x i8] c"\0CUSER:BOOL:c3" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.flip_some..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_40_case_0.i, label %__hugr__.__tk2_qalloc.36.exit, !dbg !8 + +cond_40_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.36.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !9 + %qalloc.i101 = tail call i64 @___qalloc(), !dbg !10 + %not_max.not.not.i102 = icmp eq i64 %qalloc.i101, -1, !dbg !10 + br i1 %not_max.not.not.i102, label %cond_54_case_0.i, label %__hugr__.__tk2_qalloc.50.exit, !dbg !10 + +cond_54_case_0.i: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !10 + unreachable, !dbg !10 + +__hugr__.__tk2_qalloc.50.exit: ; preds = %__hugr__.__tk2_qalloc.36.exit + tail call void @___reset(i64 %qalloc.i101), !dbg !10 + %qalloc.i103 = tail call i64 @___qalloc(), !dbg !11 + %not_max.not.not.i104 = icmp eq i64 %qalloc.i103, -1, !dbg !11 + br i1 %not_max.not.not.i104, label %cond_68_case_0.i, label %__hugr__.__tk2_qalloc.64.exit, !dbg !11 + +cond_68_case_0.i: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !11 + unreachable, !dbg !11 + +__hugr__.__tk2_qalloc.64.exit: ; preds = %__hugr__.__tk2_qalloc.50.exit + tail call void @___reset(i64 %qalloc.i103), !dbg !11 + tail call void @___rxy(i64 %qalloc.i103, double 0x400921FB54442D18, double 0.000000e+00), !dbg !12 + %qalloc.i105 = tail call i64 @___qalloc(), !dbg !13 + %not_max.not.not.i106 = icmp eq i64 %qalloc.i105, -1, !dbg !13 + br i1 %not_max.not.not.i106, label %cond_82_case_0.i, label %__hugr__.__tk2_qalloc.78.exit, !dbg !13 + +cond_82_case_0.i: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !13 + unreachable, !dbg !13 + +__hugr__.__tk2_qalloc.78.exit: ; preds = %__hugr__.__tk2_qalloc.64.exit + tail call void @___reset(i64 %qalloc.i105), !dbg !13 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c0.7C14CD6E.0, i64 12, i1 %read_bool), !dbg !14 + %lazy_measure22 = tail call i64 @___lazy_measure(i64 %qalloc.i101) + tail call void @___qfree(i64 %qalloc.i101) + %read_bool35 = tail call i1 @___read_future_bool(i64 %lazy_measure22) + tail call void @___dec_future_refcount(i64 %lazy_measure22) + tail call void @print_bool(ptr nonnull @res_c1.1F7A6571.0, i64 12, i1 %read_bool35), !dbg !15 + %lazy_measure44 = tail call i64 @___lazy_measure(i64 %qalloc.i103) + tail call void @___qfree(i64 %qalloc.i103) + %read_bool57 = tail call i1 @___read_future_bool(i64 %lazy_measure44) + tail call void @___dec_future_refcount(i64 %lazy_measure44) + tail call void @print_bool(ptr nonnull @res_c2.60825383.0, i64 12, i1 %read_bool57), !dbg !16 + tail call void @___rxy(i64 %qalloc.i105, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %lazy_measure67 = tail call i64 @___lazy_measure(i64 %qalloc.i105) + tail call void @___qfree(i64 %qalloc.i105) + %read_bool80 = tail call i1 @___read_future_bool(i64 %lazy_measure67) + tail call void @___dec_future_refcount(i64 %lazy_measure67) + tail call void @print_bool(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80), !dbg !18 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -28,74 +96,12 @@ declare void @panic(i32, ptr) local_unnamed_addr #0 declare void @___rxy(i64, double, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !19 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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.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 - -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 = %__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 = %__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 = %__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 = %__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(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(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(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(ptr nonnull @res_c3.B223E16D.0, i64 12, i1 %read_bool80.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !24 + tail call void @"__hugr__.__main__.flip_some..main.1"(), !dbg !24 + %1 = tail call i64 @teardown(), !dbg !24 + ret i64 %1, !dbg !24 } declare void @setup(i64) local_unnamed_addr @@ -104,6 +110,32 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "flip_some..main", linkageName: "__hugr__.__main__.flip_some..main.1", scope: null, file: !5, line: 74, type: !6, scopeLine: 75, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 75, column: 20, scope: !4) +!9 = !DILocation(line: 79, column: 8, scope: !4) +!10 = !DILocation(line: 76, column: 20, scope: !4) +!11 = !DILocation(line: 77, column: 20, scope: !4) +!12 = !DILocation(line: 80, column: 8, scope: !4) +!13 = !DILocation(line: 78, column: 20, scope: !4) +!14 = !DILocation(line: 82, column: 8, scope: !4) +!15 = !DILocation(line: 83, column: 8, scope: !4) +!16 = !DILocation(line: 84, column: 8, scope: !4) +!17 = !DILocation(line: 81, column: 8, scope: !4) +!18 = !DILocation(line: 85, column: 8, scope: !4) +!19 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !20, type: !21, spFlags: DISPFlagDefinition, unit: !1) +!20 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!21 = !DISubroutineType(types: !22) +!22 = !{!23, !23} +!23 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!24 = !DILocation(line: 0, scope: !19) 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 3e3e75456..419d2b9a8 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 @@ -8,6 +8,606 @@ 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." +define void @"__hugr__.__main__.measure_qb_array..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %0 = tail call ptr @heap_alloc(i64 80), !dbg !8 + %1 = tail call ptr @heap_alloc(i64 8), !dbg !8 + store i64 -1, ptr %1, align 1, !dbg !8 + %qalloc.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !9 + br i1 %not_max.not.not.i, label %cond_299_case_0.i, label %__barray_check_bounds.exit, !dbg !9 + +cond_299_case_0.i: ; preds = %cond_exit_20.8, %cond_exit_20.7, %cond_exit_20.6, %cond_exit_20.5, %cond_exit_20.4, %cond_exit_20.3, %cond_exit_20.2, %cond_exit_20.1, %cond_exit_20, %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__barray_check_bounds.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !9 + %2 = load i64, ptr %1, align 4 + %3 = trunc i64 %2 to i1 + br i1 %3, label %cond_exit_20, label %panic.i + +panic.i: ; preds = %__barray_check_bounds.exit.9, %__barray_check_bounds.exit.8, %__barray_check_bounds.exit.7, %__barray_check_bounds.exit.6, %__barray_check_bounds.exit.5, %__barray_check_bounds.exit.4, %__barray_check_bounds.exit.3, %__barray_check_bounds.exit.2, %__barray_check_bounds.exit.1, %__barray_check_bounds.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +cond_exit_20: ; preds = %__barray_check_bounds.exit + %4 = and i64 %2, -2 + store i64 %4, ptr %1, align 4 + store i64 %qalloc.i, ptr %0, align 4 + %qalloc.i.1 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.1 = icmp eq i64 %qalloc.i.1, -1, !dbg !9 + br i1 %not_max.not.not.i.1, label %cond_299_case_0.i, label %__barray_check_bounds.exit.1, !dbg !9 + +__barray_check_bounds.exit.1: ; preds = %cond_exit_20 + tail call void @___reset(i64 %qalloc.i.1), !dbg !9 + %5 = load i64, ptr %1, align 4 + %6 = and i64 %5, 2 + %.not299 = icmp eq i64 %6, 0 + br i1 %.not299, label %panic.i, label %cond_exit_20.1 + +cond_exit_20.1: ; preds = %__barray_check_bounds.exit.1 + %7 = and i64 %5, -3 + store i64 %7, ptr %1, align 4 + %8 = getelementptr inbounds nuw i8, ptr %0, i64 8 + store i64 %qalloc.i.1, ptr %8, align 4 + %qalloc.i.2 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.2 = icmp eq i64 %qalloc.i.2, -1, !dbg !9 + br i1 %not_max.not.not.i.2, label %cond_299_case_0.i, label %__barray_check_bounds.exit.2, !dbg !9 + +__barray_check_bounds.exit.2: ; preds = %cond_exit_20.1 + tail call void @___reset(i64 %qalloc.i.2), !dbg !9 + %9 = load i64, ptr %1, align 4 + %10 = and i64 %9, 4 + %.not300 = icmp eq i64 %10, 0 + br i1 %.not300, label %panic.i, label %cond_exit_20.2 + +cond_exit_20.2: ; preds = %__barray_check_bounds.exit.2 + %11 = and i64 %9, -5 + store i64 %11, ptr %1, align 4 + %12 = getelementptr inbounds nuw i8, ptr %0, i64 16 + store i64 %qalloc.i.2, ptr %12, align 4 + %qalloc.i.3 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.3 = icmp eq i64 %qalloc.i.3, -1, !dbg !9 + br i1 %not_max.not.not.i.3, label %cond_299_case_0.i, label %__barray_check_bounds.exit.3, !dbg !9 + +__barray_check_bounds.exit.3: ; preds = %cond_exit_20.2 + tail call void @___reset(i64 %qalloc.i.3), !dbg !9 + %13 = load i64, ptr %1, align 4 + %14 = and i64 %13, 8 + %.not301 = icmp eq i64 %14, 0 + br i1 %.not301, label %panic.i, label %cond_exit_20.3 + +cond_exit_20.3: ; preds = %__barray_check_bounds.exit.3 + %15 = and i64 %13, -9 + store i64 %15, ptr %1, align 4 + %16 = getelementptr inbounds nuw i8, ptr %0, i64 24 + store i64 %qalloc.i.3, ptr %16, align 4 + %qalloc.i.4 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.4 = icmp eq i64 %qalloc.i.4, -1, !dbg !9 + br i1 %not_max.not.not.i.4, label %cond_299_case_0.i, label %__barray_check_bounds.exit.4, !dbg !9 + +__barray_check_bounds.exit.4: ; preds = %cond_exit_20.3 + tail call void @___reset(i64 %qalloc.i.4), !dbg !9 + %17 = load i64, ptr %1, align 4 + %18 = and i64 %17, 16 + %.not302 = icmp eq i64 %18, 0 + br i1 %.not302, label %panic.i, label %cond_exit_20.4 + +cond_exit_20.4: ; preds = %__barray_check_bounds.exit.4 + %19 = and i64 %17, -17 + store i64 %19, ptr %1, align 4 + %20 = getelementptr inbounds nuw i8, ptr %0, i64 32 + store i64 %qalloc.i.4, ptr %20, align 4 + %qalloc.i.5 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.5 = icmp eq i64 %qalloc.i.5, -1, !dbg !9 + br i1 %not_max.not.not.i.5, label %cond_299_case_0.i, label %__barray_check_bounds.exit.5, !dbg !9 + +__barray_check_bounds.exit.5: ; preds = %cond_exit_20.4 + tail call void @___reset(i64 %qalloc.i.5), !dbg !9 + %21 = load i64, ptr %1, align 4 + %22 = and i64 %21, 32 + %.not303 = icmp eq i64 %22, 0 + br i1 %.not303, label %panic.i, label %cond_exit_20.5 + +cond_exit_20.5: ; preds = %__barray_check_bounds.exit.5 + %23 = and i64 %21, -33 + store i64 %23, ptr %1, align 4 + %24 = getelementptr inbounds nuw i8, ptr %0, i64 40 + store i64 %qalloc.i.5, ptr %24, align 4 + %qalloc.i.6 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.6 = icmp eq i64 %qalloc.i.6, -1, !dbg !9 + br i1 %not_max.not.not.i.6, label %cond_299_case_0.i, label %__barray_check_bounds.exit.6, !dbg !9 + +__barray_check_bounds.exit.6: ; preds = %cond_exit_20.5 + tail call void @___reset(i64 %qalloc.i.6), !dbg !9 + %25 = load i64, ptr %1, align 4 + %26 = and i64 %25, 64 + %.not304 = icmp eq i64 %26, 0 + br i1 %.not304, label %panic.i, label %cond_exit_20.6 + +cond_exit_20.6: ; preds = %__barray_check_bounds.exit.6 + %27 = and i64 %25, -65 + store i64 %27, ptr %1, align 4 + %28 = getelementptr inbounds nuw i8, ptr %0, i64 48 + store i64 %qalloc.i.6, ptr %28, align 4 + %qalloc.i.7 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.7 = icmp eq i64 %qalloc.i.7, -1, !dbg !9 + br i1 %not_max.not.not.i.7, label %cond_299_case_0.i, label %__barray_check_bounds.exit.7, !dbg !9 + +__barray_check_bounds.exit.7: ; preds = %cond_exit_20.6 + tail call void @___reset(i64 %qalloc.i.7), !dbg !9 + %29 = load i64, ptr %1, align 4 + %30 = and i64 %29, 128 + %.not305 = icmp eq i64 %30, 0 + br i1 %.not305, label %panic.i, label %cond_exit_20.7 + +cond_exit_20.7: ; preds = %__barray_check_bounds.exit.7 + %31 = and i64 %29, -129 + store i64 %31, ptr %1, align 4 + %32 = getelementptr inbounds nuw i8, ptr %0, i64 56 + store i64 %qalloc.i.7, ptr %32, align 4 + %qalloc.i.8 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.8 = icmp eq i64 %qalloc.i.8, -1, !dbg !9 + br i1 %not_max.not.not.i.8, label %cond_299_case_0.i, label %__barray_check_bounds.exit.8, !dbg !9 + +__barray_check_bounds.exit.8: ; preds = %cond_exit_20.7 + tail call void @___reset(i64 %qalloc.i.8), !dbg !9 + %33 = load i64, ptr %1, align 4 + %34 = and i64 %33, 256 + %.not306 = icmp eq i64 %34, 0 + br i1 %.not306, label %panic.i, label %cond_exit_20.8 + +cond_exit_20.8: ; preds = %__barray_check_bounds.exit.8 + %35 = and i64 %33, -257 + store i64 %35, ptr %1, align 4 + %36 = getelementptr inbounds nuw i8, ptr %0, i64 64 + store i64 %qalloc.i.8, ptr %36, align 4 + %qalloc.i.9 = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.9 = icmp eq i64 %qalloc.i.9, -1, !dbg !9 + br i1 %not_max.not.not.i.9, label %cond_299_case_0.i, label %__barray_check_bounds.exit.9, !dbg !9 + +__barray_check_bounds.exit.9: ; preds = %cond_exit_20.8 + tail call void @___reset(i64 %qalloc.i.9), !dbg !9 + %37 = load i64, ptr %1, align 4 + %38 = and i64 %37, 512 + %.not307 = icmp eq i64 %38, 0 + br i1 %.not307, label %panic.i, label %cond_exit_20.9 + +cond_exit_20.9: ; preds = %__barray_check_bounds.exit.9 + %39 = and i64 %37, -513 + store i64 %39, ptr %1, align 4 + %40 = getelementptr inbounds nuw i8, ptr %0, i64 72 + store i64 %qalloc.i.9, ptr %40, align 4 + %"116.fca.0.insert" = insertvalue { ptr, ptr, i64 } poison, ptr %0, 0 + %"116.fca.1.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert", ptr %1, 1 + %"116.fca.2.insert" = insertvalue { ptr, ptr, i64 } %"116.fca.1.insert", i64 0, 2 + %41 = load i64, ptr %1, align 4, !dbg !10 + %42 = trunc i64 %41 to i1, !dbg !10 + br i1 %42, label %panic.i238, label %__barray_mask_borrow.exit, !dbg !10 + +panic.i238: ; preds = %cond_exit_20.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !10 + unreachable, !dbg !10 + +__barray_mask_borrow.exit: ; preds = %cond_exit_20.9 + %43 = or disjoint i64 %41, 1, !dbg !10 + store i64 %43, ptr %1, align 4, !dbg !10 + %44 = load i64, ptr %0, align 4, !dbg !12 + tail call void @___rxy(i64 %44, double 0x400921FB54442D18, double 0.000000e+00), !dbg !13 + %45 = load i64, ptr %1, align 4, !dbg !12 + %46 = trunc i64 %45 to i1, !dbg !12 + br i1 %46, label %__barray_mask_return.exit240, label %panic.i239, !dbg !12 + +panic.i239: ; preds = %__barray_mask_borrow.exit + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !12 + unreachable, !dbg !12 + +__barray_mask_return.exit240: ; preds = %__barray_mask_borrow.exit + %47 = and i64 %45, -2, !dbg !12 + store i64 %47, ptr %1, align 4, !dbg !12 + store i64 %44, ptr %0, align 4, !dbg !12 + %48 = load i64, ptr %1, align 4, !dbg !14 + %49 = and i64 %48, 4, !dbg !14 + %.not = icmp eq i64 %49, 0, !dbg !14 + br i1 %.not, label %__barray_mask_borrow.exit242, label %panic.i241, !dbg !14 + +panic.i241: ; preds = %__barray_mask_return.exit240 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !14 + unreachable, !dbg !14 + +__barray_mask_borrow.exit242: ; preds = %__barray_mask_return.exit240 + %50 = or disjoint i64 %48, 4, !dbg !14 + store i64 %50, ptr %1, align 4, !dbg !14 + %51 = getelementptr inbounds nuw i8, ptr %0, i64 16, !dbg !16 + %52 = load i64, ptr %51, align 4, !dbg !16 + tail call void @___rxy(i64 %52, double 0x400921FB54442D18, double 0.000000e+00), !dbg !17 + %53 = load i64, ptr %1, align 4, !dbg !16 + %54 = and i64 %53, 4, !dbg !16 + %.not268 = icmp eq i64 %54, 0, !dbg !16 + br i1 %.not268, label %panic.i243, label %__barray_mask_return.exit244, !dbg !16 + +panic.i243: ; preds = %__barray_mask_borrow.exit242 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !16 + unreachable, !dbg !16 + +__barray_mask_return.exit244: ; preds = %__barray_mask_borrow.exit242 + %55 = and i64 %53, -5, !dbg !16 + store i64 %55, ptr %1, align 4, !dbg !16 + store i64 %52, ptr %51, align 4, !dbg !16 + %56 = load i64, ptr %1, align 4, !dbg !18 + %57 = and i64 %56, 8, !dbg !18 + %.not269 = icmp eq i64 %57, 0, !dbg !18 + br i1 %.not269, label %__barray_mask_borrow.exit246, label %panic.i245, !dbg !18 + +panic.i245: ; preds = %__barray_mask_return.exit244 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !18 + unreachable, !dbg !18 + +__barray_mask_borrow.exit246: ; preds = %__barray_mask_return.exit244 + %58 = or disjoint i64 %56, 8, !dbg !18 + store i64 %58, ptr %1, align 4, !dbg !18 + %59 = getelementptr inbounds nuw i8, ptr %0, i64 24, !dbg !20 + %60 = load i64, ptr %59, align 4, !dbg !20 + tail call void @___rxy(i64 %60, double 0x400921FB54442D18, double 0.000000e+00), !dbg !21 + %61 = load i64, ptr %1, align 4, !dbg !20 + %62 = and i64 %61, 8, !dbg !20 + %.not270 = icmp eq i64 %62, 0, !dbg !20 + br i1 %.not270, label %panic.i247, label %__barray_mask_return.exit248, !dbg !20 + +panic.i247: ; preds = %__barray_mask_borrow.exit246 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !20 + unreachable, !dbg !20 + +__barray_mask_return.exit248: ; preds = %__barray_mask_borrow.exit246 + %63 = and i64 %61, -9, !dbg !20 + store i64 %63, ptr %1, align 4, !dbg !20 + store i64 %60, ptr %59, align 4, !dbg !20 + %64 = load i64, ptr %1, align 4, !dbg !22 + %65 = and i64 %64, 512, !dbg !22 + %.not271 = icmp eq i64 %65, 0, !dbg !22 + br i1 %.not271, label %__barray_mask_borrow.exit250, label %panic.i249, !dbg !22 + +panic.i249: ; preds = %__barray_mask_return.exit248 + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !22 + unreachable, !dbg !22 + +__barray_mask_borrow.exit250: ; preds = %__barray_mask_return.exit248 + %66 = or disjoint i64 %64, 512, !dbg !22 + store i64 %66, ptr %1, align 4, !dbg !22 + %67 = getelementptr inbounds nuw i8, ptr %0, i64 72, !dbg !24 + %68 = load i64, ptr %67, align 4, !dbg !24 + tail call void @___rxy(i64 %68, double 0x400921FB54442D18, double 0.000000e+00), !dbg !25 + %69 = load i64, ptr %1, align 4, !dbg !24 + %70 = and i64 %69, 512, !dbg !24 + %.not272 = icmp eq i64 %70, 0, !dbg !24 + br i1 %.not272, label %panic.i251, label %__barray_mask_return.exit252, !dbg !24 + +panic.i251: ; preds = %__barray_mask_borrow.exit250 + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0"), !dbg !24 + unreachable, !dbg !24 + +__barray_mask_return.exit252: ; preds = %__barray_mask_borrow.exit250 + %71 = and i64 %69, -513, !dbg !24 + store i64 %71, ptr %1, align 4, !dbg !24 + store i64 %68, ptr %67, align 4, !dbg !24 + %72 = insertvalue { { ptr, ptr, i64 }, i64 } poison, { ptr, ptr, i64 } %"116.fca.2.insert", 0, !dbg !26 + %73 = tail call ptr @heap_alloc(i64 240), !dbg !43 + %74 = tail call ptr @heap_alloc(i64 8), !dbg !43 + store i64 -1, ptr %74, align 1, !dbg !43 + br label %__barray_check_bounds.exit.i.i + +75: ; preds = %loop_body.i + %76 = lshr i64 %.fca.2.extract82.i.i, 6, !dbg !44 + %77 = getelementptr i64, ptr %.fca.1.extract81.i.i, i64 %76, !dbg !44 + %78 = load i64, ptr %77, align 4, !dbg !44 + %79 = and i64 %.fca.2.extract82.i.i, 63, !dbg !44 + %80 = sub nuw nsw i64 64, %79, !dbg !44 + %81 = lshr i64 -1, %80, !dbg !44 + %82 = icmp eq i64 %79, 0, !dbg !44 + %83 = select i1 %82, i64 0, i64 %81, !dbg !44 + %84 = or i64 %78, %83, !dbg !44 + store i64 %84, ptr %77, align 4, !dbg !44 + %last_valid.i.i.i = add i64 %.fca.2.extract82.i.i, 9, !dbg !44 + %85 = lshr i64 %last_valid.i.i.i, 6, !dbg !44 + %86 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i.i, i64 %85, !dbg !44 + %87 = load i64, ptr %86, align 4, !dbg !44 + %88 = and i64 %last_valid.i.i.i, 63, !dbg !44 + %89 = shl nsw i64 -2, %88, !dbg !44 + %90 = icmp eq i64 %88, 63, !dbg !44 + %91 = select i1 %90, i64 0, i64 %89, !dbg !44 + %92 = or i64 %87, %91, !dbg !44 + store i64 %92, ptr %86, align 4, !dbg !44 + %reass.sub.i.i.i = sub nsw i64 %85, %76, !dbg !44 + %.not.i.i.i = icmp eq i64 %reass.sub.i.i.i, -1, !dbg !44 + br i1 %.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +93: ; preds = %mask_block_ok.i.i.i + %94 = add nuw i64 %.02.i.i.i, 1, !dbg !44 + %exitcond.not.i.i.i = icmp eq i64 %.02.i.i.i, %reass.sub.i.i.i, !dbg !44 + br i1 %exitcond.not.i.i.i, label %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit", label %mask_block_ok.i.i.i, !dbg !44 + +mask_block_ok.i.i.i: ; preds = %75, %93 + %.02.i.i.i = phi i64 [ %94, %93 ], [ 0, %75 ], !dbg !44 + %gep.i.i.i = getelementptr i64, ptr %77, i64 %.02.i.i.i, !dbg !44 + %95 = load i64, ptr %gep.i.i.i, align 4, !dbg !44 + %96 = icmp eq i64 %95, -1, !dbg !44 + br i1 %96, label %93, label %mask_block_err.i.i.i, !dbg !44 + +mask_block_err.i.i.i: ; preds = %mask_block_ok.i.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0"), !dbg !44 + unreachable, !dbg !44 + +__barray_check_bounds.exit.i.i: ; preds = %loop_body.i, %__barray_mask_return.exit252 + %.fca.2.extract82.i187.i = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %.fca.2.extract82.i.i, %loop_body.i ] + %.fca.1.extract81.i186.i = phi ptr [ %1, %__barray_mask_return.exit252 ], [ %.fca.1.extract81.i.i, %loop_body.i ] + %.fca.0.extract80.i185.i = phi ptr [ %0, %__barray_mask_return.exit252 ], [ %.fca.0.extract80.i.i, %loop_body.i ] + %"163_0.sroa.15.0184.i" = phi i64 [ 0, %__barray_mask_return.exit252 ], [ %97, %loop_body.i ] + %.pn165183.i = phi { { ptr, ptr, i64 }, i64 } [ %72, %__barray_mask_return.exit252 ], [ %112, %loop_body.i ] + %97 = add nuw nsw i64 %"163_0.sroa.15.0184.i", 1, !dbg !54 + %98 = add i64 %"163_0.sroa.15.0184.i", %.fca.2.extract82.i187.i, !dbg !55 + %99 = lshr i64 %98, 6, !dbg !56 + %100 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.i186.i, i64 %99, !dbg !56 + %101 = load i64, ptr %100, align 4, !dbg !56 + %102 = and i64 %98, 63, !dbg !56 + %103 = lshr i64 %101, %102, !dbg !56 + %104 = trunc i64 %103 to i1, !dbg !56 + br i1 %104, label %panic.i.i.i, label %__barray_check_bounds.exit.i, !dbg !56 + +panic.i.i.i: ; preds = %__barray_check_bounds.exit.i.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0"), !dbg !56 + unreachable, !dbg !56 + +__barray_check_bounds.exit.i: ; preds = %__barray_check_bounds.exit.i.i + %105 = shl nuw i64 1, %102, !dbg !56 + %106 = xor i64 %105, %101, !dbg !56 + store i64 %106, ptr %100, align 4, !dbg !56 + %107 = getelementptr inbounds i64, ptr %.fca.0.extract80.i185.i, i64 %98, !dbg !55 + %108 = load i64, ptr %107, align 4, !dbg !55 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %108) + tail call void @___qfree(i64 %108) + %109 = load i64, ptr %74, align 4 + %110 = lshr i64 %109, %"163_0.sroa.15.0184.i" + %111 = trunc i64 %110 to i1 + br i1 %111, label %loop_body.i, label %panic.i.i + +panic.i.i: ; preds = %__barray_check_bounds.exit.i + tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") + unreachable + +loop_body.i: ; preds = %__barray_check_bounds.exit.i + %"182_054.fca.1.insert.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i, 1 + %"182_054.fca.2.insert.i" = insertvalue { i1, i64, i1 } %"182_054.fca.1.insert.i", i1 undef, 2 + %112 = insertvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, i64 %97, 1 + %113 = shl nuw nsw i64 1, %"163_0.sroa.15.0184.i" + %114 = xor i64 %109, %113 + store i64 %114, ptr %74, align 4 + %115 = getelementptr inbounds nuw { i1, i64, i1 }, ptr %73, i64 %"163_0.sroa.15.0184.i" + store { i1, i64, i1 } %"182_054.fca.2.insert.i", ptr %115, align 4 + %116 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i, 0 + %.fca.0.extract80.i.i = extractvalue { ptr, ptr, i64 } %116, 0 + %.fca.1.extract81.i.i = extractvalue { ptr, ptr, i64 } %116, 1 + %.fca.2.extract82.i.i = extractvalue { ptr, ptr, i64 } %116, 2 + %exitcond.not.i = icmp eq i64 %97, 10, !dbg !58 + br i1 %exitcond.not.i, label %75, label %__barray_check_bounds.exit.i.i + +"__hugr__.guppylang.std.quantum.measure_array$10.149.exit": ; preds = %93, %75 + tail call void @heap_free(ptr %.fca.0.extract80.i.i), !dbg !44 + tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i), !dbg !44 + %117 = load i64, ptr %74, align 4 + %118 = trunc i64 %117 to i1 + br i1 %118, label %cond_exit_369.thread, label %__barray_mask_borrow.exit259 + +cond_exit_369: ; preds = %cond_exit_369.thread.9 + tail call void @heap_free(ptr %73) + tail call void @heap_free(ptr nonnull %74) + ret void + +mask_block_err.i: ; preds = %cond_exit_369.thread.9 + tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") + unreachable + +__barray_mask_borrow.exit259: ; preds = %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %119 = or disjoint i64 %117, 1, !dbg !12 + store i64 %119, ptr %74, align 4, !dbg !12 + %120 = load { i1, i64, i1 }, ptr %73, align 4 + %.fca.0.extract167 = extractvalue { i1, i64, i1 } %120, 0 + br i1 %.fca.0.extract167, label %cond_392_case_1, label %cond_exit_369.thread + +cond_exit_369.thread: ; preds = %cond_392_case_1, %__barray_mask_borrow.exit259, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" + %121 = phi i64 [ %.pre, %cond_392_case_1 ], [ %119, %__barray_mask_borrow.exit259 ], [ %117, %"__hugr__.guppylang.std.quantum.measure_array$10.149.exit" ] + %122 = and i64 %121, 2 + %.not290 = icmp eq i64 %122, 0 + br i1 %.not290, label %__barray_mask_borrow.exit259.1, label %cond_exit_369.thread.1 + +__barray_mask_borrow.exit259.1: ; preds = %cond_exit_369.thread + %123 = or disjoint i64 %121, 2, !dbg !12 + store i64 %123, ptr %74, align 4, !dbg !12 + %124 = getelementptr inbounds nuw i8, ptr %73, i64 24 + %125 = load { i1, i64, i1 }, ptr %124, align 4 + %.fca.0.extract167.1 = extractvalue { i1, i64, i1 } %125, 0 + br i1 %.fca.0.extract167.1, label %cond_392_case_1.1, label %cond_exit_369.thread.1 + +cond_392_case_1.1: ; preds = %__barray_mask_borrow.exit259.1 + %.fca.1.extract.1 = extractvalue { i1, i64, i1 } %125, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.1) + %.pre281 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.1 + +cond_exit_369.thread.1: ; preds = %cond_392_case_1.1, %__barray_mask_borrow.exit259.1, %cond_exit_369.thread + %126 = phi i64 [ %.pre281, %cond_392_case_1.1 ], [ %123, %__barray_mask_borrow.exit259.1 ], [ %121, %cond_exit_369.thread ] + %127 = and i64 %126, 4 + %.not291 = icmp eq i64 %127, 0 + br i1 %.not291, label %__barray_mask_borrow.exit259.2, label %cond_exit_369.thread.2 + +__barray_mask_borrow.exit259.2: ; preds = %cond_exit_369.thread.1 + %128 = or disjoint i64 %126, 4, !dbg !12 + store i64 %128, ptr %74, align 4, !dbg !12 + %129 = getelementptr inbounds nuw i8, ptr %73, i64 48 + %130 = load { i1, i64, i1 }, ptr %129, align 4 + %.fca.0.extract167.2 = extractvalue { i1, i64, i1 } %130, 0 + br i1 %.fca.0.extract167.2, label %cond_392_case_1.2, label %cond_exit_369.thread.2 + +cond_392_case_1.2: ; preds = %__barray_mask_borrow.exit259.2 + %.fca.1.extract.2 = extractvalue { i1, i64, i1 } %130, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.2) + %.pre282 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.2 + +cond_exit_369.thread.2: ; preds = %cond_392_case_1.2, %__barray_mask_borrow.exit259.2, %cond_exit_369.thread.1 + %131 = phi i64 [ %.pre282, %cond_392_case_1.2 ], [ %128, %__barray_mask_borrow.exit259.2 ], [ %126, %cond_exit_369.thread.1 ] + %132 = and i64 %131, 8 + %.not292 = icmp eq i64 %132, 0 + br i1 %.not292, label %__barray_mask_borrow.exit259.3, label %cond_exit_369.thread.3 + +__barray_mask_borrow.exit259.3: ; preds = %cond_exit_369.thread.2 + %133 = or disjoint i64 %131, 8, !dbg !12 + store i64 %133, ptr %74, align 4, !dbg !12 + %134 = getelementptr inbounds nuw i8, ptr %73, i64 72 + %135 = load { i1, i64, i1 }, ptr %134, align 4 + %.fca.0.extract167.3 = extractvalue { i1, i64, i1 } %135, 0 + br i1 %.fca.0.extract167.3, label %cond_392_case_1.3, label %cond_exit_369.thread.3 + +cond_392_case_1.3: ; preds = %__barray_mask_borrow.exit259.3 + %.fca.1.extract.3 = extractvalue { i1, i64, i1 } %135, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.3) + %.pre283 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.3 + +cond_exit_369.thread.3: ; preds = %cond_392_case_1.3, %__barray_mask_borrow.exit259.3, %cond_exit_369.thread.2 + %136 = phi i64 [ %.pre283, %cond_392_case_1.3 ], [ %133, %__barray_mask_borrow.exit259.3 ], [ %131, %cond_exit_369.thread.2 ] + %137 = and i64 %136, 16 + %.not293 = icmp eq i64 %137, 0 + br i1 %.not293, label %__barray_mask_borrow.exit259.4, label %cond_exit_369.thread.4 + +__barray_mask_borrow.exit259.4: ; preds = %cond_exit_369.thread.3 + %138 = or disjoint i64 %136, 16, !dbg !12 + store i64 %138, ptr %74, align 4, !dbg !12 + %139 = getelementptr inbounds nuw i8, ptr %73, i64 96 + %140 = load { i1, i64, i1 }, ptr %139, align 4 + %.fca.0.extract167.4 = extractvalue { i1, i64, i1 } %140, 0 + br i1 %.fca.0.extract167.4, label %cond_392_case_1.4, label %cond_exit_369.thread.4 + +cond_392_case_1.4: ; preds = %__barray_mask_borrow.exit259.4 + %.fca.1.extract.4 = extractvalue { i1, i64, i1 } %140, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.4) + %.pre284 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.4 + +cond_exit_369.thread.4: ; preds = %cond_392_case_1.4, %__barray_mask_borrow.exit259.4, %cond_exit_369.thread.3 + %141 = phi i64 [ %.pre284, %cond_392_case_1.4 ], [ %138, %__barray_mask_borrow.exit259.4 ], [ %136, %cond_exit_369.thread.3 ] + %142 = and i64 %141, 32 + %.not294 = icmp eq i64 %142, 0 + br i1 %.not294, label %__barray_mask_borrow.exit259.5, label %cond_exit_369.thread.5 + +__barray_mask_borrow.exit259.5: ; preds = %cond_exit_369.thread.4 + %143 = or disjoint i64 %141, 32, !dbg !12 + store i64 %143, ptr %74, align 4, !dbg !12 + %144 = getelementptr inbounds nuw i8, ptr %73, i64 120 + %145 = load { i1, i64, i1 }, ptr %144, align 4 + %.fca.0.extract167.5 = extractvalue { i1, i64, i1 } %145, 0 + br i1 %.fca.0.extract167.5, label %cond_392_case_1.5, label %cond_exit_369.thread.5 + +cond_392_case_1.5: ; preds = %__barray_mask_borrow.exit259.5 + %.fca.1.extract.5 = extractvalue { i1, i64, i1 } %145, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.5) + %.pre285 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.5 + +cond_exit_369.thread.5: ; preds = %cond_392_case_1.5, %__barray_mask_borrow.exit259.5, %cond_exit_369.thread.4 + %146 = phi i64 [ %.pre285, %cond_392_case_1.5 ], [ %143, %__barray_mask_borrow.exit259.5 ], [ %141, %cond_exit_369.thread.4 ] + %147 = and i64 %146, 64 + %.not295 = icmp eq i64 %147, 0 + br i1 %.not295, label %__barray_mask_borrow.exit259.6, label %cond_exit_369.thread.6 + +__barray_mask_borrow.exit259.6: ; preds = %cond_exit_369.thread.5 + %148 = or disjoint i64 %146, 64, !dbg !12 + store i64 %148, ptr %74, align 4, !dbg !12 + %149 = getelementptr inbounds nuw i8, ptr %73, i64 144 + %150 = load { i1, i64, i1 }, ptr %149, align 4 + %.fca.0.extract167.6 = extractvalue { i1, i64, i1 } %150, 0 + br i1 %.fca.0.extract167.6, label %cond_392_case_1.6, label %cond_exit_369.thread.6 + +cond_392_case_1.6: ; preds = %__barray_mask_borrow.exit259.6 + %.fca.1.extract.6 = extractvalue { i1, i64, i1 } %150, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.6) + %.pre286 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.6 + +cond_exit_369.thread.6: ; preds = %cond_392_case_1.6, %__barray_mask_borrow.exit259.6, %cond_exit_369.thread.5 + %151 = phi i64 [ %.pre286, %cond_392_case_1.6 ], [ %148, %__barray_mask_borrow.exit259.6 ], [ %146, %cond_exit_369.thread.5 ] + %152 = and i64 %151, 128 + %.not296 = icmp eq i64 %152, 0 + br i1 %.not296, label %__barray_mask_borrow.exit259.7, label %cond_exit_369.thread.7 + +__barray_mask_borrow.exit259.7: ; preds = %cond_exit_369.thread.6 + %153 = or disjoint i64 %151, 128, !dbg !12 + store i64 %153, ptr %74, align 4, !dbg !12 + %154 = getelementptr inbounds nuw i8, ptr %73, i64 168 + %155 = load { i1, i64, i1 }, ptr %154, align 4 + %.fca.0.extract167.7 = extractvalue { i1, i64, i1 } %155, 0 + br i1 %.fca.0.extract167.7, label %cond_392_case_1.7, label %cond_exit_369.thread.7 + +cond_392_case_1.7: ; preds = %__barray_mask_borrow.exit259.7 + %.fca.1.extract.7 = extractvalue { i1, i64, i1 } %155, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.7) + %.pre287 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.7 + +cond_exit_369.thread.7: ; preds = %cond_392_case_1.7, %__barray_mask_borrow.exit259.7, %cond_exit_369.thread.6 + %156 = phi i64 [ %.pre287, %cond_392_case_1.7 ], [ %153, %__barray_mask_borrow.exit259.7 ], [ %151, %cond_exit_369.thread.6 ] + %157 = and i64 %156, 256 + %.not297 = icmp eq i64 %157, 0 + br i1 %.not297, label %__barray_mask_borrow.exit259.8, label %cond_exit_369.thread.8 + +__barray_mask_borrow.exit259.8: ; preds = %cond_exit_369.thread.7 + %158 = or disjoint i64 %156, 256, !dbg !12 + store i64 %158, ptr %74, align 4, !dbg !12 + %159 = getelementptr inbounds nuw i8, ptr %73, i64 192 + %160 = load { i1, i64, i1 }, ptr %159, align 4 + %.fca.0.extract167.8 = extractvalue { i1, i64, i1 } %160, 0 + br i1 %.fca.0.extract167.8, label %cond_392_case_1.8, label %cond_exit_369.thread.8 + +cond_392_case_1.8: ; preds = %__barray_mask_borrow.exit259.8 + %.fca.1.extract.8 = extractvalue { i1, i64, i1 } %160, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.8) + %.pre288 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.8 + +cond_exit_369.thread.8: ; preds = %cond_392_case_1.8, %__barray_mask_borrow.exit259.8, %cond_exit_369.thread.7 + %161 = phi i64 [ %.pre288, %cond_392_case_1.8 ], [ %158, %__barray_mask_borrow.exit259.8 ], [ %156, %cond_exit_369.thread.7 ] + %162 = and i64 %161, 512 + %.not298 = icmp eq i64 %162, 0 + br i1 %.not298, label %__barray_mask_borrow.exit259.9, label %cond_exit_369.thread.9 + +__barray_mask_borrow.exit259.9: ; preds = %cond_exit_369.thread.8 + %163 = or disjoint i64 %161, 512, !dbg !12 + store i64 %163, ptr %74, align 4, !dbg !12 + %164 = getelementptr inbounds nuw i8, ptr %73, i64 216 + %165 = load { i1, i64, i1 }, ptr %164, align 4 + %.fca.0.extract167.9 = extractvalue { i1, i64, i1 } %165, 0 + br i1 %.fca.0.extract167.9, label %cond_392_case_1.9, label %cond_exit_369.thread.9 + +cond_392_case_1.9: ; preds = %__barray_mask_borrow.exit259.9 + %.fca.1.extract.9 = extractvalue { i1, i64, i1 } %165, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract.9) + %.pre289 = load i64, ptr %74, align 4 + br label %cond_exit_369.thread.9 + +cond_exit_369.thread.9: ; preds = %cond_392_case_1.9, %__barray_mask_borrow.exit259.9, %cond_exit_369.thread.8 + %166 = phi i64 [ %.pre289, %cond_392_case_1.9 ], [ %163, %__barray_mask_borrow.exit259.9 ], [ %161, %cond_exit_369.thread.8 ] + %167 = or i64 %166, -1024 + store i64 %167, ptr %74, align 4 + %168 = icmp eq i64 %167, -1 + br i1 %168, label %cond_exit_369, label %mask_block_err.i + +cond_392_case_1: ; preds = %__barray_mask_borrow.exit259 + %.fca.1.extract = extractvalue { i1, i64, i1 } %120, 1 + tail call void @___dec_future_refcount(i64 %.fca.1.extract) + %.pre = load i64, ptr %74, align 4 + br label %cond_exit_369.thread +} + declare ptr @heap_alloc(i64) local_unnamed_addr ; Function Attrs: noreturn @@ -27,603 +627,12 @@ declare i64 @___qalloc() local_unnamed_addr declare void @___reset(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !59 { entry: - tail call void @setup(i64 %0) - %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.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_207_case_0.i.i, label %__barray_check_bounds.exit.i - -cond_207_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 = %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 - %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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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_207_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 - %"116.fca.0.insert.i" = insertvalue { ptr, ptr, i64 } poison, ptr %1, 0 - %"116.fca.1.insert.i" = insertvalue { ptr, ptr, i64 } %"116.fca.0.insert.i", ptr %2, 1 - %"116.fca.2.insert.i" = insertvalue { ptr, ptr, i64 } %"116.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.i238.i, label %__barray_mask_borrow.exit.i - -panic.i238.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 = %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.exit240.i, label %panic.i239.i - -panic.i239.i: ; preds = %__barray_mask_borrow.exit.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit240.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.exit242.i, label %panic.i241.i - -panic.i241.i: ; preds = %__barray_mask_return.exit240.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit242.i: ; preds = %__barray_mask_return.exit240.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 - %.not268.i = icmp eq i64 %54, 0 - br i1 %.not268.i, label %panic.i243.i, label %__barray_mask_return.exit244.i - -panic.i243.i: ; preds = %__barray_mask_borrow.exit242.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit244.i: ; preds = %__barray_mask_borrow.exit242.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 - %.not269.i = icmp eq i64 %57, 0 - br i1 %.not269.i, label %__barray_mask_borrow.exit246.i, label %panic.i245.i - -panic.i245.i: ; preds = %__barray_mask_return.exit244.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit246.i: ; preds = %__barray_mask_return.exit244.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 - %.not270.i = icmp eq i64 %61, 0 - br i1 %.not270.i, label %panic.i247.i, label %__barray_mask_return.exit248.i - -panic.i247.i: ; preds = %__barray_mask_borrow.exit246.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit248.i: ; preds = %__barray_mask_borrow.exit246.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 - %.not271.i = icmp eq i64 %64, 0 - br i1 %.not271.i, label %__barray_mask_borrow.exit250.i, label %panic.i249.i - -panic.i249.i: ; preds = %__barray_mask_return.exit248.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array elem.E746B1A3.0") - unreachable - -__barray_mask_borrow.exit250.i: ; preds = %__barray_mask_return.exit248.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 - %.not272.i = icmp eq i64 %68, 0 - br i1 %.not272.i, label %panic.i251.i, label %__barray_mask_return.exit252.i - -panic.i251.i: ; preds = %__barray_mask_borrow.exit250.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -__barray_mask_return.exit252.i: ; preds = %__barray_mask_borrow.exit250.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 } %"116.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.extract82.i.i.i, 6 - %75 = getelementptr i64, ptr %.fca.1.extract81.i.i.i, i64 %74 - %76 = load i64, ptr %75, align 4 - %77 = and i64 %.fca.2.extract82.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.extract82.i.i.i, 9 - %83 = lshr i64 %last_valid.i.i.i.i, 6 - %84 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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).280.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).280.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, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_check_bounds.exit.i.i.i: ; preds = %loop_body.i.i, %__barray_mask_return.exit252.i - %.fca.2.extract82.i187.i.i = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %.fca.2.extract82.i.i.i, %loop_body.i.i ] - %.fca.1.extract81.i186.i.i = phi ptr [ %2, %__barray_mask_return.exit252.i ], [ %.fca.1.extract81.i.i.i, %loop_body.i.i ] - %.fca.0.extract80.i185.i.i = phi ptr [ %1, %__barray_mask_return.exit252.i ], [ %.fca.0.extract80.i.i.i, %loop_body.i.i ] - %"306_0.sroa.15.0184.i.i" = phi i64 [ 0, %__barray_mask_return.exit252.i ], [ %95, %loop_body.i.i ] - %.pn165183.i.i = phi { { ptr, ptr, i64 }, i64 } [ %70, %__barray_mask_return.exit252.i ], [ %110, %loop_body.i.i ] - %95 = add nuw nsw i64 %"306_0.sroa.15.0184.i.i", 1 - %96 = add i64 %"306_0.sroa.15.0184.i.i", %.fca.2.extract82.i187.i.i - %97 = lshr i64 %96, 6 - %98 = getelementptr inbounds nuw i64, ptr %.fca.1.extract81.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 = %__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.extract80.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, %"306_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, ptr nonnull @"e_Array alre.5A300C2A.0") - unreachable - -loop_body.i.i: ; preds = %__barray_check_bounds.exit.i.i - %"371_054.fca.1.insert.i.i" = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 undef }, i64 %lazy_measure.i.i, 1 - %"371_054.fca.2.insert.i.i" = insertvalue { i1, i64, i1 } %"371_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, %"306_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 %"306_0.sroa.15.0184.i.i" - store { i1, i64, i1 } %"371_054.fca.2.insert.i.i", ptr %113, align 4 - %114 = extractvalue { { ptr, ptr, i64 }, i64 } %.pn165183.i.i, 0 - %.fca.0.extract80.i.i.i = extractvalue { ptr, ptr, i64 } %114, 0 - %.fca.1.extract81.i.i.i = extractvalue { ptr, ptr, i64 } %114, 1 - %.fca.2.extract82.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).280.exit.i": ; preds = %91, %73 - tail call void @heap_free(ptr %.fca.0.extract80.i.i.i) - tail call void @heap_free(ptr nonnull %.fca.1.extract81.i.i.i) - %115 = load i64, ptr %72, align 4 - %116 = trunc i64 %115 to i1 - br i1 %116, label %cond_exit_89.thread.i, label %__barray_mask_borrow.exit259.i - -mask_block_err.i.i: ; preds = %cond_exit_89.thread.9.i - tail call void @panic(i32 1002, ptr nonnull @"e_Array cont.EFA5AC45.0") - unreachable - -__barray_mask_borrow.exit259.i: ; preds = %"__hugr__.$measure_array$$n(10).280.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.extract167.i = extractvalue { i1, i64, i1 } %118, 0 - br i1 %.fca.0.extract167.i, label %cond_392_case_1.i, label %cond_exit_89.thread.i - -cond_exit_89.thread.i: ; preds = %cond_392_case_1.i, %__barray_mask_borrow.exit259.i, %"__hugr__.$measure_array$$n(10).280.exit.i" - %119 = phi i64 [ %.pre.i, %cond_392_case_1.i ], [ %117, %__barray_mask_borrow.exit259.i ], [ %115, %"__hugr__.$measure_array$$n(10).280.exit.i" ] - %120 = and i64 %119, 2 - %.not290.i = icmp eq i64 %120, 0 - br i1 %.not290.i, label %__barray_mask_borrow.exit259.1.i, label %cond_exit_89.thread.1.i - -__barray_mask_borrow.exit259.1.i: ; preds = %cond_exit_89.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.extract167.1.i = extractvalue { i1, i64, i1 } %123, 0 - br i1 %.fca.0.extract167.1.i, label %cond_392_case_1.1.i, label %cond_exit_89.thread.1.i - -cond_392_case_1.1.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre281.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.1.i - -cond_exit_89.thread.1.i: ; preds = %cond_392_case_1.1.i, %__barray_mask_borrow.exit259.1.i, %cond_exit_89.thread.i - %124 = phi i64 [ %.pre281.i, %cond_392_case_1.1.i ], [ %121, %__barray_mask_borrow.exit259.1.i ], [ %119, %cond_exit_89.thread.i ] - %125 = and i64 %124, 4 - %.not291.i = icmp eq i64 %125, 0 - br i1 %.not291.i, label %__barray_mask_borrow.exit259.2.i, label %cond_exit_89.thread.2.i - -__barray_mask_borrow.exit259.2.i: ; preds = %cond_exit_89.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.extract167.2.i = extractvalue { i1, i64, i1 } %128, 0 - br i1 %.fca.0.extract167.2.i, label %cond_392_case_1.2.i, label %cond_exit_89.thread.2.i - -cond_392_case_1.2.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre282.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.2.i - -cond_exit_89.thread.2.i: ; preds = %cond_392_case_1.2.i, %__barray_mask_borrow.exit259.2.i, %cond_exit_89.thread.1.i - %129 = phi i64 [ %.pre282.i, %cond_392_case_1.2.i ], [ %126, %__barray_mask_borrow.exit259.2.i ], [ %124, %cond_exit_89.thread.1.i ] - %130 = and i64 %129, 8 - %.not292.i = icmp eq i64 %130, 0 - br i1 %.not292.i, label %__barray_mask_borrow.exit259.3.i, label %cond_exit_89.thread.3.i - -__barray_mask_borrow.exit259.3.i: ; preds = %cond_exit_89.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.extract167.3.i = extractvalue { i1, i64, i1 } %133, 0 - br i1 %.fca.0.extract167.3.i, label %cond_392_case_1.3.i, label %cond_exit_89.thread.3.i - -cond_392_case_1.3.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre283.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.3.i - -cond_exit_89.thread.3.i: ; preds = %cond_392_case_1.3.i, %__barray_mask_borrow.exit259.3.i, %cond_exit_89.thread.2.i - %134 = phi i64 [ %.pre283.i, %cond_392_case_1.3.i ], [ %131, %__barray_mask_borrow.exit259.3.i ], [ %129, %cond_exit_89.thread.2.i ] - %135 = and i64 %134, 16 - %.not293.i = icmp eq i64 %135, 0 - br i1 %.not293.i, label %__barray_mask_borrow.exit259.4.i, label %cond_exit_89.thread.4.i - -__barray_mask_borrow.exit259.4.i: ; preds = %cond_exit_89.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.extract167.4.i = extractvalue { i1, i64, i1 } %138, 0 - br i1 %.fca.0.extract167.4.i, label %cond_392_case_1.4.i, label %cond_exit_89.thread.4.i - -cond_392_case_1.4.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre284.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.4.i - -cond_exit_89.thread.4.i: ; preds = %cond_392_case_1.4.i, %__barray_mask_borrow.exit259.4.i, %cond_exit_89.thread.3.i - %139 = phi i64 [ %.pre284.i, %cond_392_case_1.4.i ], [ %136, %__barray_mask_borrow.exit259.4.i ], [ %134, %cond_exit_89.thread.3.i ] - %140 = and i64 %139, 32 - %.not294.i = icmp eq i64 %140, 0 - br i1 %.not294.i, label %__barray_mask_borrow.exit259.5.i, label %cond_exit_89.thread.5.i - -__barray_mask_borrow.exit259.5.i: ; preds = %cond_exit_89.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.extract167.5.i = extractvalue { i1, i64, i1 } %143, 0 - br i1 %.fca.0.extract167.5.i, label %cond_392_case_1.5.i, label %cond_exit_89.thread.5.i - -cond_392_case_1.5.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre285.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.5.i - -cond_exit_89.thread.5.i: ; preds = %cond_392_case_1.5.i, %__barray_mask_borrow.exit259.5.i, %cond_exit_89.thread.4.i - %144 = phi i64 [ %.pre285.i, %cond_392_case_1.5.i ], [ %141, %__barray_mask_borrow.exit259.5.i ], [ %139, %cond_exit_89.thread.4.i ] - %145 = and i64 %144, 64 - %.not295.i = icmp eq i64 %145, 0 - br i1 %.not295.i, label %__barray_mask_borrow.exit259.6.i, label %cond_exit_89.thread.6.i - -__barray_mask_borrow.exit259.6.i: ; preds = %cond_exit_89.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.extract167.6.i = extractvalue { i1, i64, i1 } %148, 0 - br i1 %.fca.0.extract167.6.i, label %cond_392_case_1.6.i, label %cond_exit_89.thread.6.i - -cond_392_case_1.6.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre286.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.6.i - -cond_exit_89.thread.6.i: ; preds = %cond_392_case_1.6.i, %__barray_mask_borrow.exit259.6.i, %cond_exit_89.thread.5.i - %149 = phi i64 [ %.pre286.i, %cond_392_case_1.6.i ], [ %146, %__barray_mask_borrow.exit259.6.i ], [ %144, %cond_exit_89.thread.5.i ] - %150 = and i64 %149, 128 - %.not296.i = icmp eq i64 %150, 0 - br i1 %.not296.i, label %__barray_mask_borrow.exit259.7.i, label %cond_exit_89.thread.7.i - -__barray_mask_borrow.exit259.7.i: ; preds = %cond_exit_89.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.extract167.7.i = extractvalue { i1, i64, i1 } %153, 0 - br i1 %.fca.0.extract167.7.i, label %cond_392_case_1.7.i, label %cond_exit_89.thread.7.i - -cond_392_case_1.7.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre287.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.7.i - -cond_exit_89.thread.7.i: ; preds = %cond_392_case_1.7.i, %__barray_mask_borrow.exit259.7.i, %cond_exit_89.thread.6.i - %154 = phi i64 [ %.pre287.i, %cond_392_case_1.7.i ], [ %151, %__barray_mask_borrow.exit259.7.i ], [ %149, %cond_exit_89.thread.6.i ] - %155 = and i64 %154, 256 - %.not297.i = icmp eq i64 %155, 0 - br i1 %.not297.i, label %__barray_mask_borrow.exit259.8.i, label %cond_exit_89.thread.8.i - -__barray_mask_borrow.exit259.8.i: ; preds = %cond_exit_89.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.extract167.8.i = extractvalue { i1, i64, i1 } %158, 0 - br i1 %.fca.0.extract167.8.i, label %cond_392_case_1.8.i, label %cond_exit_89.thread.8.i - -cond_392_case_1.8.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre288.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.8.i - -cond_exit_89.thread.8.i: ; preds = %cond_392_case_1.8.i, %__barray_mask_borrow.exit259.8.i, %cond_exit_89.thread.7.i - %159 = phi i64 [ %.pre288.i, %cond_392_case_1.8.i ], [ %156, %__barray_mask_borrow.exit259.8.i ], [ %154, %cond_exit_89.thread.7.i ] - %160 = and i64 %159, 512 - %.not298.i = icmp eq i64 %160, 0 - br i1 %.not298.i, label %__barray_mask_borrow.exit259.9.i, label %cond_exit_89.thread.9.i - -__barray_mask_borrow.exit259.9.i: ; preds = %cond_exit_89.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.extract167.9.i = extractvalue { i1, i64, i1 } %163, 0 - br i1 %.fca.0.extract167.9.i, label %cond_392_case_1.9.i, label %cond_exit_89.thread.9.i - -cond_392_case_1.9.i: ; preds = %__barray_mask_borrow.exit259.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) - %.pre289.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.9.i - -cond_exit_89.thread.9.i: ; preds = %cond_392_case_1.9.i, %__barray_mask_borrow.exit259.9.i, %cond_exit_89.thread.8.i - %164 = phi i64 [ %.pre289.i, %cond_392_case_1.9.i ], [ %161, %__barray_mask_borrow.exit259.9.i ], [ %159, %cond_exit_89.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_392_case_1.i: ; preds = %__barray_mask_borrow.exit259.i - %.fca.1.extract.i = extractvalue { i1, i64, i1 } %118, 1 - tail call void @___dec_future_refcount(i64 %.fca.1.extract.i) - %.pre.i = load i64, ptr %72, align 4 - br label %cond_exit_89.thread.i - -__hugr__.main.1.exit: ; preds = %cond_exit_89.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 + tail call void @setup(i64 %0), !dbg !63 + tail call void @"__hugr__.__main__.measure_qb_array..main.1"(), !dbg !63 + %1 = tail call i64 @teardown(), !dbg !63 + ret i64 %1, !dbg !63 } declare void @setup(i64) local_unnamed_addr @@ -632,6 +641,71 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "measure_qb_array..main", linkageName: "__hugr__.__main__.measure_qb_array..main.1", scope: null, file: !5, line: 101, type: !6, scopeLine: 102, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 102, column: 13, scope: !4) +!9 = !DILocation(line: 102, column: 19, scope: !4) +!10 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !11) +!11 = distinct !DILocation(line: 103, column: 10, scope: !4) +!12 = !DILocation(line: 103, column: 10, scope: !4) +!13 = !DILocation(line: 103, column: 8, scope: !4) +!14 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !15) +!15 = distinct !DILocation(line: 104, column: 10, scope: !4) +!16 = !DILocation(line: 104, column: 10, scope: !4) +!17 = !DILocation(line: 104, column: 8, scope: !4) +!18 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !19) +!19 = distinct !DILocation(line: 105, column: 10, scope: !4) +!20 = !DILocation(line: 105, column: 10, scope: !4) +!21 = !DILocation(line: 105, column: 8, scope: !4) +!22 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !23) +!23 = distinct !DILocation(line: 106, column: 10, scope: !4) +!24 = !DILocation(line: 106, column: 10, scope: !4) +!25 = !DILocation(line: 106, column: 8, scope: !4) +!26 = !DILocation(line: 84, column: 25, scope: !27, inlinedAt: !37) +!27 = distinct !DISubprogram(name: "std.array.array.__iter__$qubit&10", linkageName: "__hugr__.guppylang.std.array.array.__iter__$qubit&10.190", scope: null, file: !28, line: 83, type: !29, scopeLine: 84, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!28 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/array.py", directory: "") +!29 = !DISubroutineType(types: !30) +!30 = !{!31, !33} +!31 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { ptr, ptr, i64 }, i64 }", file: !2, size: 32, align: 8, elements: !32) +!32 = !{!33, !36} +!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, ptr, i64 }", file: !2, size: 24, align: 8, elements: !34) +!34 = !{!35, !35, !36} +!35 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!36 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!37 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!38 = distinct !DISubprogram(name: "std.quantum.measure_array$10", linkageName: "__hugr__.guppylang.std.quantum.measure_array$10.149", scope: null, file: !39, line: 380, type: !40, scopeLine: 382, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!39 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/quantum/__init__.py", directory: "") +!40 = !DISubroutineType(types: !41) +!41 = !{!33, !33} +!42 = distinct !DILocation(line: 107, column: 8, scope: !4) +!43 = !DILocation(line: 382, column: 11, scope: !38, inlinedAt: !42) +!44 = !DILocation(line: 276, column: 8, scope: !45, inlinedAt: !53) +!45 = distinct !DISubprogram(name: "std.array.ArrayIter.__next__$qubit&10", linkageName: "__hugr__.guppylang.std.array.ArrayIter.__next__$qubit&10.202", scope: null, file: !28, line: 270, type: !46, scopeLine: 273, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!46 = !DISubroutineType(types: !47) +!47 = !{!48, !31} +!48 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, { { { ptr, ptr, i64 }, i64 }, i64 } }", file: !2, size: 40, align: 8, elements: !49) +!49 = !{!50, !51} +!50 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!51 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ { { ptr, ptr, i64 }, i64 }, i64 }", file: !2, size: 40, align: 8, elements: !52) +!52 = !{!31, !36} +!53 = distinct !DILocation(line: 382, column: 37, scope: !38, inlinedAt: !42) +!54 = !DILocation(line: 275, column: 50, scope: !45, inlinedAt: !53) +!55 = !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!56 = !DILocation(line: 103, column: 10, scope: !4, inlinedAt: !57) +!57 = distinct !DILocation(line: 274, column: 19, scope: !45, inlinedAt: !53) +!58 = !DILocation(line: 273, column: 11, scope: !45, inlinedAt: !53) +!59 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !60, type: !61, spFlags: DISPFlagDefinition, unit: !1) +!60 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!61 = !DISubroutineType(types: !62) +!62 = !{!36, !36} +!63 = !DILocation(line: 0, scope: !59) 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 a85084143..3272e6249 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 @@ -5,6 +5,26 @@ 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." +define void @"__hugr__.__main__.no_results..bar.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_18_case_0.i, label %__hugr__.__tk2_qalloc.14.exit, !dbg !8 + +cond_18_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.14.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___dec_future_refcount(i64 %lazy_measure) + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -22,26 +42,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + tail call void @"__hugr__.__main__.no_results..bar.1"(), !dbg !15 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr @@ -50,6 +56,23 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "no_results..bar", linkageName: "__hugr__.__main__.no_results..bar.1", scope: null, file: !5, line: 64, type: !6, scopeLine: 65, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 65, column: 20, scope: !4) +!9 = !DILocation(line: 66, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) 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 e2509c87a..2b142ff01 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 @@ -7,6 +7,38 @@ target triple = "x86_64-windows-msvc" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_exit..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_45_case_0.i, label %__hugr__.__tk2_qalloc.41.exit, !dbg !8 + +cond_45_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.41.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_98_case_1 + +cond_98_case_1: ; preds = %__hugr__.__tk2_qalloc.41.exit + %read_bool66 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.41.exit + tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_45_case_0.i.i, label %__hugr__.__tk2_qalloc.41.exit.i - -cond_45_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.41.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - tail call void @panic(i32 42, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.41.exit.i - %read_bool66.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool66.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_exit..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_exit..main", linkageName: "__hugr__.__main__.postselect_exit..main.1", scope: null, file: !5, line: 131, type: !6, scopeLine: 132, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 132, column: 12, scope: !4) +!9 = !DILocation(line: 133, column: 8, scope: !4) +!10 = !DILocation(line: 137, column: 8, scope: !4) +!11 = !DILocation(line: 136, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 203df071d..4012ba1cc 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 @@ -7,6 +7,38 @@ target triple = "x86_64-windows-msvc" @res_c.1C9EF4D1.0 = private constant [12 x i8] c"\0BUSER:BOOL:c" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.postselect_panic..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_43_case_0.i, label %__hugr__.__tk2_qalloc.39.exit, !dbg !8 + +cond_43_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.39.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + tail call void @___rxy(i64 %qalloc.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !9 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !9 + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + tail call void @___inc_future_refcount(i64 %lazy_measure) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + br i1 %read_bool, label %0, label %cond_96_case_1 + +cond_96_case_1: ; preds = %__hugr__.__tk2_qalloc.39.exit + %read_bool65 = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65), !dbg !10 + ret void + +0: ; preds = %__hugr__.__tk2_qalloc.39.exit + tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0), !dbg !11 + unreachable +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -30,38 +62,12 @@ declare void @___rxy(i64, double, double) local_unnamed_addr declare void @___rz(i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !12 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1 - br i1 %not_max.not.not.i.i, label %cond_43_case_0.i.i, label %__hugr__.__tk2_qalloc.39.exit.i - -cond_43_case_0.i.i: ; preds = %entry - tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0") - unreachable - -__hugr__.__tk2_qalloc.39.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 %1, label %__hugr__.main.1.exit - -1: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - tail call void @panic(i32 1001, ptr nonnull @s_Postselect.13DF1CD0.0) - unreachable - -__hugr__.main.1.exit: ; preds = %__hugr__.__tk2_qalloc.39.exit.i - %read_bool65.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(ptr nonnull @res_c.1C9EF4D1.0, i64 11, i1 %read_bool65.i) - %2 = tail call i64 @teardown() - ret i64 %2 + tail call void @setup(i64 %0), !dbg !17 + tail call void @"__hugr__.__main__.postselect_panic..main.1"(), !dbg !17 + %1 = tail call i64 @teardown(), !dbg !17 + ret i64 %1, !dbg !17 } declare void @setup(i64) local_unnamed_addr @@ -70,6 +76,25 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "postselect_panic..main", linkageName: "__hugr__.__main__.postselect_panic..main.1", scope: null, file: !5, line: 144, type: !6, scopeLine: 145, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 145, column: 12, scope: !4) +!9 = !DILocation(line: 146, column: 8, scope: !4) +!10 = !DILocation(line: 150, column: 8, scope: !4) +!11 = !DILocation(line: 149, column: 12, scope: !4) +!12 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !13, type: !14, spFlags: DISPFlagDefinition, unit: !1) +!13 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!14 = !DISubroutineType(types: !15) +!15 = !{!16, !16} +!16 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!17 = !DILocation(line: 0, scope: !12) 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 8b23d24de..324ca126f 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 @@ -5,23 +5,50 @@ target triple = "x86_64-windows-msvc" @res_shot.6D86EAF7.0 = private constant [14 x i8] c"\0DUSER:INT:shot" +define void @"__hugr__.__main__.print_current_shot..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %shot = tail call i64 @get_current_shot(), !dbg !8 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot), !dbg !9 + ret void +} + declare i64 @get_current_shot() local_unnamed_addr declare void @print_int(ptr, i64, i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !10 { entry: - tail call void @setup(i64 %0) - %shot.i = tail call i64 @get_current_shot() - tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i) - %1 = tail call i64 @teardown() - ret i64 %1 + tail call void @setup(i64 %0), !dbg !15 + %shot.i = tail call i64 @get_current_shot(), !dbg !16 + tail call void @print_int(ptr nonnull @res_shot.6D86EAF7.0, i64 13, i64 %shot.i), !dbg !18 + %1 = tail call i64 @teardown(), !dbg !15 + ret i64 %1, !dbg !15 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "print_current_shot..main", linkageName: "__hugr__.__main__.print_current_shot..main.1", scope: null, file: !5, line: 194, type: !6, scopeLine: 195, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 195, column: 23, scope: !4) +!9 = !DILocation(line: 195, column: 8, scope: !4) +!10 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !11, type: !12, spFlags: DISPFlagDefinition, unit: !1) +!11 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!12 = !DISubroutineType(types: !13) +!13 = !{!14, !14} +!14 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!15 = !DILocation(line: 0, scope: !10) +!16 = !DILocation(line: 195, column: 23, scope: !4, inlinedAt: !17) +!17 = distinct !DILocation(line: 0, scope: !10) +!18 = !DILocation(line: 195, column: 8, scope: !4, inlinedAt: !17) 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 ecfd7366c..c0a74200b 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 @@ -11,6 +11,32 @@ target triple = "x86_64-windows-msvc" @res_rfloat2.4DAB941F.0 = private constant [19 x i8] c"\12USER:FLOAT:rfloat2" @res_rint_bnd2.169DE399.0 = private constant [19 x i8] c"\12USER:INT:rint_bnd2" +define void @"__hugr__.__main__.rng..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + tail call void @random_seed(i64 42), !dbg !8 + %rint = tail call i32 @random_int(), !dbg !17 + %rint14 = tail call i32 @random_int(), !dbg !18 + %rfloat = tail call double @random_float(), !dbg !19 + %rintb = tail call i32 @random_rng(i32 100), !dbg !20 + %0 = sext i32 %rintb to i64, !dbg !20 + %1 = sext i32 %rint14 to i64, !dbg !18 + %2 = sext i32 %rint to i64, !dbg !17 + tail call void @print_int(ptr nonnull @res_rint.B928E41E.0, i64 13, i64 %2), !dbg !21 + tail call void @print_int(ptr nonnull @res_rint1.0884EC03.0, i64 14, i64 %1), !dbg !22 + tail call void @print_float(ptr nonnull @res_rfloat.F0E4DD2C.0, i64 17, double %rfloat), !dbg !23 + tail call void @print_int(ptr nonnull @res_rint_bnd.CB1E6B0D.0, i64 17, i64 %0), !dbg !24 + tail call void @random_seed(i64 84), !dbg !25 + %rint47 = tail call i32 @random_int(), !dbg !27 + %rfloat49 = tail call double @random_float(), !dbg !28 + %rintb52 = tail call i32 @random_rng(i32 200), !dbg !29 + %3 = sext i32 %rintb52 to i64, !dbg !29 + %4 = sext i32 %rint47 to i64, !dbg !27 + tail call void @print_int(ptr nonnull @res_rint2.F0335598.0, i64 14, i64 %4), !dbg !30 + tail call void @print_float(ptr nonnull @res_rfloat2.4DAB941F.0, i64 18, double %rfloat49), !dbg !31 + tail call void @print_int(ptr nonnull @res_rint_bnd2.169DE399.0, i64 18, i64 %3), !dbg !32 + ret void +} + declare i32 @random_int() local_unnamed_addr declare double @random_float() local_unnamed_addr @@ -23,38 +49,57 @@ declare void @print_float(ptr, i64, double) local_unnamed_addr declare void @random_seed(i64) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !33 { entry: - tail call void @setup(i64 %0) - tail call void @random_seed(i64 42) - %rint.i = tail call i32 @random_int() - %rint14.i = tail call i32 @random_int() - %rfloat.i = tail call double @random_float() - %rintb.i = tail call i32 @random_rng(i32 100) - %1 = sext i32 %rintb.i to i64 - %2 = sext i32 %rint14.i to i64 - %3 = sext i32 %rint.i to i64 - 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) - %rint47.i = tail call i32 @random_int() - %rfloat49.i = tail call double @random_float() - %rintb52.i = tail call i32 @random_rng(i32 200) - %4 = sext i32 %rintb52.i to i64 - %5 = sext i32 %rint47.i to i64 - 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 %rfloat49.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 + tail call void @setup(i64 %0), !dbg !37 + tail call void @"__hugr__.__main__.rng..main.1"(), !dbg !37 + %1 = tail call i64 @teardown(), !dbg !37 + ret i64 %1, !dbg !37 } declare void @setup(i64) local_unnamed_addr declare i64 @teardown() local_unnamed_addr -!name = !{!0} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} -!0 = !{!"mainlib"} +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rng..main", linkageName: "__hugr__.__main__.rng..main.1", scope: null, file: !5, line: 202, type: !6, scopeLine: 203, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !16) +!9 = distinct !DISubprogram(name: "std.qsystem.random.RNG.__new__", linkageName: "__hugr__.guppylang.std.qsystem.random.RNG.__new__.72", scope: null, file: !10, line: 42, type: !11, scopeLine: 44, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!10 = !DIFile(filename: "/Users/george.hodgkins/proj/clone-anduril/.venv/lib/python3.10/site-packages/guppylang/std/qsystem/random.py", directory: "") +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !15} +!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !14) +!14 = !{} +!15 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!16 = distinct !DILocation(line: 203, column: 14, scope: !4) +!17 = !DILocation(line: 204, column: 15, scope: !4) +!18 = !DILocation(line: 205, column: 16, scope: !4) +!19 = !DILocation(line: 206, column: 17, scope: !4) +!20 = !DILocation(line: 207, column: 19, scope: !4) +!21 = !DILocation(line: 209, column: 8, scope: !4) +!22 = !DILocation(line: 210, column: 8, scope: !4) +!23 = !DILocation(line: 211, column: 8, scope: !4) +!24 = !DILocation(line: 212, column: 8, scope: !4) +!25 = !DILocation(line: 44, column: 15, scope: !9, inlinedAt: !26) +!26 = distinct !DILocation(line: 213, column: 14, scope: !4) +!27 = !DILocation(line: 214, column: 15, scope: !4) +!28 = !DILocation(line: 215, column: 17, scope: !4) +!29 = !DILocation(line: 216, column: 19, scope: !4) +!30 = !DILocation(line: 218, column: 8, scope: !4) +!31 = !DILocation(line: 219, column: 8, scope: !4) +!32 = !DILocation(line: 220, column: 8, scope: !4) +!33 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !34, type: !35, spFlags: DISPFlagDefinition, unit: !1) +!34 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!35 = !DISubroutineType(types: !36) +!36 = !{!15, !15} +!37 = !DILocation(line: 0, scope: !33) 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 d9e8e4d01..40deb85c3 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 @@ -6,6 +6,93 @@ target triple = "x86_64-windows-msvc" @res_result.457DE32D.0 = private constant [17 x i8] c"\10USER:BOOL:result" @"e_No more qu.3B2EEBF0.0" = private constant [47 x i8] c".EXIT:INT:No more qubits available to allocate." +define void @"__hugr__.__main__.rus..main.1"() local_unnamed_addr !dbg !4 { +alloca_block: + %qalloc.i = tail call i64 @___qalloc(), !dbg !8 + %not_max.not.not.i = icmp eq i64 %qalloc.i, -1, !dbg !8 + br i1 %not_max.not.not.i, label %cond_87_case_0.i, label %__hugr__.__tk2_qalloc.83.exit, !dbg !8 + +cond_87_case_0.i: ; preds = %alloca_block + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !8 + unreachable, !dbg !8 + +__hugr__.__tk2_qalloc.83.exit: ; preds = %alloca_block + tail call void @___reset(i64 %qalloc.i), !dbg !8 + %qalloc.i132.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i133.i = icmp eq i64 %qalloc.i132.i, -1, !dbg !9 + br i1 %not_max.not.not.i133.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_101_case_0.i.i: ; preds = %cond_242_case_1.backedge.i, %__hugr__.__tk2_qalloc.83.exit + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !9 + unreachable, !dbg !9 + +__hugr__.__tk2_qalloc.97.exit.i: ; preds = %__hugr__.__tk2_qalloc.83.exit, %cond_242_case_1.backedge.i + %qalloc.i134.i = phi i64 [ %qalloc.i.i, %cond_242_case_1.backedge.i ], [ %qalloc.i132.i, %__hugr__.__tk2_qalloc.83.exit ] + tail call void @___reset(i64 %qalloc.i134.i), !dbg !9 + %qalloc.i128.i = tail call i64 @___qalloc(), !dbg !15 + %not_max.not.not.i129.i = icmp eq i64 %qalloc.i128.i, -1, !dbg !15 + br i1 %not_max.not.not.i129.i, label %cond_115_case_0.i.i, label %__hugr__.__tk2_qalloc.111.exit.i, !dbg !15 + +cond_115_case_0.i.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @panic(i32 1001, ptr nonnull @"e_No more qu.3B2EEBF0.0"), !dbg !15 + unreachable, !dbg !15 + +__hugr__.__tk2_qalloc.111.exit.i: ; preds = %__hugr__.__tk2_qalloc.97.exit.i + tail call void @___reset(i64 %qalloc.i128.i), !dbg !15 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !16 + tail call void @___rz(i64 %qalloc.i128.i, double 0x400921FB54442D18), !dbg !16 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0xBFF921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0x400921FB54442D18), !dbg !17 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFE921FB54442D18), !dbg !18 + tail call void @___rxy(i64 %qalloc.i134.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rzz(i64 %qalloc.i128.i, i64 %qalloc.i134.i, double 0x3FF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rxy(i64 %qalloc.i134.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0xBFF921FB54442D18), !dbg !19 + tail call void @___rz(i64 %qalloc.i134.i, double 0x3FE921FB54442D18), !dbg !20 + %lazy_measure.i = tail call i64 @___lazy_measure(i64 %qalloc.i134.i) + tail call void @___qfree(i64 %qalloc.i134.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 %cond_256_case_1.i, label %0 + +0: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___qfree(i64 %qalloc.i128.i), !dbg !21 + br label %cond_242_case_1.backedge.i + +cond_242_case_1.backedge.i: ; preds = %1, %0 + %qalloc.i.i = tail call i64 @___qalloc(), !dbg !9 + %not_max.not.not.i.i = icmp eq i64 %qalloc.i.i, -1, !dbg !9 + br i1 %not_max.not.not.i.i, label %cond_101_case_0.i.i, label %__hugr__.__tk2_qalloc.97.exit.i, !dbg !9 + +cond_256_case_1.i: ; preds = %__hugr__.__tk2_qalloc.111.exit.i + tail call void @___rz(i64 %qalloc.i, double 0x3FE921FB54442D18), !dbg !22 + tail call void @___rz(i64 %qalloc.i, double 0x400921FB54442D18), !dbg !23 + tail call void @___rxy(i64 %qalloc.i128.i, double 0xBFF921FB54442D18, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rzz(i64 %qalloc.i, i64 %qalloc.i128.i, double 0x3FF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rxy(i64 %qalloc.i128.i, double 0x3FF921FB54442D18, double 0x400921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0xBFF921FB54442D18), !dbg !24 + tail call void @___rz(i64 %qalloc.i128.i, double 0x3FE921FB54442D18), !dbg !25 + %lazy_measure67.i = tail call i64 @___lazy_measure(i64 %qalloc.i128.i) + tail call void @___qfree(i64 %qalloc.i128.i) + %read_bool80.i = tail call i1 @___read_future_bool(i64 %lazy_measure67.i) + tail call void @___dec_future_refcount(i64 %lazy_measure67.i) + br i1 %read_bool80.i, label %"__hugr__.__main__.rus..rus.17.exit", label %1 + +1: ; preds = %cond_256_case_1.i + tail call void @___rxy(i64 %qalloc.i, double 0x400921FB54442D18, double 0.000000e+00), !dbg !26 + br label %cond_242_case_1.backedge.i + +"__hugr__.__main__.rus..rus.17.exit": ; preds = %cond_256_case_1.i + %lazy_measure = tail call i64 @___lazy_measure(i64 %qalloc.i) + tail call void @___qfree(i64 %qalloc.i) + %read_bool = tail call i1 @___read_future_bool(i64 %lazy_measure) + tail call void @___dec_future_refcount(i64 %lazy_measure) + tail call void @print_bool(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool), !dbg !27 + ret void +} + declare i64 @___lazy_measure(i64) local_unnamed_addr declare void @___qfree(i64) local_unnamed_addr @@ -29,93 +116,12 @@ declare void @___rz(i64, double) local_unnamed_addr declare void @___rzz(i64, i64, double) local_unnamed_addr -define i64 @qmain(i64 %0) local_unnamed_addr { +define i64 @qmain(i64 %0) local_unnamed_addr !dbg !28 { entry: - tail call void @setup(i64 %0) - %qalloc.i.i = tail call i64 @___qalloc() - %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 - -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 = %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 = %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 = %__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.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 - -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 = %__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 %1 - -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 %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 %2 - -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 %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(ptr nonnull @res_result.457DE32D.0, i64 16, i1 %read_bool.i) - %3 = tail call i64 @teardown() - ret i64 %3 + tail call void @setup(i64 %0), !dbg !30 + tail call void @"__hugr__.__main__.rus..main.1"(), !dbg !30 + %1 = tail call i64 @teardown(), !dbg !30 + ret i64 %1, !dbg !30 } declare void @setup(i64) local_unnamed_addr @@ -124,6 +130,38 @@ declare i64 @teardown() local_unnamed_addr attributes #0 = { noreturn } -!name = !{!0} - -!0 = !{!"mainlib"} +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} +!name = !{!3} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "guppylang (guppylang-internals-v0.32.0)-v0.21.11", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "file:///Users/george.hodgkins/proj/clone-anduril") +!3 = !{!"mainlib"} +!4 = distinct !DISubprogram(name: "rus..main", linkageName: "__hugr__.__main__.rus..main.1", scope: null, file: !5, line: 184, type: !6, scopeLine: 185, spFlags: DISPFlagDefinition, unit: !1) +!5 = !DIFile(filename: "/Users/george.hodgkins/proj/tket2/qis-compiler/python/tests/generate_hugrs.py", directory: "") +!6 = !DISubroutineType(types: !7) +!7 = !{null} +!8 = !DILocation(line: 185, column: 12, scope: !4) +!9 = !DILocation(line: 160, column: 19, scope: !10, inlinedAt: !14) +!10 = distinct !DISubprogram(name: "rus..rus", linkageName: "__hugr__.__main__.rus..rus.17", scope: null, file: !5, line: 157, type: !11, scopeLine: 158, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!11 = !DISubroutineType(types: !12) +!12 = !{!13, !13} +!13 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!14 = distinct !DILocation(line: 186, column: 8, scope: !4) +!15 = !DILocation(line: 160, column: 28, scope: !10, inlinedAt: !14) +!16 = !DILocation(line: 162, column: 12, scope: !10, inlinedAt: !14) +!17 = !DILocation(line: 161, column: 12, scope: !10, inlinedAt: !14) +!18 = !DILocation(line: 164, column: 12, scope: !10, inlinedAt: !14) +!19 = !DILocation(line: 165, column: 12, scope: !10, inlinedAt: !14) +!20 = !DILocation(line: 166, column: 12, scope: !10, inlinedAt: !14) +!21 = !DILocation(line: 169, column: 16, scope: !10, inlinedAt: !14) +!22 = !DILocation(line: 172, column: 12, scope: !10, inlinedAt: !14) +!23 = !DILocation(line: 173, column: 12, scope: !10, inlinedAt: !14) +!24 = !DILocation(line: 174, column: 12, scope: !10, inlinedAt: !14) +!25 = !DILocation(line: 175, column: 12, scope: !10, inlinedAt: !14) +!26 = !DILocation(line: 181, column: 12, scope: !10, inlinedAt: !14) +!27 = !DILocation(line: 187, column: 8, scope: !4) +!28 = distinct !DISubprogram(name: "qmain", linkageName: "qmain", scope: null, file: !29, type: !11, spFlags: DISPFlagDefinition, unit: !1) +!29 = !DIFile(filename: "COMPILER_GENERATED_CODE", directory: "") +!30 = !DILocation(line: 0, scope: !28) diff --git a/qis-compiler/python/tests/test_basic_generation.py b/qis-compiler/python/tests/test_basic_generation.py index f829cf2c8..87203b6dd 100644 --- a/qis-compiler/python/tests/test_basic_generation.py +++ b/qis-compiler/python/tests/test_basic_generation.py @@ -71,7 +71,7 @@ def test_unsupported_pytket_ops() -> None: @pytest.mark.parametrize("target_triple", triples) def test_llvm(snapshot: Snapshot, hugr_file: str, target_triple: str) -> None: hugr_envelope = load(hugr_file) - ir = compile_to_llvm_ir(hugr_envelope, target_triple=target_triple) # type: ignore[call-arg] + ir = compile_to_llvm_ir(hugr_envelope, target_triple=target_triple, emit_debug=True) snapshot.assert_match(ir, f"{hugr_file}_{target_triple}") @@ -116,5 +116,5 @@ def test_gpu(snapshot: Snapshot, target_triple: str) -> None: # above, using the tket_qsystem::extension::gpu entities. hugr_file = resources_dir / "example_gpu.hugr" hugr_envelope = hugr_file.read_bytes() - ir = compile_to_llvm_ir(hugr_envelope, target_triple=target_triple) # type: ignore[call-arg] + ir = compile_to_llvm_ir(hugr_envelope, target_triple=target_triple) snapshot.assert_match(ir, f"gpu_{target_triple}") diff --git a/qis-compiler/rust/gpu.rs b/qis-compiler/rust/gpu.rs index 1c5bdc716..c8ba65661 100644 --- a/qis-compiler/rust/gpu.rs +++ b/qis-compiler/rust/gpu.rs @@ -1010,7 +1010,7 @@ mod test { .add_float_extensions() .add_extension(GpuCodegen) }); - let hugr = single_op_hugr(op.into()); + let mut hugr = single_op_hugr(op.into()); check_emission!(hugr, llvm_ctx); } } diff --git a/qis-compiler/rust/lib.rs b/qis-compiler/rust/lib.rs index a94eb19bf..816a70855 100644 --- a/qis-compiler/rust/lib.rs +++ b/qis-compiler/rust/lib.rs @@ -5,7 +5,7 @@ use anyhow::{Result, anyhow}; use hugr::envelope::EnvelopeConfig; use hugr::llvm::CodegenExtsBuilder; use hugr::llvm::custom::CodegenExtsMap; -use hugr::llvm::emit::{EmitHugr, Namer}; +use hugr::llvm::emit::{EmitHugr, Namer, debug_info::DebugInfoContext}; use hugr::llvm::extension::int::IntCodegenExtension; use hugr::llvm::utils::fat::FatExt as _; use inkwell::OptimizationLevel; @@ -134,11 +134,17 @@ fn get_hugr_llvm_module<'c, 'hugr, 'a: 'c>( hugr: &'hugr Hugr, module_name: impl AsRef, exts: Rc>, -) -> Result> { + emit_debug: bool, + ptr_bits: u32, +) -> Result<(Module<'c>, Option>)> { let module = context.create_module(module_name.as_ref()); let emit = EmitHugr::new(context, module, namer, exts); Ok(emit - .emit_module(hugr.try_fat(hugr.module_root()).unwrap())? + .emit_module( + hugr.try_fat(hugr.module_root()).unwrap(), + emit_debug, + ptr_bits, + )? .finish()) } @@ -181,18 +187,24 @@ fn get_module_with_std_exts<'c>( context: &'c Context, namer: Rc, hugr: &'c mut Hugr, -) -> Result> { + emit_debug: bool, +) -> Result<(Module<'c>, Option>)> { process_hugr(hugr)?; if let Some(filename) = &args.save_hugr { let file = fs::File::create(PathBuf::from(filename))?; hugr.store(file, EnvelopeConfig::text())?; } + let ptr_bits = context + .ptr_sized_int_type(&args.target_machine.get_target_data(), Default::default()) + .get_bit_width(); get_hugr_llvm_module( context, namer, hugr, &args.name, Rc::new(codegen_extensions()), + emit_debug, + ptr_bits, ) } @@ -250,6 +262,7 @@ fn wrap_main<'c>( module: &Module<'c>, hugr_entry: &str, module_entry: &str, + mut maybe_di_ctx: Option<&mut DebugInfoContext<'c>>, ) -> Result<()> { let entry_ty = ctx.i64_type().fn_type(&[ctx.i64_type().into()], false); let entry_fun = module.add_function(module_entry, entry_ty, None); @@ -259,6 +272,11 @@ fn wrap_main<'c>( let teardown = module.add_function("teardown", teardown_type, None); let block = ctx.append_basic_block(entry_fun, "entry"); let builder = ctx.create_builder(); + + if let Some(ref mut di_ctx) = maybe_di_ctx { + di_ctx.set_compiler_generated(entry_fun, ctx, &builder)?; + } + builder.position_at_end(block); let initial_tc = entry_fun.get_nth_param(0).unwrap().into_int_value(); @@ -275,6 +293,10 @@ fn wrap_main<'c>( .ok_or_else(|| anyhow!("get_tc has no return value"))?; // Return the initial time cursor let _ = builder.build_return(Some(&tc))?; + + if let Some(di_ctx) = maybe_di_ctx { + di_ctx.unset_debug_loc(&builder)?; + } Ok(()) } @@ -315,6 +337,7 @@ fn compile<'c, 'hugr: 'c>( args: &CompileArgs, ctx: &'c Context, hugr: &'hugr mut Hugr, + emit_debug: bool, ) -> Result> { event!(Level::DEBUG, "starting primary compilation"); let namer = Rc::new(Namer::new("__hugr__.", true)); @@ -328,9 +351,15 @@ fn compile<'c, 'hugr: 'c>( let module_entry = args.entry.as_ref().map_or(LLVM_MAIN, |x| x.as_ref()); // Create a new LLVM module using hugr-llvm - let module = get_module_with_std_exts(args, ctx, namer, hugr)?; + let (module, mut maybe_di_ctx) = get_module_with_std_exts(args, ctx, namer, hugr, emit_debug)?; - wrap_main(ctx, &module, &hugr_entry, module_entry)?; + wrap_main( + ctx, + &module, + &hugr_entry, + module_entry, + maybe_di_ctx.as_mut(), + )?; let (data_layout, triple) = { ( @@ -354,7 +383,12 @@ fn compile<'c, 'hugr: 'c>( .add_global_metadata(key, &node) .map_err(ProcessErrs::from); } + + if let Some(di_ctx) = maybe_di_ctx.take() { + di_ctx.finish(); + } module.verify().map_err(Into::::into)?; + Ok(module) } @@ -436,11 +470,12 @@ mod selene_hugr_qis_compiler { /// Compile HUGR package to LLVM IR string #[pyfunction] - #[pyo3(signature = (pkg_bytes, opt_level=2, target_triple="native"))] + #[pyo3(signature = (pkg_bytes, opt_level=2, target_triple="native", emit_debug=false))] pub fn compile_to_llvm_ir( pkg_bytes: &[u8], opt_level: u32, target_triple: &str, + emit_debug: bool, ) -> PyResult { let opt = get_opt_level(opt_level)?; let target_machine = if target_triple == "native" { @@ -454,17 +489,19 @@ mod selene_hugr_qis_compiler { &CompileArgs::new(&"hugr", &target_machine, opt), &ctx, &mut hugr, + emit_debug, )?; Ok(llvm_module.to_string()) } /// Compile HUGR package to LLVM bitcode #[pyfunction] - #[pyo3(signature = (pkg_bytes, opt_level=2, target_triple="native"))] + #[pyo3(signature = (pkg_bytes, opt_level=2, target_triple="native", emit_debug=false))] pub fn compile_to_bitcode( pkg_bytes: &[u8], opt_level: u32, target_triple: &str, + emit_debug: bool, ) -> PyResult> { let opt = get_opt_level(opt_level)?; let target_machine = if target_triple == "native" { @@ -478,6 +515,7 @@ mod selene_hugr_qis_compiler { &CompileArgs::new(&"hugr", &target_machine, opt), &ctx, &mut hugr, + emit_debug, )?; Ok(llvm_module.write_bitcode_to_memory().as_slice().to_vec()) } 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 index 0ff4f43aa..07d4c8629 100644 --- 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 @@ -8,29 +8,29 @@ 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) { +define internal i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) !dbg !3 { 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) + %gpu_input_blob = alloca [25 x i8], align 1, !dbg !10 + %dest_ptr = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 0, !dbg !10 + %arg_i64_tmp = alloca i64, align 8, !dbg !10 + store i64 %2, ptr %arg_i64_tmp, align 4, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr, ptr align 1 %arg_i64_tmp, i64 8, i1 false), !dbg !10 + %dest_ptr7 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 8, !dbg !10 + %arg_i64_tmp8 = alloca i64, align 8, !dbg !10 + store i64 %3, ptr %arg_i64_tmp8, align 4, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr7, ptr align 1 %arg_i64_tmp8, i64 8, i1 false), !dbg !10 + %dest_ptr9 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 16, !dbg !10 + %arg_f64_tmp = alloca double, align 8, !dbg !10 + store double %4, ptr %arg_f64_tmp, align 8, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr9, ptr align 1 %arg_f64_tmp, i64 8, i1 false), !dbg !10 + %dest_ptr10 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 24, !dbg !10 + %arg_i8 = zext i1 %5 to i8, !dbg !10 + store i8 %arg_i8, ptr %dest_ptr10, align 1, !dbg !10 + %6 = call i8 @gpu_call(i64 %0, i64 %1, i64 25, ptr %gpu_input_blob, ptr @arg_types), !dbg !10 + call void @validate_gpu_response(i8 %6), !dbg !10 ret i64 %0 } @@ -42,25 +42,25 @@ declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr no ; 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -71,3 +71,18 @@ declare void @panic_str(i32, ptr) #2 attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #1 = { noinline } attributes #2 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7, !7, !7, !8, !9} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap index fd16e5f37..0df0cedc0 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_float.snap @@ -8,14 +8,14 @@ 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 internal i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %gpu_input_blob = alloca [0 x i8], align 1 - %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) + %gpu_input_blob = alloca [0 x i8], align 1, !dbg !8 + %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, ptr %gpu_input_blob, ptr @arg_types), !dbg !8 + call void @validate_gpu_response(i8 %2), !dbg !8 ret i64 %0 } @@ -24,25 +24,25 @@ declare i8 @gpu_call(i64, i64, i64, ptr, 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -52,3 +52,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap index 7ce1e98ad..f5e3cb78c 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_call_ret_int.snap @@ -8,14 +8,14 @@ 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 internal i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %gpu_input_blob = alloca [0 x i8], align 1 - %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) + %gpu_input_blob = alloca [0 x i8], align 1, !dbg !8 + %2 = call i8 @gpu_call(i64 %0, i64 %1, i64 0, ptr %gpu_input_blob, ptr @arg_types), !dbg !8 + call void @validate_gpu_response(i8 %2), !dbg !8 ret i64 %0 } @@ -24,25 +24,25 @@ declare i8 @gpu_call(i64, i64, i64, ptr, 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -52,3 +52,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap index 25efa7d01..9409eb2aa 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_dispose_context.snap @@ -7,13 +7,13 @@ source_filename = "test_context" @no_gpu_error = private unnamed_addr constant [27 x i8] c"No error message available\00", align 1 -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %1 = call i8 @gpu_discard(i64 %0) - call void @validate_gpu_response(i8 %1) + %1 = call i8 @gpu_discard(i64 %0), !dbg !8 + call void @validate_gpu_response(i8 %1), !dbg !8 ret void } @@ -22,25 +22,25 @@ declare i8 @gpu_discard(i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -50,3 +50,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap index 7398e3bdf..9219f54aa 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_get_context.snap @@ -8,35 +8,35 @@ 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 internal { i1, i64 } @_hl.main.1(i64 %0) { +define internal { i1, i64 } @_hl.main.1(i64 %0) !dbg !3 { 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, ptr %gpu_ref_ptr) - call void @validate_gpu_response(i8 %gpu_ref_call) - %gpu_ref = load i64, ptr %gpu_ref_ptr, align 4 - %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %gpu_ref, 1 + call void @run_gpu_validation(), !dbg !11 + %gpu_ref_ptr = alloca i64, align 8, !dbg !11 + %gpu_ref_call = call i8 @gpu_init(i64 %0, ptr %gpu_ref_ptr), !dbg !11 + call void @validate_gpu_response(i8 %gpu_ref_call), !dbg !11 + %gpu_ref = load i64, ptr %gpu_ref_ptr, align 4, !dbg !11 + %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %gpu_ref, 1, !dbg !11 ret { i1, i64 } %1 } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, ptr @gpu_validated, align 1 - %already_validated = icmp ne i8 %validated, 0 - br i1 %already_validated, label %done, label %validate + %validated = load i8, ptr @gpu_validated, align 1, !dbg !11 + %already_validated = icmp ne i8 %validated, 0, !dbg !11 + br i1 %already_validated, label %done, label %validate, !dbg !11 done: ; preds = %entry - ret void + ret void, !dbg !11 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, ptr @gpu_validated, align 1 - ret void + %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0), !dbg !11 + call void @validate_gpu_response(i8 %validate_call), !dbg !11 + store i8 1, ptr @gpu_validated, align 1, !dbg !11 + ret void, !dbg !11 } declare i8 @gpu_validate_api(i64, i64, i64) @@ -44,25 +44,25 @@ declare i8 @gpu_validate_api(i64, i64, i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !11 + br i1 %success, label %ok, label %err, !dbg !11 ok: ; preds = %entry - ret void + ret void, !dbg !11 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !11 + unreachable, !dbg !11 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !11 + %is_null = icmp eq ptr %error_message, null, !dbg !11 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !11 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !11 + unreachable, !dbg !11 } declare ptr @gpu_get_error() @@ -74,3 +74,19 @@ declare i8 @gpu_init(i64, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap index 16374dfb8..f3f8932be 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_id.snap @@ -5,10 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block ret i64 42 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !9) +!9 = !{} diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap index 0f69bb55d..04b81d13c 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_lookup_by_name.snap @@ -11,52 +11,52 @@ 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 internal i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %function_id_call = call i64 @gpu_function_id_example_function() + %function_id_call = call i64 @gpu_function_id_example_function(), !dbg !10 ret i64 %function_id_call } ; Function Attrs: noinline define i64 @gpu_function_id_example_function() #0 { entry: - %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 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_example_function, align 1, !dbg !10 + %needs_lookup = icmp eq i8 %function_id, 0, !dbg !10 + br i1 %needs_lookup, label %lookup, label %read_cache, !dbg !10 lookup: ; preds = %entry - call void @run_gpu_validation() - %function_id_ptr = alloca i64, align 8 - %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, 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 + call void @run_gpu_validation(), !dbg !10 + %function_id_ptr = alloca i64, align 8, !dbg !10 + %function_id_call = call i8 @gpu_get_function_id(ptr @function_name, ptr %function_id_ptr), !dbg !10 + call void @validate_gpu_response(i8 %function_id_call), !dbg !10 + %function_id2 = load i64, ptr %function_id_ptr, align 4, !dbg !10 + store i64 %function_id2, ptr @gpu_cache_function_id_example_function, align 4, !dbg !10 + store i8 1, ptr @gpu_cache_is_set_function_id_example_function, align 1, !dbg !10 + ret i64 %function_id2, !dbg !10 read_cache: ; preds = %entry - %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4 - ret i64 %function_id1 + %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4, !dbg !10 + ret i64 %function_id1, !dbg !10 } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, ptr @gpu_validated, align 1 - %already_validated = icmp ne i8 %validated, 0 - br i1 %already_validated, label %done, label %validate + %validated = load i8, ptr @gpu_validated, align 1, !dbg !10 + %already_validated = icmp ne i8 %validated, 0, !dbg !10 + br i1 %already_validated, label %done, label %validate, !dbg !10 done: ; preds = %entry - ret void + ret void, !dbg !10 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, ptr @gpu_validated, align 1 - ret void + %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0), !dbg !10 + call void @validate_gpu_response(i8 %validate_call), !dbg !10 + store i8 1, ptr @gpu_validated, align 1, !dbg !10 + ret void, !dbg !10 } declare i8 @gpu_validate_api(i64, i64, i64) @@ -64,25 +64,25 @@ declare i8 @gpu_validate_api(i64, i64, i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -94,3 +94,18 @@ declare i8 @gpu_get_function_id(ptr, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !9) +!9 = !{} +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap index 48745fbc6..7bf2f4c3b 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_float.snap @@ -7,15 +7,15 @@ 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) { +define internal { i64, double } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %int_result = alloca i64, align 8 - %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result) - call void @validate_gpu_response(i8 %read_status) - %result = load double, ptr %int_result, align 8 + %int_result = alloca i64, align 8, !dbg !11 + %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result), !dbg !11 + call void @validate_gpu_response(i8 %read_status), !dbg !11 + %result = load double, ptr %int_result, align 8, !dbg !11 %mrv = insertvalue { i64, double } poison, i64 %0, 0 %mrv6 = insertvalue { i64, double } %mrv, double %result, 1 ret { i64, double } %mrv6 @@ -26,25 +26,25 @@ 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 + %success = icmp ne i8 %0, 0, !dbg !11 + br i1 %success, label %ok, label %err, !dbg !11 ok: ; preds = %entry - ret void + ret void, !dbg !11 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !11 + unreachable, !dbg !11 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !11 + %is_null = icmp eq ptr %error_message, null, !dbg !11 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !11 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !11 + unreachable, !dbg !11 } declare ptr @gpu_get_error() @@ -54,3 +54,19 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, double }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap index 6d22a6ce3..ac3ac4e70 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@llvm21_read_result_int.snap @@ -7,15 +7,15 @@ 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) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %int_result = alloca i64, align 8 - %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result) - call void @validate_gpu_response(i8 %read_status) - %result = load i64, ptr %int_result, align 4 + %int_result = alloca i64, align 8, !dbg !10 + %read_status = call i8 @gpu_get_result(i64 %0, i64 8, ptr %int_result), !dbg !10 + call void @validate_gpu_response(i8 %read_status), !dbg !10 + %result = load i64, ptr %int_result, align 4, !dbg !10 %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %result, 1 ret { i64, i64 } %mrv6 @@ -26,25 +26,25 @@ 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -54,3 +54,18 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 468dcebaf..4a313411c 100644 --- 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 @@ -8,7 +8,7 @@ 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) { +define internal i64 @_hl.main.1(i64 %0, i64 %1, i64 %2, i64 %3, double %4, i1 %5) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -33,25 +33,25 @@ entry_block: ; preds = %alloca_block %"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 + %gpu_input_blob = alloca [25 x i8], align 1, !dbg !10 + %dest_ptr = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 0, !dbg !10 + %arg_i64_tmp = alloca i64, align 8, !dbg !10 + store i64 %"2_23", ptr %arg_i64_tmp, align 4, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr, ptr align 1 %arg_i64_tmp, i64 8, i1 false), !dbg !10 + %dest_ptr7 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 8, !dbg !10 + %arg_i64_tmp8 = alloca i64, align 8, !dbg !10 + store i64 %"2_34", ptr %arg_i64_tmp8, align 4, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr7, ptr align 1 %arg_i64_tmp8, i64 8, i1 false), !dbg !10 + %dest_ptr9 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 16, !dbg !10 + %arg_f64_tmp = alloca double, align 8, !dbg !10 + store double %"2_45", ptr %arg_f64_tmp, align 8, !dbg !10 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dest_ptr9, ptr align 1 %arg_f64_tmp, i64 8, i1 false), !dbg !10 + %dest_ptr10 = getelementptr inbounds [25 x i8], ptr %gpu_input_blob, i64 0, i64 24, !dbg !10 + %arg_i8 = zext i1 %"2_56" to i8, !dbg !10 + store i8 %arg_i8, ptr %dest_ptr10, align 1, !dbg !10 + %6 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 25, ptr %gpu_input_blob, ptr @arg_types), !dbg !10 + call void @validate_gpu_response(i8 %6), !dbg !10 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !10 %"4_011" = load i64, ptr %"4_0", align 4 store i64 %"4_011", ptr %"0", align 4 %"012" = load i64, ptr %"0", align 4 @@ -66,25 +66,25 @@ declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr no ; 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -95,3 +95,18 @@ declare void @panic_str(i32, ptr) #2 attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #1 = { noinline } attributes #2 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7, !7, !7, !8, !9} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_float.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_float.snap index b7607bcd1..d021a8898 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -21,10 +21,10 @@ entry_block: ; preds = %alloca_block 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 - %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", ptr %"4_0", align 4 + %gpu_input_blob = alloca [0 x i8], align 1, !dbg !8 + %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, ptr %gpu_input_blob, ptr @arg_types), !dbg !8 + call void @validate_gpu_response(i8 %2), !dbg !8 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !8 %"4_03" = load i64, ptr %"4_0", align 4 store i64 %"4_03", ptr %"0", align 4 %"04" = load i64, ptr %"0", align 4 @@ -36,25 +36,25 @@ declare i8 @gpu_call(i64, i64, i64, ptr, 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -64,3 +64,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_int.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_call_ret_int.snap index 887dcc397..34f33a192 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0, i64 %1) { +define internal i64 @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -21,10 +21,10 @@ entry_block: ; preds = %alloca_block 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 - %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", ptr %"4_0", align 4 + %gpu_input_blob = alloca [0 x i8], align 1, !dbg !8 + %2 = call i8 @gpu_call(i64 %"2_01", i64 %"2_12", i64 0, ptr %gpu_input_blob, ptr @arg_types), !dbg !8 + call void @validate_gpu_response(i8 %2), !dbg !8 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !8 %"4_03" = load i64, ptr %"4_0", align 4 store i64 %"4_03", ptr %"0", align 4 %"04" = load i64, ptr %"0", align 4 @@ -36,25 +36,25 @@ declare i8 @gpu_call(i64, i64, i64, ptr, 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -64,3 +64,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap index 493e89095..aee603f06 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_dispose_context.snap +++ b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@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 internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -15,8 +15,8 @@ alloca_block: entry_block: ; preds = %alloca_block 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) + %1 = call i8 @gpu_discard(i64 %"2_01"), !dbg !8 + call void @validate_gpu_response(i8 %1), !dbg !8 ret void } @@ -25,25 +25,25 @@ declare i8 @gpu_discard(i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !8 + br i1 %success, label %ok, label %err, !dbg !8 ok: ; preds = %entry - ret void + ret void, !dbg !8 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !8 + unreachable, !dbg !8 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !8 + %is_null = icmp eq ptr %error_message, null, !dbg !8 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !8 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !8 + unreachable, !dbg !8 } declare ptr @gpu_get_error() @@ -53,3 +53,16 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_get_context.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_get_context.snap index 246127c30..ae3f81700 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_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 internal { i1, i64 } @_hl.main.1(i64 %0) { +define internal { i1, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca { i1, i64 }, align 8 %"2_0" = alloca i64, align 8 @@ -18,13 +18,13 @@ alloca_block: entry_block: ; preds = %alloca_block 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", ptr %gpu_ref_ptr) - call void @validate_gpu_response(i8 %gpu_ref_call) - %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, ptr %"4_0", align 4 + call void @run_gpu_validation(), !dbg !11 + %gpu_ref_ptr = alloca i64, align 8, !dbg !11 + %gpu_ref_call = call i8 @gpu_init(i64 %"2_01", ptr %gpu_ref_ptr), !dbg !11 + call void @validate_gpu_response(i8 %gpu_ref_call), !dbg !11 + %gpu_ref = load i64, ptr %gpu_ref_ptr, align 4, !dbg !11 + %1 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %gpu_ref, 1, !dbg !11 + store { i1, i64 } %1, ptr %"4_0", align 4, !dbg !11 %"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 @@ -34,18 +34,18 @@ entry_block: ; preds = %alloca_block ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, ptr @gpu_validated, align 1 - %already_validated = icmp ne i8 %validated, 0 - br i1 %already_validated, label %done, label %validate + %validated = load i8, ptr @gpu_validated, align 1, !dbg !11 + %already_validated = icmp ne i8 %validated, 0, !dbg !11 + br i1 %already_validated, label %done, label %validate, !dbg !11 done: ; preds = %entry - ret void + ret void, !dbg !11 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, ptr @gpu_validated, align 1 - ret void + %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0), !dbg !11 + call void @validate_gpu_response(i8 %validate_call), !dbg !11 + store i8 1, ptr @gpu_validated, align 1, !dbg !11 + ret void, !dbg !11 } declare i8 @gpu_validate_api(i64, i64, i64) @@ -53,25 +53,25 @@ declare i8 @gpu_validate_api(i64, i64, i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !11 + br i1 %success, label %ok, label %err, !dbg !11 ok: ; preds = %entry - ret void + ret void, !dbg !11 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !11 + unreachable, !dbg !11 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !11 + %is_null = icmp eq ptr %error_message, null, !dbg !11 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !11 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !11 + unreachable, !dbg !11 } declare ptr @gpu_get_error() @@ -83,3 +83,19 @@ declare i8 @gpu_init(i64, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.snap index 6404ffa44..caa0b7690 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_id.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 internal i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca {}, align 8 @@ -15,9 +15,24 @@ alloca_block: entry_block: ; preds = %alloca_block store {} %0, ptr %"2_0", align 1 %"2_01" = load {}, ptr %"2_0", align 1 - store i64 42, ptr %"4_0", align 4 + store i64 42, ptr %"4_0", align 4, !dbg !10 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !9) +!9 = !{} +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_name.snap b/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_lookup_by_name.snap index 4eeaf454f..c698cb70b 100644 --- a/qis-compiler/rust/snapshots/selene_hugr_qis_compiler__gpu__test__gpu_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1({} %0) { +define internal i64 @_hl.main.1({} %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca {}, align 8 @@ -21,8 +21,8 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 4 + %function_id_call = call i64 @gpu_function_id_example_function(), !dbg !10 + store i64 %function_id_call, ptr %"4_0", align 4, !dbg !10 %"4_02" = load i64, ptr %"4_0", align 4 store i64 %"4_02", ptr %"0", align 4 %"03" = load i64, ptr %"0", align 4 @@ -32,40 +32,40 @@ entry_block: ; preds = %alloca_block ; Function Attrs: noinline define i64 @gpu_function_id_example_function() #0 { entry: - %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 + %function_id = load i8, ptr @gpu_cache_is_set_function_id_example_function, align 1, !dbg !10 + %needs_lookup = icmp eq i8 %function_id, 0, !dbg !10 + br i1 %needs_lookup, label %lookup, label %read_cache, !dbg !10 lookup: ; preds = %entry - call void @run_gpu_validation() - %function_id_ptr = alloca i64, align 8 - %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, 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 + call void @run_gpu_validation(), !dbg !10 + %function_id_ptr = alloca i64, align 8, !dbg !10 + %function_id_call = call i8 @gpu_get_function_id(ptr @function_name, ptr %function_id_ptr), !dbg !10 + call void @validate_gpu_response(i8 %function_id_call), !dbg !10 + %function_id2 = load i64, ptr %function_id_ptr, align 4, !dbg !10 + store i64 %function_id2, ptr @gpu_cache_function_id_example_function, align 4, !dbg !10 + store i8 1, ptr @gpu_cache_is_set_function_id_example_function, align 1, !dbg !10 + ret i64 %function_id2, !dbg !10 read_cache: ; preds = %entry - %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4 - ret i64 %function_id1 + %function_id1 = load i64, ptr @gpu_cache_function_id_example_function, align 4, !dbg !10 + ret i64 %function_id1, !dbg !10 } ; Function Attrs: noinline define void @run_gpu_validation() #0 { entry: - %validated = load i8, ptr @gpu_validated, align 1 - %already_validated = icmp ne i8 %validated, 0 - br i1 %already_validated, label %done, label %validate + %validated = load i8, ptr @gpu_validated, align 1, !dbg !10 + %already_validated = icmp ne i8 %validated, 0, !dbg !10 + br i1 %already_validated, label %done, label %validate, !dbg !10 done: ; preds = %entry - ret void + ret void, !dbg !10 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, ptr @gpu_validated, align 1 - ret void + %validate_call = call i8 @gpu_validate_api(i64 0, i64 1, i64 0), !dbg !10 + call void @validate_gpu_response(i8 %validate_call), !dbg !10 + store i8 1, ptr @gpu_validated, align 1, !dbg !10 + ret void, !dbg !10 } declare i8 @gpu_validate_api(i64, i64, i64) @@ -73,25 +73,25 @@ declare i8 @gpu_validate_api(i64, i64, i64) ; 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -103,3 +103,18 @@ declare i8 @gpu_get_function_id(ptr, ptr) attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !9) +!9 = !{} +!10 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 54c895b5a..c8c45f682 100644 --- 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 @@ -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 internal { i64, double } @_hl.main.1(i64 %0) { +define internal { i64, double } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca double, align 8 @@ -19,12 +19,12 @@ alloca_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 + %int_result = alloca i64, align 8, !dbg !11 + %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, ptr %int_result), !dbg !11 + call void @validate_gpu_response(i8 %read_status), !dbg !11 + %result = load double, ptr %int_result, align 8, !dbg !11 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !11 + store double %result, ptr %"4_1", align 8, !dbg !11 %"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 @@ -41,25 +41,25 @@ 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 + %success = icmp ne i8 %0, 0, !dbg !11 + br i1 %success, label %ok, label %err, !dbg !11 ok: ; preds = %entry - ret void + ret void, !dbg !11 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !11 + unreachable, !dbg !11 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !11 + %is_null = icmp eq ptr %error_message, null, !dbg !11 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !11 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !11 + unreachable, !dbg !11 } declare ptr @gpu_get_error() @@ -69,3 +69,19 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, double }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 1583dfee4..b9bb0c730 100644 --- 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 @@ -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 internal { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -19,12 +19,12 @@ alloca_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 + %int_result = alloca i64, align 8, !dbg !10 + %read_status = call i8 @gpu_get_result(i64 %"2_01", i64 8, ptr %int_result), !dbg !10 + call void @validate_gpu_response(i8 %read_status), !dbg !10 + %result = load i64, ptr %int_result, align 4, !dbg !10 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !10 + store i64 %result, ptr %"4_1", align 4, !dbg !10 %"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 @@ -41,25 +41,25 @@ 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 + %success = icmp ne i8 %0, 0, !dbg !10 + br i1 %success, label %ok, label %err, !dbg !10 ok: ; preds = %entry - ret void + ret void, !dbg !10 err: ; preds = %entry - call void @gpu_error_handler() - unreachable + call void @gpu_error_handler(), !dbg !10 + unreachable, !dbg !10 } ; 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 + %error_message = call ptr @gpu_get_error(), !dbg !10 + %is_null = icmp eq ptr %error_message, null, !dbg !10 + %error_message_nonnull = select i1 %is_null, ptr @no_gpu_error, ptr %error_message, !dbg !10 + call void @panic_str(i32 70002, ptr %error_message_nonnull), !dbg !10 + unreachable, !dbg !10 } declare ptr @gpu_get_error() @@ -69,3 +69,18 @@ declare void @panic_str(i32, ptr) #1 attributes #0 = { noinline } attributes #1 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/debug.rs b/tket-qsystem/src/llvm/debug.rs index ac4823ec3..5cd992ba7 100644 --- a/tket-qsystem/src/llvm/debug.rs +++ b/tket-qsystem/src/llvm/debug.rs @@ -139,7 +139,7 @@ mod test { .add_float_extensions() }); let ext_op = op.to_extension_op().unwrap().into(); - let hugr = single_op_hugr(ext_op); + let mut hugr = single_op_hugr(ext_op); check_emission!(hugr, llvm_ctx); } } diff --git a/tket-qsystem/src/llvm/futures.rs b/tket-qsystem/src/llvm/futures.rs index 993f744b9..85cab3bd2 100644 --- a/tket-qsystem/src/llvm/futures.rs +++ b/tket-qsystem/src/llvm/futures.rs @@ -211,7 +211,7 @@ mod test { ceb.add_extension(FuturesCodegenExtension) .add_default_int_extensions() }); - let hugr = single_op_hugr(op.to_extension_op().unwrap().into()); + let mut hugr = single_op_hugr(op.to_extension_op().unwrap().into()); check_emission!(hugr, llvm_ctx); } } diff --git a/tket-qsystem/src/llvm/prelude.rs b/tket-qsystem/src/llvm/prelude.rs index c0763741c..379ecc93c 100644 --- a/tket-qsystem/src/llvm/prelude.rs +++ b/tket-qsystem/src/llvm/prelude.rs @@ -227,7 +227,7 @@ mod test { .instantiate_extension_op(&PANIC_OP_ID, [type_arg_2q.clone(), type_arg_2q.clone()]) .unwrap(); - let hugr = SimpleHugrConfig::new() + let mut hugr = SimpleHugrConfig::new() .with_ins(vec![qb_t(), qb_t()]) .with_outs(vec![qb_t(), qb_t()]) .with_extensions(prelude::PRELUDE_REGISTRY.to_owned()) @@ -257,7 +257,7 @@ mod test { .instantiate_extension_op(&EXIT_OP_ID, [type_arg_2q.clone(), type_arg_2q.clone()]) .unwrap(); - let hugr = SimpleHugrConfig::new() + let mut hugr = SimpleHugrConfig::new() .with_ins(vec![qb_t(), qb_t()]) .with_outs(vec![qb_t(), qb_t()]) .with_extensions(prelude::PRELUDE_REGISTRY.to_owned()) diff --git a/tket-qsystem/src/llvm/random.rs b/tket-qsystem/src/llvm/random.rs index 133c09d35..10d976337 100644 --- a/tket-qsystem/src/llvm/random.rs +++ b/tket-qsystem/src/llvm/random.rs @@ -183,7 +183,7 @@ mod test { .add_logic_extensions() }); let ext_op = op.to_extension_op().unwrap().into(); - let hugr = single_op_hugr(ext_op); + let mut hugr = single_op_hugr(ext_op); check_emission!(hugr, llvm_ctx); } } diff --git a/tket-qsystem/src/llvm/result.rs b/tket-qsystem/src/llvm/result.rs index 3d85323ee..7727ad746 100644 --- a/tket-qsystem/src/llvm/result.rs +++ b/tket-qsystem/src/llvm/result.rs @@ -332,7 +332,7 @@ mod test { .add_float_extensions() }); let ext_op = op.to_extension_op().unwrap().into(); - let hugr = single_op_hugr(ext_op); + let mut hugr = single_op_hugr(ext_op); check_emission!(hugr, llvm_ctx); } } 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 index 94ba83daa..7346e4787 100644 --- 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 @@ -7,30 +7,46 @@ 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) { +define internal { ptr, i64 } @_hl.main.1({ ptr, i64 } %0) !dbg !3 { 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) + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %0, 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %0, 1, !dbg !11 + %1 = getelementptr inbounds [2 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 2, align 1, !dbg !11 + store [2 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 2, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret { ptr, i64 } %0 } declare void @print_state_result(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index ad0c265b3..b05493169 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal { ptr, i64 } @_hl.main.1({ ptr, i64 } %0) !dbg !3 { alloca_block: %"0" = alloca { ptr, i64 }, align 8 %"2_0" = alloca { ptr, i64 }, align 8 @@ -17,25 +17,25 @@ alloca_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 + %tag_len = load i8, ptr @res_test_state.900F7606.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1, !dbg !11 + %1 = getelementptr inbounds [2 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 2, align 1, !dbg !11 + store [2 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 2, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_state_result(ptr @res_test_state.900F7606.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 + store { ptr, i64 } %"2_01", ptr %"4_0", align 8, !dbg !11 %"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 @@ -43,3 +43,19 @@ entry_block: ; preds = %alloca_block } declare void @print_state_result(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap index 03ded3943..7b458aa5f 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_1.snap @@ -5,17 +5,31 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %read_bool = call i1 @___read_future_bool(i64 %0) - call void @___dec_future_refcount(i64 %0) - %measure = select i1 %read_bool, i1 true, i1 false + %read_bool = call i1 @___read_future_bool(i64 %0), !dbg !9 + call void @___dec_future_refcount(i64 %0), !dbg !9 + %measure = select i1 %read_bool, i1 true, i1 false, !dbg !9 ret i1 %measure } declare i1 @___read_future_bool(i64) declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap index 9437cd92a..18a720983 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_2.snap @@ -5,15 +5,30 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___inc_future_refcount(i64 %0) + call void @___inc_future_refcount(i64 %0), !dbg !10 %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %0, 1 ret { i64, i64 } %mrv6 } declare void @___inc_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap index 1dc8154d9..6ab3a80cd 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_3.snap @@ -5,13 +5,26 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___dec_future_refcount(i64 %0) + call void @___dec_future_refcount(i64 %0), !dbg !8 ret void } declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap index 3dd7fa44c..fc6e4ec7a 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_4.snap @@ -5,16 +5,29 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %read_uint = call i64 @___read_future_uint(i64 %0) - call void @___dec_future_refcount(i64 %0) + %read_uint = call i64 @___read_future_uint(i64 %0), !dbg !8 + call void @___dec_future_refcount(i64 %0), !dbg !8 ret i64 %read_uint } declare i64 @___read_future_uint(i64) declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap index 9437cd92a..18a720983 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_5.snap @@ -5,15 +5,30 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___inc_future_refcount(i64 %0) + call void @___inc_future_refcount(i64 %0), !dbg !10 %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv6 = insertvalue { i64, i64 } %mrv, i64 %0, 1 ret { i64, i64 } %mrv6 } declare void @___inc_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap index 1dc8154d9..6ab3a80cd 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@llvm21_6.snap @@ -5,13 +5,26 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___dec_future_refcount(i64 %0) + call void @___dec_future_refcount(i64 %0), !dbg !8 ret void } declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_1.snap index 36db9fe95..4e60fbccf 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i64, align 8 @@ -15,10 +15,10 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %read_bool = call i1 @___read_future_bool(i64 %"2_01"), !dbg !9 + call void @___dec_future_refcount(i64 %"2_01"), !dbg !9 + %measure = select i1 %read_bool, i1 true, i1 false, !dbg !9 + store i1 %measure, ptr %"4_0", align 1, !dbg !9 %"4_02" = load i1, ptr %"4_0", align 1 store i1 %"4_02", ptr %"0", align 1 %"03" = load i1, ptr %"0", align 1 @@ -28,3 +28,17 @@ entry_block: ; preds = %alloca_block declare i1 @___read_future_bool(i64) declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_2.snap index 4e69ebda0..26fb8d770 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_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 internal { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -17,9 +17,9 @@ alloca_block: entry_block: ; preds = %alloca_block 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", ptr %"4_0", align 4 - store i64 %"2_01", ptr %"4_1", align 4 + call void @___inc_future_refcount(i64 %"2_01"), !dbg !10 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !10 + store i64 %"2_01", ptr %"4_1", align 4, !dbg !10 %"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 @@ -32,3 +32,18 @@ entry_block: ; preds = %alloca_block } declare void @___inc_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap index ffc5672d6..7b0d3fa7e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_3.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -13,8 +13,21 @@ alloca_block: entry_block: ; preds = %alloca_block 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") + call void @___dec_future_refcount(i64 %"2_01"), !dbg !8 ret void } declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_4.snap index bf61f0507..c99874439 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -15,9 +15,9 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 4 + %read_uint = call i64 @___read_future_uint(i64 %"2_01"), !dbg !8 + call void @___dec_future_refcount(i64 %"2_01"), !dbg !8 + store i64 %read_uint, ptr %"4_0", align 4, !dbg !8 %"4_02" = load i64, ptr %"4_0", align 4 store i64 %"4_02", ptr %"0", align 4 %"03" = load i64, ptr %"0", align 4 @@ -27,3 +27,16 @@ entry_block: ; preds = %alloca_block declare i64 @___read_future_uint(i64) declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_5.snap index 4e69ebda0..26fb8d770 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_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 internal { i64, i64 } @_hl.main.1(i64 %0) { +define internal { i64, i64 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -17,9 +17,9 @@ alloca_block: entry_block: ; preds = %alloca_block 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", ptr %"4_0", align 4 - store i64 %"2_01", ptr %"4_1", align 4 + call void @___inc_future_refcount(i64 %"2_01"), !dbg !10 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !10 + store i64 %"2_01", ptr %"4_1", align 4, !dbg !10 %"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 @@ -32,3 +32,18 @@ entry_block: ; preds = %alloca_block } declare void @___inc_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap index ffc5672d6..7b0d3fa7e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__futures__test__emit_futures_codegen@pre-mem2reg@llvm21_6.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -13,8 +13,21 @@ alloca_block: entry_block: ; preds = %alloca_block 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") + call void @___dec_future_refcount(i64 %"2_01"), !dbg !8 ret void } declare void @___dec_future_refcount(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap index 5e06ce453..f3cd4a3be 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__exit_emit@llvm21_0.snap @@ -7,14 +7,14 @@ 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) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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) + %2 = extractvalue { i32, ptr } { i32 42, ptr @e_EXIT.2B78BC40.0 }, 0, !dbg !10 + %3 = extractvalue { i32, ptr } { i32 42, ptr @e_EXIT.2B78BC40.0 }, 1, !dbg !10 + call void @panic(i32 %2, ptr %3), !dbg !10 %mrv = insertvalue { i64, i64 } poison, i64 0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 0, 1 ret { i64, i64 } %mrv8 @@ -24,3 +24,18 @@ entry_block: ; preds = %alloca_block declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 331738b28..f8402532e 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -25,11 +25,11 @@ entry_block: ; preds = %alloca_block %"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 + %2 = extractvalue { i32, ptr } %"5_01", 0, !dbg !10 + %3 = extractvalue { i32, ptr } %"5_01", 1, !dbg !10 + call void @panic(i32 %2, ptr %3), !dbg !10 + store i64 0, ptr %"6_0", align 4, !dbg !10 + store i64 0, ptr %"6_1", align 4, !dbg !10 %"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 @@ -45,3 +45,18 @@ entry_block: ; preds = %alloca_block declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap index 4c5fd6ab0..fc0f22bfc 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__prelude__test__panic_emit@llvm21_0.snap @@ -7,15 +7,15 @@ 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) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 0 - %shift_code = add i32 %2, 1000 - %3 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 1 - call void @panic(i32 %shift_code, ptr %3) + %2 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 0, !dbg !10 + %shift_code = add i32 %2, 1000, !dbg !10 + %3 = extractvalue { i32, ptr } { i32 42, ptr @e_PANIC.DF25FD88.0 }, 1, !dbg !10 + call void @panic(i32 %shift_code, ptr %3), !dbg !10 %mrv = insertvalue { i64, i64 } poison, i64 0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 0, 1 ret { i64, i64 } %mrv8 @@ -25,3 +25,18 @@ entry_block: ; preds = %alloca_block declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 698d37033..56260ebd8 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -25,12 +25,12 @@ entry_block: ; preds = %alloca_block %"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 + %2 = extractvalue { i32, ptr } %"5_01", 0, !dbg !10 + %shift_code = add i32 %2, 1000, !dbg !10 + %3 = extractvalue { i32, ptr } %"5_01", 1, !dbg !10 + call void @panic(i32 %shift_code, ptr %3), !dbg !10 + store i64 0, ptr %"6_0", align 4, !dbg !10 + store i64 0, ptr %"6_1", align 4, !dbg !10 %"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 @@ -46,3 +46,18 @@ entry_block: ; preds = %alloca_block declare void @panic(i32, ptr) #0 attributes #0 = { noreturn } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap index e9ff3cb50..ee7cf84ea 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_1.snap @@ -5,13 +5,27 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0, double %1) { +define internal i64 @_hl.main.1(i64 %0, double %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___rz(i64 %0, double %1) + call void @___rz(i64 %0, double %1), !dbg !9 ret i64 %0 } declare void @___rz(i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap index d134bfc1c..9465e5103 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_10.snap @@ -5,16 +5,29 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %lazy_measure_leaked = call i64 @___lazy_measure_leaked(i64 %0) - call void @___qfree(i64 %0) + %lazy_measure_leaked = call i64 @___lazy_measure_leaked(i64 %0), !dbg !8 + call void @___qfree(i64 %0), !dbg !8 ret i64 %lazy_measure_leaked } declare i64 @___lazy_measure_leaked(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap index a685d8d2e..9dc97dbc1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_2.snap @@ -5,15 +5,31 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___rzz(i64 %0, i64 %1, double %2) + call void @___rzz(i64 %0, i64 %1, double %2), !dbg !11 %mrv = insertvalue { i64, i64 } poison, i64 %0, 0 %mrv8 = insertvalue { i64, i64 } %mrv, i64 %1, 1 ret { i64, i64 } %mrv8 } declare void @___rzz(i64, i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap index a35d56a21..5acc325f2 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_3.snap @@ -5,13 +5,27 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0, double %1, double %2) { +define internal i64 @_hl.main.1(i64 %0, double %1, double %2) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___rxy(i64 %0, double %1, double %2) + call void @___rxy(i64 %0, double %1, double %2), !dbg !9 ret i64 %0 } declare void @___rxy(i64, double, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !8, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap index 56e998b93..c983b5d66 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_4.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i1, i64, i1 } @_hl.main.1(i64 %0) { +define internal { i1, i64, i1 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %lazy_measure = call i64 @___lazy_measure(i64 %0) - call void @___qfree(i64 %0) + %lazy_measure = call i64 @___lazy_measure(i64 %0), !dbg !11 + call void @___qfree(i64 %0), !dbg !11 %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure, 1 ret { i1, i64, i1 } %1 } @@ -19,3 +19,19 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64, i1 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10, !9} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap index 6790e71b0..1050125e5 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_5.snap @@ -5,16 +5,29 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %lazy_measure = call i64 @___lazy_measure(i64 %0) - call void @___qfree(i64 %0) + %lazy_measure = call i64 @___lazy_measure(i64 %0), !dbg !8 + call void @___qfree(i64 %0), !dbg !8 ret i64 %lazy_measure } declare i64 @___lazy_measure(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap index d3e065184..74b7860b9 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_6.snap @@ -5,25 +5,41 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i1, i64 } @_hl.main.1() { +define internal { i1, i64 } @_hl.main.1() !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %qalloc = call i64 @___qalloc() - %not_max = icmp ne i64 %qalloc, -1 - br i1 %not_max, label %reset_bb, label %id_bb + %qalloc = call i64 @___qalloc(), !dbg !11 + %not_max = icmp ne i64 %qalloc, -1, !dbg !11 + br i1 %not_max, label %reset_bb, label %id_bb, !dbg !11 reset_bb: ; preds = %entry_block - call void @___reset(i64 %qalloc) - br label %id_bb + call void @___reset(i64 %qalloc), !dbg !11 + br label %id_bb, !dbg !11 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 } + %0 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc, 1, !dbg !11 + %1 = select i1 %not_max, { i1, i64 } %0, { i1, i64 } { i1 false, i64 poison }, !dbg !11 ret { i1, i64 } %1 } declare i64 @___qalloc() declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap index 46476c4c3..ca56683e1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_7.snap @@ -5,13 +5,26 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___qfree(i64 %0) + call void @___qfree(i64 %0), !dbg !8 ret void } declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap index 3b781f3b2..a1f01863d 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_8.snap @@ -5,13 +5,26 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @___reset(i64 %0) + call void @___reset(i64 %0), !dbg !8 ret i64 %0 } declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap index 342767d90..52beaf24e 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@llvm21_9.snap @@ -5,13 +5,13 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { +define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %lazy_measure = call i64 @___lazy_measure(i64 %0) - call void @___reset(i64 %0) + %lazy_measure = call i64 @___lazy_measure(i64 %0), !dbg !13 + call void @___reset(i64 %0), !dbg !13 %1 = insertvalue { i1, i64, i1 } { i1 true, i64 poison, i1 poison }, i64 %lazy_measure, 1 %mrv = insertvalue { i64, { i1, i64, i1 } } poison, i64 %0, 0 %mrv10 = insertvalue { i64, { i1, i64, i1 } } %mrv, { i1, i64, i1 } %1, 1 @@ -21,3 +21,21 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure(i64) declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, { i1, i64, i1 } }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64, i1 }", file: !2, size: 8, align: 8, elements: !11) +!11 = !{!12, !9, !12} +!12 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!13 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_1.snap index 463842459..8b518ff49 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0, double %1) { +define internal i64 @_hl.main.1(i64 %0, double %1) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -18,8 +18,8 @@ entry_block: ; preds = %alloca_block 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", ptr %"4_0", align 4 + call void @___rz(i64 %"2_01", double %"2_12"), !dbg !9 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !9 %"4_03" = load i64, ptr %"4_0", align 4 store i64 %"4_03", ptr %"0", align 4 %"04" = load i64, ptr %"0", align 4 @@ -27,3 +27,17 @@ entry_block: ; preds = %alloca_block } declare void @___rz(i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_10.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_10.snap index 1cdeb521d..e1e647188 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -15,9 +15,9 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 4 + %lazy_measure_leaked = call i64 @___lazy_measure_leaked(i64 %"2_01"), !dbg !8 + call void @___qfree(i64 %"2_01"), !dbg !8 + store i64 %lazy_measure_leaked, ptr %"4_0", align 4, !dbg !8 %"4_02" = load i64, ptr %"4_0", align 4 store i64 %"4_02", ptr %"0", align 4 %"03" = load i64, ptr %"0", align 4 @@ -27,3 +27,16 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure_leaked(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index ad630f9b4..7930a7849 100644 --- 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 @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) { +define internal { i64, i64 } @_hl.main.1(i64 %0, i64 %1, double %2) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca i64, align 8 @@ -23,9 +23,9 @@ entry_block: ; preds = %alloca_block %"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 + call void @___rzz(i64 %"2_01", i64 %"2_12", double %"2_23"), !dbg !11 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !11 + store i64 %"2_12", ptr %"4_1", align 4, !dbg !11 %"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 @@ -38,3 +38,19 @@ entry_block: ; preds = %alloca_block } declare void @___rzz(i64, i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9, !9, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !9} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_3.snap index b62712490..48bfb5edb 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0, double %1, double %2) { +define internal i64 @_hl.main.1(i64 %0, double %1, double %2) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -21,8 +21,8 @@ entry_block: ; preds = %alloca_block %"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", ptr %"4_0", align 4 + call void @___rxy(i64 %"2_01", double %"2_12", double %"2_23"), !dbg !9 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !9 %"4_04" = load i64, ptr %"4_0", align 4 store i64 %"4_04", ptr %"0", align 4 %"05" = load i64, ptr %"0", align 4 @@ -30,3 +30,17 @@ entry_block: ; preds = %alloca_block } declare void @___rxy(i64, double, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !8, !8} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_4.snap index 7b72c61b4..77e9e41c1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal { i1, i64, i1 } @_hl.main.1(i64 %0) { +define internal { i1, i64, i1 } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca { i1, i64, i1 }, align 8 %"2_0" = alloca i64, align 8 @@ -20,9 +20,9 @@ entry_block: ; preds = %alloca_block %"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, ptr %"8_0", align 4 + %lazy_measure = call i64 @___lazy_measure(i64 %"6_02"), !dbg !11 + call void @___qfree(i64 %"6_02"), !dbg !11 + store i64 %lazy_measure, ptr %"8_0", align 4, !dbg !11 %"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, ptr %"9_0", align 4 @@ -37,3 +37,19 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64, i1 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10, !9} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_5.snap index 0b5aa81be..4dcd00614 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -15,9 +15,9 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 4 + %lazy_measure = call i64 @___lazy_measure(i64 %"2_01"), !dbg !8 + call void @___qfree(i64 %"2_01"), !dbg !8 + store i64 %lazy_measure, ptr %"4_0", align 4, !dbg !8 %"4_02" = load i64, ptr %"4_0", align 4 store i64 %"4_02", ptr %"0", align 4 %"03" = load i64, ptr %"0", align 4 @@ -27,3 +27,16 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure(i64) declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap index a6894518e..c5f3d1d06 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_6.snap @@ -5,25 +5,25 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i1, i64 } @_hl.main.1() { +define internal { i1, i64 } @_hl.main.1() !dbg !3 { alloca_block: %"0" = alloca { i1, i64 }, align 8 %"4_0" = alloca { i1, i64 }, align 8 br label %entry_block entry_block: ; preds = %alloca_block - %qalloc = call i64 @___qalloc() - %not_max = icmp ne i64 %qalloc, -1 - br i1 %not_max, label %reset_bb, label %id_bb + %qalloc = call i64 @___qalloc(), !dbg !11 + %not_max = icmp ne i64 %qalloc, -1, !dbg !11 + br i1 %not_max, label %reset_bb, label %id_bb, !dbg !11 reset_bb: ; preds = %entry_block - call void @___reset(i64 %qalloc) - br label %id_bb + call void @___reset(i64 %qalloc), !dbg !11 + br label %id_bb, !dbg !11 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, ptr %"4_0", align 4 + %0 = insertvalue { i1, i64 } { i1 true, i64 poison }, i64 %qalloc, 1, !dbg !11 + %1 = select i1 %not_max, { i1, i64 } %0, { i1, i64 } { i1 false, i64 poison }, !dbg !11 + store { i1, i64 } %1, ptr %"4_0", align 4, !dbg !11 %"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 @@ -33,3 +33,19 @@ id_bb: ; preds = %entry_block, %reset declare i64 @___qalloc() declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64 }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap index 3d88cb892..094c4ec6b 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_7.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1(i64 %0) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -13,8 +13,21 @@ alloca_block: entry_block: ; preds = %alloca_block store i64 %0, ptr %"2_0", align 4 %"2_01" = load i64, ptr %"2_0", align 4 - call void @___qfree(i64 %"2_01") + call void @___qfree(i64 %"2_01"), !dbg !8 ret void } declare void @___qfree(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_8.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_8.snap index 0f3c13390..73f258bf1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__qsystem__test__emit_qsystem_codegen@pre-mem2reg@llvm21_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 internal i64 @_hl.main.1(i64 %0) { +define internal i64 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"2_0" = alloca i64, align 8 @@ -15,8 +15,8 @@ alloca_block: entry_block: ; preds = %alloca_block 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", ptr %"4_0", align 4 + call void @___reset(i64 %"2_01"), !dbg !8 + store i64 %"2_01", ptr %"4_0", align 4, !dbg !8 %"4_02" = load i64, ptr %"4_0", align 4 store i64 %"4_02", ptr %"0", align 4 %"03" = load i64, ptr %"0", align 4 @@ -24,3 +24,16 @@ entry_block: ; preds = %alloca_block } declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index f711ce8ac..5534c4632 100644 --- 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 @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) { +define internal { i64, { i1, i64, i1 } } @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"1" = alloca { i1, i64, i1 }, align 8 @@ -23,10 +23,10 @@ entry_block: ; preds = %alloca_block %"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 + %lazy_measure = call i64 @___lazy_measure(i64 %"6_02"), !dbg !13 + call void @___reset(i64 %"6_02"), !dbg !13 + store i64 %"6_02", ptr %"8_0", align 4, !dbg !13 + store i64 %lazy_measure, ptr %"8_1", align 4, !dbg !13 %"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 @@ -48,3 +48,21 @@ entry_block: ; preds = %alloca_block declare i64 @___lazy_measure(i64) declare void @___reset(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i64, { i1, i64, i1 } }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i1, i64, i1 }", file: !2, size: 8, align: 8, elements: !11) +!11 = !{!12, !9, !12} +!12 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!13 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap index 799a38083..856728ff4 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21.snap @@ -5,13 +5,28 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal {} @_hl.main.1({} %0, i64 %1) { +define internal {} @_hl.main.1({} %0, i64 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @random_advance(i64 %1) + call void @random_advance(i64 %1), !dbg !10 ret {} %0 } declare void @random_advance(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !8) +!8 = !{} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap index c69b7f8cd..0df5c38fc 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_1.snap @@ -5,15 +5,32 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i32, {} } @_hl.main.1({} %0) { +define internal { i32, {} } @_hl.main.1({} %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %rint = call i32 @random_int() + %rint = call i32 @random_int(), !dbg !12 %mrv = insertvalue { i32, {} } poison, i32 %rint, 0 %mrv6 = insertvalue { i32, {} } %mrv, {} zeroinitializer, 1 ret { i32, {} } %mrv6 } declare i32 @random_int() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i32, {} }", file: !2, size: 4, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap index 22381198e..2ab14e357 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_2.snap @@ -5,15 +5,32 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { double, {} } @_hl.main.1({} %0) { +define internal { double, {} } @_hl.main.1({} %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %rfloat = call double @random_float() + %rfloat = call double @random_float(), !dbg !12 %mrv = insertvalue { double, {} } poison, double %rfloat, 0 %mrv6 = insertvalue { double, {} } %mrv, {} zeroinitializer, 1 ret { double, {} } %mrv6 } declare double @random_float() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ double, {} }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap index d0bf6b489..9966edf6b 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_3.snap @@ -5,15 +5,32 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i32, {} } @_hl.main.1({} %0, i32 %1) { +define internal { i32, {} } @_hl.main.1({} %0, i32 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %rintb = call i32 @random_rng(i32 %1) + %rintb = call i32 @random_rng(i32 %1), !dbg !12 %mrv = insertvalue { i32, {} } poison, i32 %rintb, 0 %mrv7 = insertvalue { i32, {} } %mrv, {} zeroinitializer, 1 ret { i32, {} } %mrv7 } declare i32 @random_rng(i32) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i32, {} }", file: !2, size: 4, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap index 2f1d5c317..a1e8ab880 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_4.snap @@ -5,13 +5,27 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - call void @random_seed(i64 %0) + call void @random_seed(i64 %0), !dbg !9 ret i1 true } declare void @random_seed(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap index eb392ab80..d4b3694dd 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@llvm21_5.snap @@ -5,10 +5,23 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1({} %0) { +define internal void @_hl.main.1({} %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block ret void } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !8) +!8 = !{} diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.snap index d48da2bc1..5a2a4d785 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21.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 internal {} @_hl.main.1({} %0, i64 %1) { +define internal {} @_hl.main.1({} %0, i64 %1) !dbg !3 { alloca_block: %"0" = alloca {}, align 8 %"2_0" = alloca {}, align 8 @@ -18,8 +18,8 @@ entry_block: ; preds = %alloca_block 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", ptr %"4_0", align 1 + call void @random_advance(i64 %"2_12"), !dbg !10 + store {} %"2_01", ptr %"4_0", align 1, !dbg !10 %"4_03" = load {}, ptr %"4_0", align 1 store {} %"4_03", ptr %"0", align 1 %"04" = load {}, ptr %"0", align 1 @@ -27,3 +27,18 @@ entry_block: ; preds = %alloca_block } declare void @random_advance(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !8) +!8 = !{} +!9 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!10 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_1.snap index e901642f4..8c2c35715 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_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 internal { i32, {} } @_hl.main.1({} %0) { +define internal { i32, {} } @_hl.main.1({} %0) !dbg !3 { alloca_block: %"0" = alloca i32, align 4 %"1" = alloca {}, align 8 @@ -17,9 +17,9 @@ alloca_block: entry_block: ; preds = %alloca_block store {} %0, ptr %"2_0", align 1 %"2_01" = load {}, ptr %"2_0", align 1 - %rint = call i32 @random_int() - store i32 %rint, ptr %"4_0", align 4 - store {} zeroinitializer, ptr %"4_1", align 1 + %rint = call i32 @random_int(), !dbg !12 + store i32 %rint, ptr %"4_0", align 4, !dbg !12 + store {} zeroinitializer, ptr %"4_1", align 1, !dbg !12 %"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 @@ -32,3 +32,20 @@ entry_block: ; preds = %alloca_block } declare i32 @random_int() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i32, {} }", file: !2, size: 4, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_2.snap index ea5809cf5..937c2d0b1 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_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 internal { double, {} } @_hl.main.1({} %0) { +define internal { double, {} } @_hl.main.1({} %0) !dbg !3 { alloca_block: %"0" = alloca double, align 8 %"1" = alloca {}, align 8 @@ -17,9 +17,9 @@ alloca_block: entry_block: ; preds = %alloca_block store {} %0, ptr %"2_0", align 1 %"2_01" = load {}, ptr %"2_0", align 1 - %rfloat = call double @random_float() - store double %rfloat, ptr %"4_0", align 8 - store {} zeroinitializer, ptr %"4_1", align 1 + %rfloat = call double @random_float(), !dbg !12 + store double %rfloat, ptr %"4_0", align 8, !dbg !12 + store {} zeroinitializer, ptr %"4_1", align 1, !dbg !12 %"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 @@ -32,3 +32,20 @@ entry_block: ; preds = %alloca_block } declare double @random_float() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ double, {} }", file: !2, size: 8, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 23085e6bd..7156bedd6 100644 --- 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 @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal { i32, {} } @_hl.main.1({} %0, i32 %1) { +define internal { i32, {} } @_hl.main.1({} %0, i32 %1) !dbg !3 { alloca_block: %"0" = alloca i32, align 4 %"1" = alloca {}, align 8 @@ -20,9 +20,9 @@ entry_block: ; preds = %alloca_block 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 + %rintb = call i32 @random_rng(i32 %"2_12"), !dbg !12 + store i32 %rintb, ptr %"4_0", align 4, !dbg !12 + store {} zeroinitializer, ptr %"4_1", align 1, !dbg !12 %"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 @@ -35,3 +35,20 @@ entry_block: ; preds = %alloca_block } declare i32 @random_rng(i32) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !10, !9} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ i32, {} }", file: !2, size: 4, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_unsigned) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !11) +!11 = !{} +!12 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_4.snap index 6a3e511b8..018ec07f6 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i64 %0) { +define internal i1 @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i64, align 8 @@ -15,8 +15,8 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + call void @random_seed(i64 %"2_01"), !dbg !9 + store i1 true, ptr %"4_0", align 1, !dbg !9 %"4_02" = load i1, ptr %"4_0", align 1 store i1 %"4_02", ptr %"0", align 1 %"03" = load i1, ptr %"0", align 1 @@ -24,3 +24,17 @@ entry_block: ; preds = %alloca_block } declare void @random_seed(i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!9 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap index 6c5937da7..85d2be209 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__random__test__emit_random_codegen@pre-mem2reg@llvm21_5.snap @@ -5,7 +5,7 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal void @_hl.main.1({} %0) { +define internal void @_hl.main.1({} %0) !dbg !3 { alloca_block: %"2_0" = alloca {}, align 8 br label %entry_block @@ -15,3 +15,16 @@ entry_block: ; preds = %alloca_block %"2_01" = load {}, ptr %"2_0", align 1 ret void } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{}", file: !2, align: 8, elements: !8) +!8 = !{} diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap index 423005c5e..475552f1f 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_1.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %tag_len = load i8, ptr @res_test_bool.427F8271.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_bool(ptr @res_test_bool.427F8271.0, i64 %tag_len2, i1 %0), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 82c88b50c..f096b4034 100644 --- 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 @@ -7,30 +7,46 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { 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) + %tag_len = load i8, ptr @res_test_arr_f.038B27BE.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %0, 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %0, 1, !dbg !11 + %1 = getelementptr inbounds [10 x double], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_float_arr(ptr @res_test_arr_f.038B27BE.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_float_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap index 0aba173da..31a2b180f 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_12.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %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, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + 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), !dbg !8 ret void } declare void @print_int(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap index 887f8aae5..039c8605a 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_13.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %tag_len = load i8, ptr @"res_test!@#$%^.2547CEEA.0", align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_uint(ptr @"res_test!@#$%^.2547CEEA.0", i64 %tag_len2, i64 %0), !dbg !8 ret void } declare void @print_uint(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap index c5499233a..acdca3bb3 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_15.snap @@ -7,15 +7,28 @@ 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 internal void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %tag_len = load i8, ptr @"res_ spaces .F46B5D1D.0", align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %0) + %tag_len = load i8, ptr @"res_ spaces .F46B5D1D.0", align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %0), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap index 62cff092b..ef6fc9d52 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_16.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %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, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + 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), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap index d851efee9..95ab43fdc 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_2.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %tag_len = load i8, ptr @res_test_int.258C85C2.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_int(ptr @res_test_int.258C85C2.0, i64 %tag_len2, i64 %0), !dbg !8 ret void } declare void @print_int(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap index aeb0eff62..327974f36 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_3.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %tag_len = load i8, ptr @res_test_uint.DE04EADD.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_uint(ptr @res_test_uint.DE04EADD.0, i64 %tag_len2, i64 %0), !dbg !8 ret void } declare void @print_uint(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap index 079dfa470..f621c3063 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@llvm21_4.snap @@ -7,15 +7,28 @@ 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) { +define internal void @_hl.main.1(double %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %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 %0) + %tag_len = load i8, ptr @res_test_f64.A24BDAE1.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_float(ptr @res_test_f64.A24BDAE1.0, i64 %tag_len2, double %0), !dbg !8 ret void } declare void @print_float(ptr, i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index d74b84386..86092d382 100644 --- 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 @@ -7,30 +7,46 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { 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) + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %0, 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %0, 1, !dbg !11 + %1 = getelementptr inbounds [10 x i1], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_bool_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 0719cb4bc..11f55fa08 100644 --- 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 @@ -7,30 +7,46 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { 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) + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %0, 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %0, 1, !dbg !11 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_int_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 28b01c227..949a9f07d 100644 --- 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 @@ -7,30 +7,46 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { 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) + %tag_len = load i8, ptr @res_test_arr_u.3D1C515C.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %0, 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %0, 1, !dbg !11 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_uint_arr(ptr @res_test_arr_u.3D1C515C.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_uint_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 492d3658d..18c07a017 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"2_0" = alloca i1, align 1 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %tag_len = load i8, ptr @res_test_bool.427F8271.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_bool(ptr @res_test_bool.427F8271.0, i64 %tag_len2, i1 %"2_01"), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index ba95a66ed..5f043c576 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { alloca_block: %"2_0" = alloca { ptr, i64 }, align 8 br label %entry_block @@ -15,25 +15,41 @@ alloca_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) + %tag_len = load i8, ptr @res_test_arr_f.038B27BE.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1, !dbg !11 + %1 = getelementptr inbounds [10 x double], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_float_arr(ptr @res_test_arr_f.038B27BE.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_float_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index a35ff2db4..fbeb0fbad 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %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, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + 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"), !dbg !8 ret void } declare void @print_int(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 5680b3487..539964e3e 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %tag_len = load i8, ptr @"res_test!@#$%^.2547CEEA.0", align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_uint(ptr @"res_test!@#$%^.2547CEEA.0", i64 %tag_len2, i64 %"2_01"), !dbg !8 ret void } declare void @print_uint(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap index 43feb3284..700dbb9fb 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__result__test__emit_result_codegen@pre-mem2reg@llvm21_15.snap @@ -7,7 +7,7 @@ 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 internal void @_hl.main.1(i1 %0) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"2_0" = alloca i1, align 1 br label %entry_block @@ -15,10 +15,23 @@ alloca_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_ spaces .F46B5D1D.0", align 1 - %tag_len2 = zext i8 %tag_len to i64 - call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %"2_01") + %tag_len = load i8, ptr @"res_ spaces .F46B5D1D.0", align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_bool(ptr @"res_ spaces .F46B5D1D.0", i64 %tag_len2, i1 %"2_01"), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 9913d7df3..dd2762c04 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"2_0" = alloca i1, align 1 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %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, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + 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"), !dbg !8 ret void } declare void @print_bool(ptr, i64, i1) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 637e6c305..db9aa8652 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %tag_len = load i8, ptr @res_test_int.258C85C2.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_int(ptr @res_test_int.258C85C2.0, i64 %tag_len2, i64 %"2_01"), !dbg !8 ret void } declare void @print_int(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index b6edcf627..b5a87bc1b 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(i64 %0) !dbg !3 { alloca_block: %"2_0" = alloca i64, align 8 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %tag_len = load i8, ptr @res_test_uint.DE04EADD.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_uint(ptr @res_test_uint.DE04EADD.0, i64 %tag_len2, i64 %"2_01"), !dbg !8 ret void } declare void @print_uint(ptr, i64, i64) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 0a631f536..87aaa44d3 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1(double %0) !dbg !3 { alloca_block: %"2_0" = alloca double, align 8 br label %entry_block @@ -15,10 +15,23 @@ alloca_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") + %tag_len = load i8, ptr @res_test_f64.A24BDAE1.0, align 1, !dbg !8 + %tag_len2 = zext i8 %tag_len to i64, !dbg !8 + call void @print_float(ptr @res_test_f64.A24BDAE1.0, i64 %tag_len2, double %"2_01"), !dbg !8 ret void } declare void @print_float(ptr, i64, double) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!8 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 2095e59c2..3de6762f2 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { alloca_block: %"2_0" = alloca { ptr, i64 }, align 8 br label %entry_block @@ -15,25 +15,41 @@ alloca_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) + %tag_len = load i8, ptr @res_test_arr_b.866EEC87.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1, !dbg !11 + %1 = getelementptr inbounds [10 x i1], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_bool_arr(ptr @res_test_arr_b.866EEC87.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_bool_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 809855c5c..73ea632e8 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { alloca_block: %"2_0" = alloca { ptr, i64 }, align 8 br label %entry_block @@ -15,25 +15,41 @@ alloca_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) + %tag_len = load i8, ptr @res_test_arr_i.DFD30452.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1, !dbg !11 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_int_arr(ptr @res_test_arr_i.DFD30452.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_int_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) 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 index 8777c792b..3ad711ffd 100644 --- 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 @@ -7,7 +7,7 @@ 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) { +define internal void @_hl.main.1({ ptr, i64 } %0) !dbg !3 { alloca_block: %"2_0" = alloca { ptr, i64 }, align 8 br label %entry_block @@ -15,25 +15,41 @@ alloca_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) + %tag_len = load i8, ptr @res_test_arr_u.3D1C515C.0, align 1, !dbg !11 + %tag_len2 = zext i8 %tag_len to i64, !dbg !11 + %array_ptr = extractvalue { ptr, i64 } %"2_01", 0, !dbg !11 + %array_offset = extractvalue { ptr, i64 } %"2_01", 1, !dbg !11 + %1 = getelementptr inbounds [10 x i64], ptr %array_ptr, i64 %array_offset, !dbg !11 + %out_arr_alloca = alloca <{ i32, i32, ptr, ptr }>, align 8, !dbg !11 + %x_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 0, !dbg !11 + %y_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 1, !dbg !11 + %arr_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 2, !dbg !11 + %mask_ptr = getelementptr inbounds nuw <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, i32 0, i32 3, !dbg !11 + %2 = alloca i1, i32 10, align 1, !dbg !11 + store [10 x i1] zeroinitializer, ptr %2, align 1, !dbg !11 + store i32 10, ptr %x_ptr, align 4, !dbg !11 + store i32 1, ptr %y_ptr, align 4, !dbg !11 + store ptr %1, ptr %arr_ptr, align 8, !dbg !11 + store ptr %2, ptr %mask_ptr, align 8, !dbg !11 + %3 = load <{ i32, i32, ptr, ptr }>, ptr %out_arr_alloca, align 1, !dbg !11 + call void @print_uint_arr(ptr @res_test_arr_u.3D1C515C.0, i64 %tag_len2, ptr %out_arr_alloca), !dbg !11 ret void } declare void @print_uint_arr(ptr, i64, ptr) + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "{ ptr, i64 }", file: !2, size: 16, align: 8, elements: !8) +!8 = !{!9, !10} +!9 = !DIBasicType(name: "ptr", size: 64, encoding: DW_ATE_address) +!10 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!11 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap index 1f7077f82..aa20e70d5 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@llvm21_1.snap @@ -5,13 +5,26 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1() { +define internal i64 @_hl.main.1() !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %shot = call i64 @get_current_shot() + %shot = call i64 @get_current_shot(), !dbg !8 ret i64 %shot } declare i64 @get_current_shot() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap index 565aa96c4..3406ddd07 100644 --- a/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap +++ b/tket-qsystem/src/llvm/snapshots/tket_qsystem__llvm__utils__test__emit_utils_codegen@pre-mem2reg@llvm21_1.snap @@ -5,15 +5,15 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i64 @_hl.main.1() { +define internal i64 @_hl.main.1() !dbg !3 { alloca_block: %"0" = alloca i64, align 8 %"4_0" = alloca i64, align 8 br label %entry_block entry_block: ; preds = %alloca_block - %shot = call i64 @get_current_shot() - store i64 %shot, ptr %"4_0", align 4 + %shot = call i64 @get_current_shot(), !dbg !8 + store i64 %shot, ptr %"4_0", align 4, !dbg !8 %"4_01" = load i64, ptr %"4_0", align 4 store i64 %"4_01", ptr %"0", align 4 %"02" = load i64, ptr %"0", align 4 @@ -21,3 +21,16 @@ entry_block: ; preds = %alloca_block } declare i64 @get_current_shot() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket-qsystem/src/llvm/utils.rs b/tket-qsystem/src/llvm/utils.rs index b91a6aaab..79029147b 100644 --- a/tket-qsystem/src/llvm/utils.rs +++ b/tket-qsystem/src/llvm/utils.rs @@ -74,7 +74,7 @@ mod test { .add_default_int_extensions() }); let ext_op = op.to_extension_op().unwrap().into(); - let hugr = single_op_hugr(ext_op); + let mut hugr = single_op_hugr(ext_op); check_emission!(hugr, llvm_ctx); } } diff --git a/tket/Cargo.toml b/tket/Cargo.toml index 350740203..1d54ecc2b 100644 --- a/tket/Cargo.toml +++ b/tket/Cargo.toml @@ -92,7 +92,7 @@ proptest-recurse = { workspace = true } # Defined here so it can be overridden by the codspeed CI job # using `cargo add`. criterion = { version = "0.8.2", features = ["html_reports"] } -insta = "1.47.0" +insta = "1.47.2" [[bench]] name = "bench_main" diff --git a/tket/src/llvm/bool.rs b/tket/src/llvm/bool.rs index 9563b5e6d..4c68c5fc8 100644 --- a/tket/src/llvm/bool.rs +++ b/tket/src/llvm/bool.rs @@ -141,7 +141,7 @@ mod test { .add_default_int_extensions() }); let ext_op = op.to_extension_op().unwrap().into(); - let hugr = single_op_hugr(ext_op); + let mut hugr = single_op_hugr(ext_op); check_emission!(hugr, llvm_ctx); } } diff --git a/tket/src/llvm/rotation.rs b/tket/src/llvm/rotation.rs index b373e428b..361b95c42 100644 --- a/tket/src/llvm/rotation.rs +++ b/tket/src/llvm/rotation.rs @@ -244,7 +244,7 @@ mod test { #[with(_id)] mut llvm_ctx: TestContext, #[case] prelude: impl PreludeCodegen + 'static, ) { - let hugr = SimpleHugrConfig::new() + let mut hugr = SimpleHugrConfig::new() .with_ins(vec![float64_type()]) .finish_with_exts(|mut builder, _reg| { let [a1] = builder.input_wires_arr(); @@ -274,7 +274,7 @@ mod test { #[rstest] #[case(ConstRotation::new(1.0).unwrap(), ConstRotation::new(0.5).unwrap(), 1.5)] #[case(ConstRotation::PI, ConstRotation::new(1.5).unwrap(), 2.5)] - fn exec_aadd( + fn exec_add( mut exec_ctx: TestContext, #[case] angle1: ConstRotation, #[case] angle2: ConstRotation, diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap index d3fd9c9e7..ded722635 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_1.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %1 = select i1 %0, i1 true, i1 false + %1 = select i1 %0, i1 true, i1 false, !dbg !8 ret i1 %1 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap index 2e5dcc2ec..2c7437ecd 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_2.snap @@ -5,10 +5,22 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block ret i1 %0 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap index 270a70277..689dbacfd 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_3.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %1 = xor i1 %0, true + %1 = xor i1 %0, true, !dbg !8 ret i1 %1 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap index 241f4932b..cb74f0d29 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_4.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = and i1 %0, %1 + %2 = and i1 %0, %1, !dbg !8 ret i1 %2 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap index a2e47e3e1..1c86c8923 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_5.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = or i1 %0, %1 + %2 = or i1 %0, %1, !dbg !8 ret i1 %2 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap index d5801c415..8641560ff 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_6.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = xor i1 %0, %1 + %2 = xor i1 %0, %1, !dbg !8 ret i1 %2 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap index a2ff1fc65..baf7429d6 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap +++ b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@llvm21_7.snap @@ -5,11 +5,24 @@ expression: mod_str ; ModuleID = 'test_context' source_filename = "test_context" -define internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %2 = icmp eq i1 %0, %1 + %2 = icmp eq i1 %0, %1, !dbg !8 ret i1 %2 } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_1.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_1.snap index 98441114b..2821253e9 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -15,10 +15,23 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %1 = select i1 %"2_01", i1 true, i1 false, !dbg !8 + store i1 %1, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_2.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_2.snap index 3537ec577..707f5497d 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -15,9 +15,22 @@ alloca_block: entry_block: ; preds = %alloca_block 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 + store i1 %"2_01", ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_3.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_3.snap index df4c08751..6ed81fcdb 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0) { +define internal i1 @_hl.main.1(i1 %0) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -15,10 +15,23 @@ alloca_block: entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %1 = xor i1 %"2_01", true, !dbg !8 + store i1 %1, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_4.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_4.snap index 11c16eb29..1d0c832ac 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -18,10 +18,23 @@ entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %2 = and i1 %"2_01", %"2_12", !dbg !8 + store i1 %2, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_5.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_5.snap index 848c4bca9..1974e154b 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -18,10 +18,23 @@ entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %2 = or i1 %"2_01", %"2_12", !dbg !8 + store i1 %2, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_6.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_6.snap index 6bcb19853..872b80dec 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -18,10 +18,23 @@ entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %2 = xor i1 %"2_01", %"2_12", !dbg !8 + store i1 %2, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_7.snap b/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_7.snap index ae9b27724..85d0369ca 100644 --- a/tket/src/llvm/snapshots/tket__llvm__bool__test__emit_all_ops@pre-mem2reg@llvm21_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 internal i1 @_hl.main.1(i1 %0, i1 %1) { +define internal i1 @_hl.main.1(i1 %0, i1 %1) !dbg !3 { alloca_block: %"0" = alloca i1, align 1 %"2_0" = alloca i1, align 1 @@ -18,10 +18,23 @@ entry_block: ; preds = %alloca_block 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, ptr %"4_0", align 1 + %2 = icmp eq i1 %"2_01", %"2_12", !dbg !8 + store i1 %2, ptr %"4_0", align 1, !dbg !8 %"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" } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lPNzlV/ClAphFG/yrhvZs/eDgUn/eIVwAutKJHaZEPSZwPXPeycUvnujGxZ") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7, !7} +!7 = !DIBasicType(name: "i1", size: 1, encoding: DW_ATE_unsigned) +!8 = !DILocation(line: 27062, column: 402, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap index 48c399808..80b2f8a02 100644 --- a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap +++ b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@llvm21_0.snap @@ -10,23 +10,23 @@ 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 internal void @_hl.main.1(double %0) { +define internal void @_hl.main.1(double %0) !dbg !3 { alloca_block: br label %entry_block entry_block: ; preds = %alloca_block - %1 = call i1 @llvm.is.fpclass.f64(double %0, i32 504) - br i1 %1, label %4, label %2 + %1 = call i1 @llvm.is.fpclass.f64(double %0, i32 504), !dbg !8 + br i1 %1, label %4, label %2, !dbg !8 2: ; preds = %entry_block - %3 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0) - call void @abort() - unreachable + %3 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0), !dbg !8 + call void @abort(), !dbg !8 + unreachable, !dbg !8 4: ; preds = %entry_block - %5 = call i1 @llvm.is.fpclass.f64(double %0, i32 504) - %6 = insertvalue { i1, double } { i1 true, double poison }, double %0, 1 - %7 = select i1 %5, { i1, double } %6, { i1, double } { i1 false, double poison } + %5 = call i1 @llvm.is.fpclass.f64(double %0, i32 504), !dbg !9 + %6 = insertvalue { i1, double } { i1 true, double poison }, double %0, 1, !dbg !9 + %7 = select i1 %5, { i1, double } %6, { i1, double } { i1 false, double poison }, !dbg !9 %8 = extractvalue { i1, double } %7, 0 switch i1 %8, label %9 [ i1 true, label %10 @@ -40,10 +40,10 @@ entry_block: ; preds = %alloca_block br label %cond_7_case_1 cond_7_case_0: ; preds = %9 - %12 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 0 - %13 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 1 - %14 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %12, ptr %13) - call void @abort() + %12 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 0, !dbg !10 + %13 = extractvalue { i32, ptr } { i32 1, ptr @1 }, 1, !dbg !10 + %14 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %12, ptr %13), !dbg !10 + call void @abort(), !dbg !10 br label %cond_exit_7 cond_7_case_1: ; preds = %10 @@ -51,7 +51,7 @@ cond_7_case_1: ; preds = %10 cond_exit_7: ; preds = %cond_7_case_1, %cond_7_case_0 %"0.0" = phi double [ 0.000000e+00, %cond_7_case_0 ], [ %11, %cond_7_case_1 ] - %15 = fadd double %0, %"0.0" + %15 = fadd double %0, %"0.0", !dbg !11 ret void } @@ -63,3 +63,19 @@ declare i32 @printf(ptr, ...) declare void @abort() attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lA") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!8 = !DILocation(line: 27062, column: 402, scope: !3) +!9 = !DILocation(line: 10060, column: 368, scope: !3) +!10 = !DILocation(line: 32551, column: 131, scope: !3) +!11 = !DILocation(line: 13582, column: 372, scope: !3) diff --git a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_0.snap b/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_0.snap index dcf69b7ec..bd40017ef 100644 --- a/tket/src/llvm/snapshots/tket__llvm__rotation__test__emit_all_ops@pre-mem2reg@llvm21_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 internal void @_hl.main.1(double %0) { +define internal void @_hl.main.1(double %0) !dbg !3 { alloca_block: %"2_0" = alloca double, align 8 %"4_0" = alloca double, align 8 @@ -28,23 +28,23 @@ alloca_block: entry_block: ; preds = %alloca_block store double %0, ptr %"2_0", align 8 %"2_01" = load double, ptr %"2_0", align 8 - %1 = call i1 @llvm.is.fpclass.f64(double %"2_01", i32 504) - br i1 %1, label %4, label %2 + %1 = call i1 @llvm.is.fpclass.f64(double %"2_01", i32 504), !dbg !8 + br i1 %1, label %4, label %2, !dbg !8 2: ; preds = %entry_block - %3 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0) - call void @abort() - unreachable + %3 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template, i32 1, ptr @0), !dbg !8 + call void @abort(), !dbg !8 + unreachable, !dbg !8 4: ; preds = %entry_block - store double %"2_01", ptr %"4_0", align 8 + store double %"2_01", ptr %"4_0", align 8, !dbg !8 %"4_02" = load double, ptr %"4_0", align 8 - store double %"4_02", ptr %"5_0", align 8 + store double %"4_02", ptr %"5_0", align 8, !dbg !9 %"5_03" = load double, ptr %"5_0", align 8 - %5 = call i1 @llvm.is.fpclass.f64(double %"5_03", i32 504) - %6 = insertvalue { i1, double } { i1 true, double poison }, double %"5_03", 1 - %7 = select i1 %5, { i1, double } %6, { i1, double } { i1 false, double poison } - store { i1, double } %7, ptr %"6_0", align 8 + %5 = call i1 @llvm.is.fpclass.f64(double %"5_03", i32 504), !dbg !10 + %6 = insertvalue { i1, double } { i1 true, double poison }, double %"5_03", 1, !dbg !10 + %7 = select i1 %5, { i1, double } %6, { i1, double } { i1 false, double poison }, !dbg !10 + store { i1, double } %7, ptr %"6_0", align 8, !dbg !10 %"6_04" = load { i1, double }, ptr %"6_0", align 8 %8 = extractvalue { i1, double } %"6_04", 0 switch i1 %8, label %9 [ @@ -62,11 +62,11 @@ entry_block: ; preds = %alloca_block cond_7_case_0: ; preds = %9 store { i32, ptr } { i32 1, ptr @1 }, ptr %"12_0", align 8 %"12_06" = load { i32, ptr }, ptr %"12_0", align 8 - %12 = extractvalue { i32, ptr } %"12_06", 0 - %13 = extractvalue { i32, ptr } %"12_06", 1 - %14 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %12, ptr %13) - call void @abort() - store double 0.000000e+00, ptr %"13_0", align 8 + %12 = extractvalue { i32, ptr } %"12_06", 0, !dbg !11 + %13 = extractvalue { i32, ptr } %"12_06", 1, !dbg !11 + %14 = call i32 (ptr, ...) @printf(ptr @prelude.panic_template.1, i32 %12, ptr %13), !dbg !11 + call void @abort(), !dbg !11 + store double 0.000000e+00, ptr %"13_0", align 8, !dbg !11 %"13_07" = load double, ptr %"13_0", align 8 store double %"13_07", ptr %"0", align 8 br label %cond_exit_7 @@ -83,8 +83,8 @@ cond_exit_7: ; preds = %cond_7_case_1, %con 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 - %15 = fadd double %"4_011", %"7_012" - store double %15, ptr %"17_0", align 8 + %15 = fadd double %"4_011", %"7_012", !dbg !12 + store double %15, ptr %"17_0", align 8, !dbg !12 ret void } @@ -96,3 +96,20 @@ declare i32 @printf(ptr, ...) declare void @abort() attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_Python, file: !2, producer: "hugr_llvm_test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +!2 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "/lA") +!3 = distinct !DISubprogram(name: "_hl.main.1", linkageName: "_hl.main.1", scope: null, file: !4, line: 25254, type: !5, scopeLine: 25255, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1) +!4 = !DIFile(filename: "/cmJrSnVYeXFf/zCkHdtWCCnkJhPKiWSKICgZuRNRvR/mbrfVq.gpy.py", directory: "") +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!8 = !DILocation(line: 27062, column: 402, scope: !3) +!9 = !DILocation(line: 5388, column: 404, scope: !3) +!10 = !DILocation(line: 10060, column: 368, scope: !3) +!11 = !DILocation(line: 32551, column: 131, scope: !3) +!12 = !DILocation(line: 13582, column: 372, scope: !3)