diff --git a/.cargo/config.toml b/.cargo/config.toml index fc2c09a8dba..06485a4bb8b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -17,6 +17,12 @@ rustflags = [ ] linker = "clang" +[target.aarch64-apple-darwin] +rustflags = [ + "-C", + "link-arg=-lxar" +] + [profile.profiling] inherits = "release" debug = true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index cc652de9fe9..c7695d18194 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -13,9 +13,6 @@ jobs: build: name: Windows Build runs-on: windows-2022 - env: - toolchain-version: 1.90.0 - llvm-version: 14.0.6 steps: - uses: actions/checkout@v3 @@ -23,13 +20,17 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ env.toolchain-version }} + toolchain: 1.90.0 - name: Install LLVM - uses: ghaith/install-llvm-action@latest - with: - version: ${{ env.llvm-version }} - directory: "./llvm" + shell: pwsh + run: | + $llvmUrl = "https://github.com/PLC-lang/llvm-package-windows/releases/download/v21.1.7/LLVM-21.1.7-win64.7z" + $llvmArchive = "LLVM-21.1.7-win64.7z" + Invoke-WebRequest -Uri $llvmUrl -OutFile $llvmArchive + 7z x $llvmArchive -o"./llvm" -y + $llvmBin = (Resolve-Path "./llvm/bin").Path + echo "$llvmBin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Cargo test (Unit) run: cargo test --lib -- --nocapture @@ -47,4 +48,3 @@ jobs: with: name: plc.exe path: target/release/plc.exe - diff --git a/.vscode/launch.json b/.vscode/launch.json index 79742a5fc0e..d9de230fd81 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,29 +4,31 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "type": "codelldb", - "request": "launch", - "name": "Debug codelldb standard_lib", - "cargo": { + { + "type": "codelldb", + "request": "launch", + "name": "Debug codelldb standard_lib", + "cargo": { + "args": [ + "build", + "--bin=plc", + "--package=plc_driver" + ], + "filter": { + "name": "plc", + "kind": "bin" + } + }, + "program": "target/debug/plc", "args": [ - "build", - "--bin=plc", - "--package=plc_driver" + "libs/stdlib/iec61131-st/*.st" ], - "filter": { - "name": "plc", - "kind": "bin" - } - }, - "program": "target/debug/plc", - "args": ["libs/stdlib/iec61131-st/*.st"], - "cwd": "${workspaceFolder}", - "env": { - "RUST_LOG": "rusty" + "cwd": "${workspaceFolder}", + "env": { + "RUST_LOG": "rusty" + }, + "terminal": "integrated" }, - "terminal": "integrated" - }, { "type": "codelldb", "request": "launch", @@ -43,7 +45,11 @@ } }, "program": "target/debug/plc", - "args": ["target/demo.st", "-g", "-c"], + "args": [ + "target/demo.st", + "-g", + "-c" + ], "cwd": "${workspaceFolder}", "env": { "RUST_LOG": "rusty" @@ -66,6 +72,7 @@ } }, "args": [ + "-j=1", "target/demo.st", "tests/lit/util/printf.pli" ], @@ -107,7 +114,6 @@ "cwd": "${workspaceFolder}", "program": "target/demo", "terminal": "integrated" - } ] -} +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 7d525271ea8..9192a5b94c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,7 +9,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "serde", "version_check", @@ -18,9 +18,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -47,14 +47,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "710e8eae58854cdc1790fcb56cca04d712a17be849eeb81da2a724bf4bae2bc4" dependencies = [ "anstyle", - "unicode-width 0.2.1", + "unicode-width 0.2.2", ] [[package]] name = "anstream" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -82,22 +82,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -193,7 +193,7 @@ dependencies = [ "polling 3.11.0", "rustix 1.1.2", "slab", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -294,9 +294,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "beef" @@ -327,11 +327,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.4" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytecount" @@ -376,15 +376,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "cc" -version = "1.2.39" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ "find-msvc-tools", "shlex", @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" @@ -444,7 +444,7 @@ checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ "anstream", "anstyle", - "clap_lex 0.7.5", + "clap_lex 0.7.6", "strsim 0.11.1", ] @@ -456,8 +456,8 @@ checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck 0.4.1", "proc-macro-error", - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "syn 1.0.109", ] @@ -468,9 +468,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck 0.5.0", - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "codespan-reporting" @@ -564,9 +564,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" dependencies = [ "crc-catalog", ] @@ -613,9 +613,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", @@ -634,9 +634,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] @@ -648,10 +648,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" dependencies = [ "convert_case", - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "rustc_version", - "syn 2.0.106", + "syn 2.0.111", ] [[package]] @@ -678,9 +678,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -748,7 +748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -827,9 +827,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "flume" @@ -1032,20 +1032,20 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", "r-efi", - "wasi 0.14.7+wasi-0.2.4", + "wasip2", ] [[package]] @@ -1176,11 +1176,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1282,9 +1282,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", @@ -1295,9 +1295,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -1308,11 +1308,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -1323,42 +1322,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -1424,34 +1419,31 @@ dependencies = [ [[package]] name = "inkwell" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67349bd7578d4afebbe15eaa642a80b884e8623db74b1716611b131feb1deef" +version = "0.7.1" +source = "git+https://github.com/TheDan64/inkwell.git?rev=7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98#7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98" dependencies = [ - "either", "inkwell_internals", "libc", "llvm-sys", "once_cell", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "inkwell_internals" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f365c8de536236cfdebd0ba2130de22acefed18b1fb99c32783b3840aec5fb46" +version = "0.12.0" +source = "git+https://github.com/TheDan64/inkwell.git?rev=7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98#7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] name = "insta" -version = "1.43.2" +version = "1.44.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fdb647ebde000f43b5b53f773c30cf9b0cb4300453208713fa38b2c70935a0" +checksum = "b5c943d4415edd8153251b6f197de5eb1640e56d84e8d9159bea190421c73698" dependencies = [ "console", "once_cell", @@ -1487,20 +1479,20 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is-terminal" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi 0.5.2", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "iso8601" @@ -1528,9 +1520,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.81" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -1586,9 +1578,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.176" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libm" @@ -1598,13 +1590,13 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "libc", - "redox_syscall", + "redox_syscall 0.6.0", ] [[package]] @@ -1637,50 +1629,38 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" - -[[package]] -name = "lld_rs" -version = "140.0.0" -source = "git+https://github.com/mun-lang/lld-rs?rev=3798ace#3798ace8dae54f2b77f40a122beec12f4c80dc98" -dependencies = [ - "cc", - "lazy_static", - "libc", - "llvm-sys", - "semver", -] +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "llvm-sys" -version = "140.1.3" +version = "211.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3dc78e9857c0231ec11e3bdccf63870493fdc7d0570b0ea7d50bf5df0cb1a0c" +checksum = "108b3ad2b2eaf2a561fc74196273b20e3436e4a688b8b44e250d83974dc1b2e2" dependencies = [ + "anyhow", "cc", "lazy_static", "libc", - "regex", + "regex-lite", "semver", ] [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" dependencies = [ "value-bag", ] @@ -1702,8 +1682,8 @@ checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" dependencies = [ "beef", "fnv", - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "regex-syntax 0.6.29", "syn 1.0.109", ] @@ -1764,13 +1744,13 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mio" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "wasi", + "windows-sys 0.61.2", ] [[package]] @@ -1844,11 +1824,10 @@ dependencies = [ [[package]] name = "num-bigint-dig" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" dependencies = [ - "byteorder", "lazy_static", "libm", "num-integer", @@ -1929,17 +1908,17 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openssl" -version = "0.10.73" +version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "cfg-if", "foreign-types", "libc", @@ -1954,9 +1933,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -1967,9 +1946,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.109" +version = "0.9.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" dependencies = [ "cc", "libc", @@ -1991,7 +1970,7 @@ checksum = "6978128c8b51d8f4080631ceb2302ab51e32cc6e8615f735ee2f83fd269ae3f1" dependencies = [ "bytecount", "fnv", - "unicode-width 0.2.1", + "unicode-width 0.2.2", ] [[package]] @@ -2002,9 +1981,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -2012,15 +1991,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.18", "smallvec", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -2259,14 +2238,14 @@ dependencies = [ "hermit-abi 0.5.2", "pin-project-lite", "rustix 1.1.2", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] name = "potential_utf" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ "zerovec", ] @@ -2303,8 +2282,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "syn 1.0.109", "version_check", ] @@ -2315,8 +2294,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "version_check", ] @@ -2326,8 +2305,8 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", ] [[package]] @@ -2337,9 +2316,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ "proc-macro-error-attr2", - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -2353,9 +2332,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -2381,11 +2360,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ - "proc-macro2 1.0.101", + "proc-macro2 1.0.103", ] [[package]] @@ -2446,11 +2425,20 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.17" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", +] + +[[package]] +name = "redox_syscall" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec96166dafa0886eb81fe1c0a388bece180fbef2135f97c1e2cf8302e74b43b5" +dependencies = [ + "bitflags 2.10.0", ] [[package]] @@ -2462,7 +2450,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.6", + "regex-syntax 0.8.8", ] [[package]] @@ -2473,9 +2461,15 @@ checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.6", + "regex-syntax 0.8.8", ] +[[package]] +name = "regex-lite" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d942b98df5e658f56f20d592c7f868833fe38115e65c33003d8cd224b0155da" + [[package]] name = "regex-syntax" version = "0.6.29" @@ -2484,9 +2478,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" @@ -2526,9 +2520,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" +checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" dependencies = [ "const-oid", "digest", @@ -2579,7 +2573,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys 0.4.15", @@ -2592,11 +2586,11 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -2620,7 +2614,6 @@ dependencies = [ "insta", "itertools", "lazy_static", - "lld_rs", "log", "logos", "num", @@ -2669,7 +2662,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" dependencies = [ - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -2697,7 +2690,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "core-foundation", "core-foundation-sys", "libc", @@ -2745,9 +2738,9 @@ version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -2804,9 +2797,9 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -2833,9 +2826,9 @@ dependencies = [ [[package]] name = "shell-words" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" [[package]] name = "shlex" @@ -2896,12 +2889,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -2966,7 +2959,7 @@ dependencies = [ "serde_json", "sha2", "smallvec", - "thiserror 2.0.17", + "thiserror", "tracing", "url", ] @@ -2977,11 +2970,11 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "sqlx-core", "sqlx-macros-core", - "syn 2.0.106", + "syn 2.0.111", ] [[package]] @@ -2996,8 +2989,8 @@ dependencies = [ "heck 0.5.0", "hex", "once_cell", - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "serde", "serde_json", "sha2", @@ -3005,7 +2998,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.106", + "syn 2.0.111", "url", ] @@ -3017,7 +3010,7 @@ checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.9.4", + "bitflags 2.10.0", "byteorder", "bytes", "crc", @@ -3046,7 +3039,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.17", + "thiserror", "tracing", "whoami", ] @@ -3059,7 +3052,7 @@ checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.9.4", + "bitflags 2.10.0", "byteorder", "crc", "dotenvy", @@ -3083,7 +3076,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.17", + "thiserror", "tracing", "whoami", ] @@ -3107,16 +3100,16 @@ dependencies = [ "serde", "serde_urlencoded", "sqlx-core", - "thiserror 2.0.17", + "thiserror", "tracing", "url", ] [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stringprep" @@ -3164,19 +3157,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.106" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", + "proc-macro2 1.0.103", + "quote 1.0.42", "unicode-ident", ] @@ -3192,9 +3185,9 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -3252,9 +3245,9 @@ checksum = "0ea5d1b13ca6cff1f9231ffd62f15eefd72543dab5e468735f1a456728a02846" dependencies = [ "heck 0.5.0", "proc-macro-error2", - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -3264,10 +3257,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand 2.3.0", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "rustix 1.1.2", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -3301,7 +3294,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f8daae29995a24f65619e19d8d31dea5b389f3d853d8bf297bbf607cd0014cc" dependencies = [ - "unicode-width 0.2.1", + "unicode-width 0.2.2", ] [[package]] @@ -3310,33 +3303,13 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - [[package]] name = "thiserror" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.17", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "thiserror-impl", ] [[package]] @@ -3345,9 +3318,9 @@ version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -3382,9 +3355,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -3415,15 +3388,15 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "socket2 0.6.0", - "windows-sys 0.61.1", + "socket2 0.6.1", + "windows-sys 0.61.2", ] [[package]] name = "tokio-util" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -3504,9 +3477,9 @@ version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -3526,9 +3499,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-bidi" @@ -3538,24 +3511,24 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-normalization" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-width" @@ -3565,9 +3538,9 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-width" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" @@ -3589,9 +3562,9 @@ dependencies = [ [[package]] name = "utf8-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" +checksum = "1292c0d970b54115d14f2492fe0170adf21d68a1de108eebc51c1df4f346a091" [[package]] name = "utf8_iter" @@ -3607,9 +3580,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" dependencies = [ "js-sys", "wasm-bindgen", @@ -3617,9 +3590,9 @@ dependencies = [ [[package]] name = "value-bag" -version = "1.11.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" +checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0" [[package]] name = "vcpkg" @@ -3654,15 +3627,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" -dependencies = [ - "wasip2", -] - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -3680,9 +3644,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.104" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", @@ -3691,25 +3655,11 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", - "wasm-bindgen-shared", -] - [[package]] name = "wasm-bindgen-futures" -version = "0.4.54" +version = "0.4.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" dependencies = [ "cfg-if", "js-sys", @@ -3720,41 +3670,41 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.104" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ - "quote 1.0.41", + "quote 1.0.42", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.104" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", - "wasm-bindgen-backend", + "bumpalo", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.104" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.81" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" dependencies = [ "js-sys", "wasm-bindgen", @@ -3804,7 +3754,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -3815,9 +3765,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.62.1" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", @@ -3828,46 +3778,46 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.1" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] name = "windows-interface" -version = "0.59.2" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] name = "windows-link" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] @@ -3905,14 +3855,14 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.4", + "windows-targets 0.53.5", ] [[package]] name = "windows-sys" -version = "0.61.1" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] @@ -3950,19 +3900,19 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.4" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ "windows-link", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -3979,9 +3929,9 @@ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" @@ -3997,9 +3947,9 @@ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" @@ -4015,9 +3965,9 @@ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" @@ -4027,9 +3977,9 @@ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" @@ -4045,9 +3995,9 @@ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" @@ -4063,9 +4013,9 @@ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" @@ -4081,9 +4031,9 @@ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" @@ -4099,9 +4049,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" @@ -4127,9 +4077,9 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "xshell" @@ -4172,11 +4122,10 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -4184,34 +4133,34 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] [[package]] @@ -4229,9 +4178,9 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", "synstructure", ] @@ -4243,9 +4192,9 @@ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", "yoke", @@ -4254,9 +4203,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -4265,11 +4214,11 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ - "proc-macro2 1.0.101", - "quote 1.0.41", - "syn 2.0.106", + "proc-macro2 1.0.103", + "quote 1.0.42", + "syn 2.0.111", ] diff --git a/Cargo.toml b/Cargo.toml index 07249bc3e8e..afc82b1fb3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,6 @@ generational-arena = "0.2.8" regex = "1" shell-words = "1.1.0" plc_derive = { path = "./compiler/plc_derive" } -lld_rs = { git = "https://github.com/mun-lang/lld-rs", rev = "3798ace" } which = "4.2.5" log.workspace = true inkwell.workspace = true @@ -84,8 +83,13 @@ members = [ default-members = [".", "compiler/plc_driver", "compiler/plc_xml"] [workspace.dependencies] +# TODO: Version 0.7 and LLVM 21 are incompatible because of https://github.com/TheDan64/inkwell/pull/628. +# We should however move to 0.8 once released, and remove the git version dependency +inkwell = { git = "https://github.com/TheDan64/inkwell.git", rev = "7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98", features = [ + "llvm21-1", +] } + insta = { version = "1.31.0", features = ["filters"] } -inkwell = { version = "0.6", features = ["llvm14-0"] } encoding_rs = "0.8" encoding_rs_io = "0.1" log = "0.4" diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..ed8aab2a7b3 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +.PHONY: test report status-debug + +test: + @clear + cargo nextest run --no-fail-fast --workspace && ./scripts/build.sh --lit + +report: + @clear + @cargo nextest run --no-fail-fast --workspace 2>&1 | \ + awk "/thread '.*' \\([0-9]+\\) panicked at/ { \ + match(\$$0, /thread '[^']+'/); \ + test = substr(\$$0, RSTART+8, RLENGTH-9); \ + match(\$$0, /panicked at [^:]+:[0-9]+:[0-9]+/); \ + loc = substr(\$$0, RSTART, RLENGTH); \ + count[loc]++; \ + total++; \ + if (tests[loc] == \"\") tests[loc] = test; \ + else if (split(tests[loc], arr, \"|\") < 10) tests[loc] = tests[loc] \"|\" test; \ + } END { \ + for (k in count) print count[k] \"\t\" k \"\t\" tests[k]; \ + print \"TOTAL\t\" total; \ + }" | sort -rn | while IFS=$$'\t' read cnt loc names; do \ + if [ "$$cnt" = "TOTAL" ]; then \ + echo ""; \ + echo "========================================"; \ + echo "Total failed tests: $$loc"; \ + else \ + echo ""; \ + echo "$$cnt $$loc"; \ + echo "$$names" | tr '|' '\n' | sed 's/^/ /'; \ + fi; \ + done diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_function_call.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_function_call.snap index 8cdd30a2d1e..599117b60fb 100644 --- a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_function_call.snap +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_function_call.snap @@ -1,7 +1,6 @@ --- -source: compiler/plc_driver/./src/tests/external_files.rs +source: compiler/plc_driver/src/tests/external_files.rs expression: "results.join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'main.st' source_filename = "main.st" @@ -11,9 +10,9 @@ target triple = "[filtered]" define i16 @main() { entry: %main = alloca i16, align 2 - store i16 0, i16* %main, align 2 + store i16 0, ptr %main, align 2 %call = call i16 @external() - %main_ret = load i16, i16* %main, align 2 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } @@ -31,7 +30,7 @@ source_filename = "__init___TestProject" target datalayout = "[filtered]" target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___TestProject, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___TestProject, ptr null }] define void @__init___TestProject() { entry: diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_global_var.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_global_var.snap index e22e906de82..7429ec4568d 100644 --- a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_global_var.snap +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__external_file_global_var.snap @@ -1,7 +1,6 @@ --- -source: compiler/plc_driver/./src/tests/external_files.rs +source: compiler/plc_driver/src/tests/external_files.rs expression: "results.join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'main.st' source_filename = "main.st" @@ -14,11 +13,11 @@ target triple = "[filtered]" define i16 @main() { entry: %main = alloca i16, align 2 - store i16 0, i16* %main, align 2 - store i16 2, i16* @x, align 2 - store i16 2, i16* @y, align 2 + store i16 0, ptr %main, align 2 + store i16 2, ptr @x, align 2 + store i16 2, ptr @y, align 2 %call = call i16 @external() - %main_ret = load i16, i16* %main, align 2 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } @@ -39,7 +38,7 @@ source_filename = "__init___TestProject" target datalayout = "[filtered]" target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___TestProject, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___TestProject, ptr null }] define void @__init___TestProject() { entry: diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_in_different_locations_with_debug_info.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_in_different_locations_with_debug_info.snap index 57e8c660916..2bc8d7fb35d 100644 --- a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_in_different_locations_with_debug_info.snap +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_in_different_locations_with_debug_info.snap @@ -14,19 +14,14 @@ target triple = "[filtered]" define i16 @main() !dbg !4 { entry: %main = alloca i16, align 2 - call void @llvm.dbg.declare(metadata i16* %main, metadata !9, metadata !DIExpression()), !dbg !11 - store i16 0, i16* %main, align 2 - call void @mainProg(%mainProg* @mainProg_instance), !dbg !12 - %main_ret = load i16, i16* %main, align 2, !dbg !13 + #dbg_declare(ptr %main, !9, !DIExpression(), !11) + store i16 0, ptr %main, align 2 + call void @mainProg(ptr @mainProg_instance), !dbg !12 + %main_ret = load i16, ptr %main, align 2, !dbg !13 ret i16 %main_ret, !dbg !13 } -declare !dbg !14 void @mainProg(%mainProg*) - -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } +declare !dbg !14 void @mainProg(ptr) !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} @@ -60,17 +55,12 @@ target triple = "[filtered]" @mainProg_instance = global %mainProg zeroinitializer, !dbg !0 -define void @mainProg(%mainProg* %0) !dbg !10 { +define void @mainProg(ptr %0) !dbg !10 { entry: - call void @llvm.dbg.declare(metadata %mainProg* %0, metadata !13, metadata !DIExpression()), !dbg !14 + #dbg_declare(ptr %0, !13, !DIExpression(), !14) ret void, !dbg !14 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!5, !6} !llvm.dbg.cu = !{!7} @@ -99,19 +89,19 @@ target triple = "[filtered]" @mainProg_instance = external global %mainProg -define void @__init_mainprog(%mainProg* %0) { +define void @__init_mainprog(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -define void @__user_init_mainProg(%mainProg* %0) { +define void @__user_init_mainProg(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } @@ -123,17 +113,17 @@ target triple = "[filtered]" %mainProg = type {} @mainProg_instance = external global %mainProg -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___TestProject, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___TestProject, ptr null }] define void @__init___TestProject() { entry: - call void @__init_mainprog(%mainProg* @mainProg_instance) - call void @__user_init_mainProg(%mainProg* @mainProg_instance) + call void @__init_mainprog(ptr @mainProg_instance) + call void @__user_init_mainProg(ptr @mainProg_instance) ret void } -declare void @__init_mainprog(%mainProg*) +declare void @__init_mainprog(ptr) -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -declare void @__user_init_mainProg(%mainProg*) +declare void @__user_init_mainProg(ptr) diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_with_debug_info.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_with_debug_info.snap index b7153843aae..2ff6905879e 100644 --- a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_with_debug_info.snap +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_files_with_debug_info.snap @@ -14,19 +14,14 @@ target triple = "[filtered]" define i16 @main() !dbg !4 { entry: %main = alloca i16, align 2 - call void @llvm.dbg.declare(metadata i16* %main, metadata !9, metadata !DIExpression()), !dbg !11 - store i16 0, i16* %main, align 2 - call void @mainProg(%mainProg* @mainProg_instance), !dbg !12 - %main_ret = load i16, i16* %main, align 2, !dbg !13 + #dbg_declare(ptr %main, !9, !DIExpression(), !11) + store i16 0, ptr %main, align 2 + call void @mainProg(ptr @mainProg_instance), !dbg !12 + %main_ret = load i16, ptr %main, align 2, !dbg !13 ret i16 %main_ret, !dbg !13 } -declare !dbg !14 void @mainProg(%mainProg*) - -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } +declare !dbg !14 void @mainProg(ptr) !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} @@ -60,17 +55,12 @@ target triple = "[filtered]" @mainProg_instance = global %mainProg zeroinitializer, !dbg !0 -define void @mainProg(%mainProg* %0) !dbg !10 { +define void @mainProg(ptr %0) !dbg !10 { entry: - call void @llvm.dbg.declare(metadata %mainProg* %0, metadata !13, metadata !DIExpression()), !dbg !14 + #dbg_declare(ptr %0, !13, !DIExpression(), !14) ret void, !dbg !14 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!5, !6} !llvm.dbg.cu = !{!7} @@ -99,19 +89,19 @@ target triple = "[filtered]" @mainProg_instance = external global %mainProg -define void @__init_mainprog(%mainProg* %0) { +define void @__init_mainprog(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -define void @__user_init_mainProg(%mainProg* %0) { +define void @__user_init_mainProg(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } @@ -123,17 +113,17 @@ target triple = "[filtered]" %mainProg = type {} @mainProg_instance = external global %mainProg -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___TestProject, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___TestProject, ptr null }] define void @__init___TestProject() { entry: - call void @__init_mainprog(%mainProg* @mainProg_instance) - call void @__user_init_mainProg(%mainProg* @mainProg_instance) + call void @__init_mainprog(ptr @mainProg_instance) + call void @__user_init_mainProg(ptr @mainProg_instance) ret void } -declare void @__init_mainprog(%mainProg*) +declare void @__init_mainprog(ptr) -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -declare void @__user_init_mainProg(%mainProg*) +declare void @__user_init_mainProg(ptr) diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_source_files_generated.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_source_files_generated.snap index f5949e19cf4..5999608f00e 100644 --- a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_source_files_generated.snap +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__multi_files__multiple_source_files_generated.snap @@ -1,7 +1,6 @@ --- -source: compiler/plc_driver/./src/tests/multi_files.rs +source: compiler/plc_driver/src/tests/multi_files.rs expression: "results.join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'external_file1.st' source_filename = "external_file1.st" @@ -15,13 +14,13 @@ target triple = "[filtered]" define i16 @main() { entry: %main = alloca i16, align 2 - store i16 0, i16* %main, align 2 - call void @mainProg(%mainProg* @mainProg_instance) - %main_ret = load i16, i16* %main, align 2 + store i16 0, ptr %main, align 2 + call void @mainProg(ptr @mainProg_instance) + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) ; ModuleID = 'external_file2.st' source_filename = "external_file2.st" @@ -32,7 +31,7 @@ target triple = "[filtered]" @mainProg_instance = global %mainProg zeroinitializer -define void @mainProg(%mainProg* %0) { +define void @mainProg(ptr %0) { entry: ret void } @@ -46,19 +45,19 @@ target triple = "[filtered]" @mainProg_instance = external global %mainProg -define void @__init_mainprog(%mainProg* %0) { +define void @__init_mainprog(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -define void @__user_init_mainProg(%mainProg* %0) { +define void @__user_init_mainProg(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } @@ -70,17 +69,17 @@ target triple = "[filtered]" %mainProg = type {} @mainProg_instance = external global %mainProg -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___TestProject, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___TestProject, ptr null }] define void @__init___TestProject() { entry: - call void @__init_mainprog(%mainProg* @mainProg_instance) - call void @__user_init_mainProg(%mainProg* @mainProg_instance) + call void @__init_mainprog(ptr @mainProg_instance) + call void @__user_init_mainProg(ptr @mainProg_instance) ret void } -declare void @__init_mainprog(%mainProg*) +declare void @__init_mainprog(ptr) -declare void @mainProg(%mainProg*) +declare void @mainProg(ptr) -declare void @__user_init_mainProg(%mainProg*) +declare void @__user_init_mainProg(ptr) diff --git a/src/builtins.rs b/src/builtins.rs index 9a23752eb46..2e457403acd 100644 --- a/src/builtins.rs +++ b/src/builtins.rs @@ -194,7 +194,8 @@ lazy_static! { builder.position_at_end(insert_block); builder.build_switch(k.into_int_value(), continue_block, &cases)?; builder.position_at_end(continue_block); - Ok(ExpressionValue::LValue(result_var)) + let pointee = result_type; + Ok(ExpressionValue::LValue(result_var, pointee)) } else { Err(Diagnostic::codegen_error("Invalid signature for MUX", location).into()) } @@ -239,7 +240,16 @@ lazy_static! { let sel = generator.llvm.builder.build_select(cond, in1, in0, "")?; if sel.is_pointer_value(){ - Ok(ExpressionValue::LValue(sel.into_pointer_value())) + // The `select` instruction requires the to be selected values to be of the same + // type, hence for the pointee we can choose either one + let pointee = { + // TODO: The code above could be simplified by reducing the two ifs into one, + // and also store the type somehwere so we don't need to re-do it for the pointee here + let datatype = generator.annotations.get_type(actual_in0, generator.index).unwrap(); + generator.llvm_index.get_associated_type(datatype.get_name()).unwrap() + }; + + Ok(ExpressionValue::LValue(sel.into_pointer_value(), pointee)) } else { Ok(ExpressionValue::RValue(sel)) } @@ -922,8 +932,9 @@ fn generate_variable_length_array_bound_function<'ink>( )); }; + let pointee = generator.llvm_index.get_associated_type(data_type_information.get_name())?; let vla = generator.generate_lvalue(actual_vla).unwrap(); - let dim = builder.build_struct_gep(vla, 1, "dim").unwrap(); + let dim = builder.build_struct_gep(pointee, vla, 1, "dim").unwrap(); let accessor = match actual_dim.get_stmt() { // e.g. LOWER_BOUND(arr, 1) @@ -965,9 +976,11 @@ fn generate_variable_length_array_bound_function<'ink>( } } }; - let gep_bound = - unsafe { llvm.builder.build_in_bounds_gep(dim, &[llvm.i32_type().const_zero(), accessor], "") }?; - let bound = llvm.builder.build_load(gep_bound, "")?; + let pointee = pointee.into_struct_type().get_field_type_at_index(1).unwrap(); + let gep_bound = unsafe { + llvm.builder.build_in_bounds_gep(pointee, dim, &[llvm.i32_type().const_zero(), accessor], "") + }?; + let bound = llvm.builder.build_load(llvm.i32_type(), gep_bound, "")?; Ok(ExpressionValue::RValue(bound)) } else { diff --git a/src/codegen.rs b/src/codegen.rs index 6060e730a86..c7a365eb7ae 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -243,7 +243,7 @@ impl<'ink> CodeGen<'ink> { .try_into() .expect("the computed custom GOT size is too large"); - let ptr_ty = llvm.context.i8_type().ptr_type(AddressSpace::default()); + let ptr_ty = llvm.context.ptr_type(AddressSpace::default()); let empty_got = ptr_ty .const_array(vec![ptr_ty.const_null(); got_size as usize].as_slice()) .as_basic_value_enum(); diff --git a/src/codegen/debug.rs b/src/codegen/debug.rs index e5488e99c9b..6cce16285fc 100644 --- a/src/codegen/debug.rs +++ b/src/codegen/debug.rs @@ -288,7 +288,7 @@ impl<'ink> DebugBuilder<'ink> { let res = self .debug_info .create_basic_type(name, size, encoding as u32, DIFlagsConstants::PUBLIC) - .map_err(|err| Diagnostic::codegen_error(err, location))?; + .map_err(|err| Diagnostic::codegen_error(err.to_string(), location))?; self.register_concrete_type(name, DebugType::Basic(res)); Ok(()) } @@ -435,7 +435,7 @@ impl<'ink> DebugBuilder<'ink> { DebugEncoding::DW_ATE_unsigned as u32, DIFlagsConstants::PUBLIC, ) - .map_err(|err| Diagnostic::codegen_error(err, SourceLocation::undefined()))?, + .map_err(|err| Diagnostic::codegen_error(err.to_string(), SourceLocation::undefined()))?, ) } else { self.get_or_create_debug_type(inner_type, index, types_index)? @@ -1048,9 +1048,44 @@ impl<'ink> Debug<'ink> for DebugBuilder<'ink> { scope, None, ); + let key = VariableKey::new(name, Some(&function_scope.linking_context.get_call_name_for_ir())); let variable = self.variables.get(&key); - self.debug_info.insert_declare_at_end(value, variable.copied(), None, location, block); + + if variable.is_none() { + // LLVM 19+ crashes with a segfault when `LLVMDIBuilderInsertDeclareRecordAtEnd` receives + // a null DILocalVariable pointer. Skip inserting the debug declare if the variable + // wasn't registered. To test, the unit test`actions_debug` should segfault when not + // early-returning here. + return; + } + + // Workaround until inkwell 0.8 is released, see https://github.com/TheDan64/inkwell/issues/613 + fn insert_declare_at_end_raw( + debug_info: &DebugInfoBuilder, + storage: PointerValue, + var_info: Option, + expr: Option, + debug_loc: inkwell::debug_info::DILocation, + block: BasicBlock, + ) { + // When expr is None, we create an empty expression (same as inkwell does internally). + let expr = expr.unwrap_or_else(|| debug_info.create_expression(vec![])); + unsafe { + inkwell::llvm_sys::debuginfo::LLVMDIBuilderInsertDeclareRecordAtEnd( + debug_info.as_mut_ptr(), + inkwell::values::AsValueRef::as_value_ref(&storage), + var_info.map(|v| v.as_mut_ptr()).unwrap_or(std::ptr::null_mut()), + expr.as_mut_ptr(), + debug_loc.as_mut_ptr(), + block.as_mut_ptr(), + ); + } + } + + // TODO: Replace function call below with `self.debug_info.insert_declare_at_end(value, variable.copied(), None, location, block);` + // once inkwell 0.8 is released. + insert_declare_at_end_raw(&self.debug_info, value, variable.copied(), None, location, block); } fn finalize(&self) { diff --git a/src/codegen/generators/data_type_generator.rs b/src/codegen/generators/data_type_generator.rs index 44fc56923ab..80c603ba9d1 100644 --- a/src/codegen/generators/data_type_generator.rs +++ b/src/codegen/generators/data_type_generator.rs @@ -1,8 +1,7 @@ // Copyright (c) 2020 Ghaith Hachem and Mathias Rieder use crate::codegen::debug::Debug; -use crate::codegen::llvm_index::TypeHelper; use crate::codegen::CodegenError; -use crate::index::{FxIndexSet, Index, PouIndexEntry, VariableIndexEntry, VariableType}; +use crate::index::{FxIndexSet, Index, VariableIndexEntry, VariableType}; use crate::resolver::{AstAnnotations, Dependency}; use crate::typesystem::{self, DataTypeInformation, Dimension, StringEncoding, StructSource}; use crate::{ @@ -14,9 +13,8 @@ use crate::{ typesystem::DataType, }; -use inkwell::types::{AnyType, AnyTypeEnum, FunctionType}; +use inkwell::types::{AnyType, AnyTypeEnum, BasicTypeEnum}; use inkwell::{ - types::{BasicType, BasicTypeEnum}, values::{BasicValue, BasicValueEnum}, AddressSpace, }; @@ -276,14 +274,8 @@ impl<'ink> DataTypeGenerator<'ink, '_> { .map_err(Into::into) .and_then(|data_type| self.create_type(name, data_type)), DataTypeInformation::Void => Ok(get_llvm_int_type(self.llvm.context, 32, "Void").into()), - DataTypeInformation::Pointer { inner_type_name, .. } => { - let inner_type = if information.is_function_pointer() { - self.create_function_type(inner_type_name)?.as_any_type_enum() - } else { - self.create_type(inner_type_name, self.index.get_type(inner_type_name)?)? - }; - - Ok(inner_type.create_ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into()) + DataTypeInformation::Pointer { .. } => { + Ok(self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into()) } DataTypeInformation::Generic { .. } => { unreachable!("Generic types should not be generated") @@ -291,66 +283,6 @@ impl<'ink> DataTypeGenerator<'ink, '_> { } } - fn create_function_type(&mut self, method_name: &str) -> Result, Diagnostic> { - let return_type = self - .types_index - .find_associated_type(self.index.get_return_type_or_void(method_name).get_name()) - .map(|opt| opt.as_any_type_enum()) - .unwrap_or(self.llvm.context.void_type().as_any_type_enum()); - - let mut parameter_types = Vec::new(); - - match self.index.find_pou(method_name) { - Some(PouIndexEntry::Method { parent_name, .. }) => { - let ty = self.types_index.get_associated_type(parent_name).expect("must exist"); - let ty_ptr = ty.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(); - - // Methods are defined as functions in the LLVM IR, but carry the underlying POU type as their - // first parameter to operate on them, hence push the POU type to the very first position. - parameter_types.push(ty_ptr); - - for parameter in self.index.get_declared_parameters(method_name) { - // Instead of relying on the LLVM index, we create data-types on the fly here because some - // types have not yet been visited and as a result may not be in the index. For example at - // the time of writing this the index was not able to find a input parameter of type - // `__auto_pointer_to_DINT`, consequently panicking - let ty = self.create_type( - parameter.get_name(), - self.index.get_type(¶meter.data_type_name).expect("must exist"), - )?; - - parameter_types.push(ty.try_into().unwrap()); - } - } - - Some(PouIndexEntry::FunctionBlock { name, .. }) => { - let ty = self.types_index.get_associated_type(name).expect("must exist"); - let ty_ptr = ty.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(); - - // Function blocks are a bit "weird" in that they only expect an instance argument even if - // they define input, output and/or inout parameters. Effectively, while being methods per-se, - // their calling convention differs from regular methods. - parameter_types.push(ty_ptr); - } - - _ => unreachable!("internal error, invalid method call"), - } - - let fn_type = match return_type { - AnyTypeEnum::ArrayType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::FloatType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::IntType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::PointerType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::StructType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::VectorType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::VoidType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::ScalableVectorType(value) => value.fn_type(parameter_types.as_slice(), false), - AnyTypeEnum::FunctionType(_) => unreachable!(), - }; - - Ok(fn_type) - } - fn generate_initial_value( &mut self, data_type: &DataType, diff --git a/src/codegen/generators/expression_generator.rs b/src/codegen/generators/expression_generator.rs index 7dfbe04c9f5..ef96ac599b3 100644 --- a/src/codegen/generators/expression_generator.rs +++ b/src/codegen/generators/expression_generator.rs @@ -2,14 +2,13 @@ use inkwell::{ builder::Builder, - types::{BasicType, BasicTypeEnum, FunctionType}, + types::{BasicType, BasicTypeEnum}, values::{ - ArrayValue, BasicMetadataValueEnum, BasicValue, BasicValueEnum, CallSiteValue, CallableValue, - FloatValue, IntValue, PointerValue, ScalableVectorValue, StructValue, VectorValue, + ArrayValue, BasicMetadataValueEnum, BasicValue, BasicValueEnum, CallSiteValue, FloatValue, IntValue, + PointerValue, ScalableVectorValue, StructValue, ValueKind, VectorValue, }, AddressSpace, FloatPredicate, IntPredicate, }; -use itertools::Either; use rustc_hash::FxHashSet; use plc_ast::{ @@ -27,9 +26,8 @@ use plc_util::convention::qualified_name; use crate::{ codegen::{ debug::{Debug, DebugBuilderEnum}, - generators::llvm::FundamentalElementType, llvm_index::LlvmTypedIndex, - llvm_typesystem::{cast_if_needed, get_llvm_int_type}, + llvm_typesystem::cast_if_needed, CodegenError, }, index::{ @@ -39,7 +37,7 @@ use crate::{ resolver::{AnnotationMap, AstAnnotations, StatementAnnotation}, typesystem::{ self, is_same_type_class, DataType, DataTypeInformation, DataTypeInformationProvider, Dimension, - StringEncoding, VarArgs, DEFAULT_STRING_LEN, DINT_TYPE, INT_SIZE, INT_TYPE, LINT_TYPE, + StringEncoding, VarArgs, DEFAULT_STRING_LEN, DINT_TYPE, LINT_TYPE, }, }; @@ -82,7 +80,7 @@ struct CallParameterAssignment<'a, 'b> { pub enum ExpressionValue<'ink> { /// A Locator-Value /// An lvalue (locator value) represents an object that occupies some identifiable location in memory (i.e. has an address). - LValue(PointerValue<'ink>), + LValue(PointerValue<'ink>, BasicTypeEnum<'ink>), /// An expression that does not represent an object occupying some identifiable location in memory. RValue(BasicValueEnum<'ink>), } @@ -91,8 +89,8 @@ impl<'ink> ExpressionValue<'ink> { /// returns the value represented by this ExpressionValue pub fn get_basic_value_enum(&self) -> BasicValueEnum<'ink> { match self { - ExpressionValue::LValue(it) => it.as_basic_value_enum(), - ExpressionValue::RValue(it) => it.to_owned(), + ExpressionValue::LValue(value, _) => value.as_basic_value_enum(), + ExpressionValue::RValue(value) => value.to_owned(), } } @@ -104,8 +102,10 @@ impl<'ink> ExpressionValue<'ink> { load_name: Option, ) -> Result, CodegenError> { match self { - ExpressionValue::LValue(it) => llvm.load_pointer(it, load_name.as_deref().unwrap_or("")), - ExpressionValue::RValue(it) => Ok(it.to_owned()), + ExpressionValue::LValue(value, pointee) => { + llvm.load_pointer(*pointee, value, load_name.as_deref().unwrap_or_default()) + } + ExpressionValue::RValue(value) => Ok(value.to_owned()), } } } @@ -235,14 +235,25 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let message = format!("Cannot find '{}' in associated variable values", this_name); Diagnostic::codegen_error(message, expression) })?; - Ok(ExpressionValue::LValue(this_value)) + + let pointee = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(); + Ok(ExpressionValue::LValue(this_value, pointee)) } AstStatement::ReferenceExpr(data) => { let res = self.generate_reference_expression(&data.access, data.base.as_deref(), expression)?; let val = match res { - ExpressionValue::LValue(val) => { - ExpressionValue::LValue(self.auto_deref_if_necessary(val, expression)?) + ExpressionValue::LValue(value, _) => { + let value = self.auto_deref_if_necessary(value, expression)?; + let pointee = { + // TODO: I think it should be safe to fetch the pointee this way and return it + // as a result in `ExpressionValue::LValue` but not 100% sure + let datatype = self.annotations.get_type(expression, self.index).unwrap(); + let effective_ty = self.index.find_effective_type(datatype).unwrap_or(datatype); + self.llvm_index.get_associated_type(&effective_ty.name).unwrap() + }; + + ExpressionValue::LValue(value, pointee) } ExpressionValue::RValue(val) => { let val = if val.is_pointer_value() { @@ -256,9 +267,16 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { }; Ok(val) } - AstStatement::HardwareAccess(..) => self - .create_llvm_pointer_value_for_reference(None, "address", expression) - .map(ExpressionValue::LValue), + AstStatement::HardwareAccess(..) => { + let value = self.create_llvm_pointer_value_for_reference(None, "address", expression)?; + let pointee = { + let datatype = self.annotations.get_type(expression, self.index).unwrap(); + self.llvm_index.get_associated_type(datatype.get_name()).unwrap() + }; + + Ok(ExpressionValue::LValue(value, pointee)) + } + AstStatement::BinaryExpression(data) => self .generate_binary_expression(&data.left, &data.right, &data.operator, expression) .map(ExpressionValue::RValue), @@ -306,69 +324,6 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { self.generate_expression_value(const_expression) } - /// Generate an access to the appropriate GOT entry to achieve an access to the given base - /// lvalue. - pub fn generate_got_access( - &self, - context: &AstNode, - llvm_type: &BasicTypeEnum<'ink>, - ) -> Result>, CodegenError> { - match self.annotations.get(context) { - Some(StatementAnnotation::Variable { qualified_name, .. }) => { - // We will generate a GEP, which has as its base address the magic constant which - // will eventually be replaced by the location of the GOT. - let base = - self.llvm.context.i64_type().const_int(0xdeadbeef00000000, false).const_to_pointer( - llvm_type.ptr_type(AddressSpace::default()).ptr_type(AddressSpace::default()), - ); - - self.llvm_index - .find_got_index(qualified_name) - .map(|idx| { - let ptr = self.llvm.load_array_element( - base, - &[self.llvm.context.i32_type().const_int(idx, false)], - "", - )?; - Ok(self.llvm.load_pointer(&ptr, "")?.into_pointer_value()) - }) - .transpose() - } - _ => Ok(None), - } - } - - /// Generate an access to the appropriate GOT entry to achieve a call to the given function. - pub fn generate_got_call( - &self, - qualified_name: &str, - function_type: &FunctionType<'ink>, - args: &[BasicMetadataValueEnum<'ink>], - ) -> Result>, CodegenError> { - // We will generate a GEP, which has as its base address the magic constant which - // will eventually be replaced by the location of the GOT. - let base = self.llvm.context.i64_type().const_int(0xdeadbeef00000000, false).const_to_pointer( - function_type.ptr_type(AddressSpace::default()).ptr_type(AddressSpace::default()), - ); - - self.llvm_index - .find_got_index(qualified_name) - .map(|idx| { - let mut ptr = self.llvm.load_array_element( - base, - &[self.llvm.context.i32_type().const_int(idx, false)], - "", - )?; - ptr = self.llvm.load_pointer(&ptr, "")?.into_pointer_value(); - let callable = CallableValue::try_from(ptr).map_err(|_| { - CodegenError::new("Pointer was not a function pointer", SourceLocation::undefined()) - })?; - - Ok(self.llvm.builder.build_call(callable, args, "call")?) - }) - .transpose() - } - /// generates a binary expression (e.g. a + b, x AND y, etc.) and returns the resulting `BasicValueEnum` /// - `left` the AstStatement left of the operator /// - `right` the AstStatement right of the operator @@ -556,17 +511,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { // Check for the function within the GOT. If it's there, we need to generate an indirect // call to its location within the GOT, which should contain a function pointer. // First get the function type so our function pointer can have the correct type. - let qualified_name = self - .annotations - .get_qualified_name(operator) - .expect("Shouldn't have got this far without a name for the function"); - let function_type = function.get_type(); - let call = self.generate_got_call(qualified_name, &function_type, &arguments_list)?; - let call = if let Some(call) = call { - call - } else { - self.llvm.builder.build_call(function, &arguments_list, "call")? - }; + let call = self.llvm.builder.build_call(function, &arguments_list, "call")?; // if the target is a function, declare the struct locally // assign all parameters into the struct values @@ -574,17 +519,15 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { // so grab either: // - the call's return value // - or a null-ptr - let value = call - .try_as_basic_value() - .either(Ok, |_| { - // we return an uninitialized int pointer for void methods :-/ - // dont deref it!! - Ok(get_llvm_int_type(self.llvm.context, INT_SIZE, INT_TYPE) - .ptr_type(AddressSpace::from(ADDRESS_SPACE_CONST)) - .const_null() - .as_basic_value_enum()) - }) - .map(ExpressionValue::RValue); + let value = match call.try_as_basic_value() { + ValueKind::Basic(value) => value, + ValueKind::Instruction(_) => self + .llvm + .context + .ptr_type(AddressSpace::from(ADDRESS_SPACE_CONST)) + .const_null() + .as_basic_value_enum(), + }; // after the call we need to copy the values for assigned outputs // this is only necessary for outputs defined as `rusty::index::ArgumentType::ByVal` (PROGRAM, FUNCTION_BLOCK) @@ -598,7 +541,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { self.assign_output_values(parameter_struct, implementation_name, parameters_list)? } - value + Ok(ExpressionValue::RValue(value)) } fn generate_fnptr_call( @@ -622,8 +565,10 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { // Get the associated variable then load it, e.g. `%localFnPtrVariable = alloca void (%Fb*)*, align 8` // followed by `%1 = load void (%Fb*)*, void (%Fb*)** %localFnPtrVariable, align 8`` let function_pointer_value = match self.generate_expression_value(base)? { - ExpressionValue::LValue(value) => self.llvm.load_pointer(&value, "")?.into_pointer_value(), - ExpressionValue::RValue(_) => unreachable!(), + ExpressionValue::LValue(value, pointee) => { + self.llvm.load_pointer(pointee, &value, "")?.into_pointer_value() + } + ExpressionValue::RValue(_) => unreachable!("fnptr base must be an lvalue"), }; // Generate the argument list; our assumption is function pointers are only supported for methods and @@ -660,17 +605,29 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { (instance, arguments, generated_arguments) }; - // Finally generate the function pointer call - let callable = CallableValue::try_from(function_pointer_value).unwrap(); - let call = self + // Finally generate the function pointer call. + // We get the function type from the associated implementation stub in the llvm_index, + // and use it together with the loaded function pointer value. + let function_value = + self.llvm_index.find_associated_implementation(qualified_pou_name).ok_or_else(|| { + Diagnostic::codegen_error( + format!("No callable implementation associated to {qualified_pou_name:?}"), + operator, + ) + })?; + let function_type = function_value.get_type(); + + let call: CallSiteValue = self .llvm .builder - .build_call(callable, &arguments_llvm, "fnptr_call") + .build_indirect_call(function_type, function_pointer_value, &arguments_llvm, "fnptr_call") .map_err(CodegenError::from)?; let value = match call.try_as_basic_value() { - Either::Left(value) => value, - Either::Right(_) => get_llvm_int_type(self.llvm.context, INT_SIZE, INT_TYPE) + ValueKind::Basic(value) => value, + ValueKind::Instruction(_) => self + .llvm + .context .ptr_type(AddressSpace::from(ADDRESS_SPACE_CONST)) .const_null() .as_basic_value_enum(), @@ -821,13 +778,16 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { &self, left_statement: &AstNode, left_pointer: PointerValue, + left_type: &DataType, right_pointer: PointerValue, right_type: &DataType, ) -> Result<(), CodegenError> { - let left_value = self.llvm.builder.build_load(left_pointer, "")?.into_int_value(); + let pointee = self.llvm_index.get_associated_type(&left_type.name).unwrap(); + let left_value = self.llvm.builder.build_load(pointee, left_pointer, "")?.into_int_value(); //Generate an expression for the right size - let right = self.llvm.builder.build_load(right_pointer, "")?; + let pointee = self.llvm_index.get_associated_type(&right_type.name).unwrap(); + let right = self.llvm.builder.build_load(pointee, right_pointer, "")?; self.generate_assignment_with_direct_access( left_statement, left_value, @@ -874,11 +834,19 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let (base, _) = collect_base_and_direct_access_for_assignment(base).unwrap(); let lhs = self.generate_expression_value(base)?.get_basic_value_enum(); - let rhs = self.llvm.builder.build_struct_gep(parameter_struct, index, "").unwrap(); + let lhs_type = self.annotations.get_type(base, self.index).unwrap(); + + let pointee = self.llvm_index.get_associated_pou_type(function_name).unwrap(); + let rhs = + self.llvm.builder.build_struct_gep(pointee, parameter_struct, index, "").unwrap(); + // func(outVar => foo.bar.baz.%W3) + // ^^^^^^ ^^^^^^^^^^^^^^^ + // rhs lhs => foo.bar.baz.%W3 = outVar; self.generate_output_assignment_with_direct_access( expr, lhs.into_pointer_value(), + lhs_type, rhs, rhs_type, )?; @@ -889,12 +857,15 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let assigned_output = self.generate_lvalue(expr)?; let assigned_output_type = self.annotations.get_type_or_void(expr, self.index).get_type_information(); - let output = builder.build_struct_gep(parameter_struct, index, "").map_err(|_| { - Diagnostic::codegen_error( - format!("Cannot build generate parameter: {parameter:#?}"), - ¶meter.source_location, - ) - })?; + + let pointee = self.llvm_index.get_associated_pou_type(function_name).unwrap(); + let output = + builder.build_struct_gep(pointee, parameter_struct, index, "").map_err(|_| { + Diagnostic::codegen_error( + format!("Cannot build generate parameter: {parameter:#?}"), + ¶meter.source_location, + ) + })?; let output_value_type = self.index.get_type_information_or_void(parameter.get_type_name()); @@ -908,7 +879,8 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { parameter.source_location.clone(), )?; } else { - let output_value = builder.build_load(output, "")?; + let pointee = self.llvm_index.get_associated_type(output_value_type.get_name()).unwrap(); + let output_value = builder.build_load(pointee, output, "")?; builder.build_store(assigned_output, output_value)?; } } @@ -1126,8 +1098,8 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let value = { let value = self.generate_expression_value(argument)?; match value { - ExpressionValue::LValue(v) => v, - ExpressionValue::RValue(_v) => { + ExpressionValue::LValue(value, _) => value, + ExpressionValue::RValue(_) => { // Passed a literal to a byref parameter? let value = self.generate_expression(argument)?; let argument = self.llvm.builder.build_alloca(value.get_type(), "")?; @@ -1167,18 +1139,6 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { } } - // ...check if we can bitcast an array to a pointer, i.e. `[81 x i8]*` should be passed as a `i8*` - if value.get_type().get_element_type().is_array_type() { - let fundamental_element_type = value.into_fundamental_type(); - let res = self.llvm.builder.build_bit_cast( - value, - fundamental_element_type.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)), - "", - )?; - - return Ok(res.into_pointer_value().into()); - } - // ...otherwise no bitcasting was needed, thus return the generated element pointer as is Ok(value.into()) } @@ -1223,7 +1183,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { })?; // if the variadic argument is ByRef, wrap it in a pointer. let ty = if argument_type.is_by_ref() { - ty.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into() + self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into() } else { ty }; @@ -1235,6 +1195,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let arr_storage = self.llvm.builder.build_alloca(arr, "")?; for (i, ele) in generated_params.iter().enumerate() { let ele_ptr = self.llvm.load_array_element( + arr.as_basic_type_enum(), arr_storage, &[ self.llvm.context.i32_type().const_zero(), @@ -1248,7 +1209,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { // bitcast the array to pointer so it matches the declared function signature let arr_storage = self.llvm.builder.build_bit_cast( arr_storage, - ty.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)), + self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)), "", )?; @@ -1322,7 +1283,8 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { self.generate_expression(initial_value) } else { let ptr_value = self.llvm.builder.build_alloca(parameter_type, "")?; - Ok(self.llvm.load_pointer(&ptr_value, "")?) + let pointee = parameter_type; + Ok(self.llvm.load_pointer(pointee, &ptr_value, "")?) } } _ => { @@ -1390,12 +1352,17 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { return Ok(None); } - let pointer_to_param = builder.build_struct_gep(parameter_struct, index, "").map_err(|_| { - Diagnostic::codegen_error( - format!("Cannot build generate parameter: {expression:#?}"), - expression, - ) - })?; + let pointee = self + .llvm_index + .get_associated_pou_type(function_name) + .expect("POU type for parameter struct must exist"); + let pointer_to_param = + builder.build_struct_gep(pointee, parameter_struct, index, "").map_err(|_| { + Diagnostic::codegen_error( + format!("Cannot build generate parameter: {expression:#?}"), + expression, + ) + })?; let parameter = self .index @@ -1485,12 +1452,12 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { /// - `context` the statement to obtain the location from when returning an error fn create_llvm_pointer_value_for_reference( &self, - qualifier: Option<&PointerValue<'ink>>, + qualifier: Option<(&AstNode, PointerValue<'ink>)>, name: &str, context: &AstNode, ) -> Result, CodegenError> { let offset = &context.get_location(); - if let Some(qualifier) = qualifier { + if let Some((qualifier_node, qualifier)) = qualifier { //if we're loading a reference like PLC_PRG.ACTION we already loaded PLC_PRG pointer into qualifier, //so we should not load anything in addition for the action (or the method) match self.annotations.get(context) { @@ -1506,8 +1473,17 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { .find_fully_qualified_variable(qualified_name) .map(VariableIndexEntry::get_location_in_parent) .ok_or_else(|| Diagnostic::unresolved_reference(qualified_name, offset))?; - let gep: PointerValue<'_> = - self.llvm.get_member_pointer_from_struct(*qualifier, member_location, name)?; + let pointee = { + let datatype = self.annotations.get_type(qualifier_node, self.index).unwrap(); + self.llvm_index.get_associated_type(&datatype.name).unwrap() + }; + + let gep: PointerValue<'_> = self.llvm.get_member_pointer_from_struct( + pointee, + qualifier, + member_location, + name, + )?; return Ok(gep); } @@ -1522,27 +1498,17 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { } } - let ctx_type = self.annotations.get_type_or_void(context, self.index).get_type_information(); - // no context ... so just something like 'x' match self.annotations.get(context) { Some(StatementAnnotation::Variable { qualified_name, .. }) | Some(StatementAnnotation::Program { qualified_name, .. }) => self - .generate_got_access(context, &self.llvm_index.get_associated_type(ctx_type.get_name())?)? - .map_or( - self.llvm_index - .find_loaded_associated_variable_value(qualified_name) - .ok_or_else(|| Diagnostic::unresolved_reference(name, offset).into()), - Ok, - ), + .llvm_index + .find_loaded_associated_variable_value(qualified_name) + .ok_or_else(|| Diagnostic::unresolved_reference(name, offset).into()), _ => Err(Diagnostic::unresolved_reference(name, offset).into()), } } - fn deref(&self, accessor_ptr: PointerValue<'ink>) -> Result, CodegenError> { - Ok(self.llvm.load_pointer(&accessor_ptr, "deref")?.into_pointer_value()) - } - pub fn ptr_as_value(&self, ptr: PointerValue<'ink>) -> Result, CodegenError> { let int_type = self.llvm.context.i64_type(); Ok(if ptr.is_const() { @@ -1567,11 +1533,15 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { accessor_ptr: PointerValue<'ink>, statement: &AstNode, ) -> Result, CodegenError> { - if self.annotations.get(statement).is_some_and(|opt| opt.is_auto_deref()) { - self.deref(accessor_ptr) - } else { - Ok(accessor_ptr) + if self.annotations.get(statement).is_some_and(StatementAnnotation::is_auto_deref) { + // Normally it wouldn't be safe to just assume the pointee in the `load_pointer` call is just of + // type `ptr`. However, we return a `PointerValue` here, so LLVM actually expects a `ptr` type + // from us as it would panic with any other type otherwise. + let pointee = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(); + return Ok(self.llvm.load_pointer(pointee, &accessor_ptr, "deref")?.into_pointer_value()); } + + Ok(accessor_ptr) } /// generates the access-expression for an array-reference @@ -1626,7 +1596,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { self.generate_expression_value(reference) .map(|it| it.get_basic_value_enum().into_pointer_value()) .and_then(|lvalue| { - if let DataTypeInformation::Array { dimensions, inner_type_name, .. } = + if let DataTypeInformation::Array { name, dimensions, inner_type_name } = self.get_type_hint_info_for(reference)? { // make sure dimensions match statement list @@ -1704,66 +1674,70 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { .map_err(|_| Diagnostic::codegen_error("non-numeric index-access", access).into()) })?; - let accessor_sequence = if lvalue.get_type().get_element_type().is_array_type() { - // For typed array pointers (e.g.: [81 x i32]*): - // the first index (0) will point to the array -> [81 x i32] - // the second index (index_access) will point to the element in the array - vec![self.llvm.i32_type().const_zero(), index_access] - } else if self.index.find_effective_type_by_name(inner_type_name).is_some_and(|it| { - matches!( - it.get_type_information(), - DataTypeInformation::Array { .. } | DataTypeInformation::String { .. } - ) - }) { - // For flattened array-of-array parameters (fundamental element pointer): - // Calculate proper stride: index * element_size - // This handles cases like i8* representing [N x STRING]* or i32* representing [N x [M x i32]]* - let DataTypeInformation::Array { inner_type_name, .. } = - self.get_type_hint_info_for(reference)? - else { - log::error!("Uncaught resolve error for inner type of nested array"); - return Err(Diagnostic::codegen_error( - "Expected inner type to be resolvable", - reference, + let accessor_sequence = + if self.llvm_index.get_associated_type(name.as_str())?.is_array_type() { + // For typed array pointers (e.g.: [81 x i32]*): + // the first index (0) will point to the array -> [81 x i32] + // the second index (index_access) will point to the element in the array + vec![self.llvm.i32_type().const_zero(), index_access] + } else if self.index.find_effective_type_by_name(inner_type_name).is_some_and(|it| { + matches!( + it.get_type_information(), + DataTypeInformation::Array { .. } | DataTypeInformation::String { .. } ) - .into()); - }; - - // Get the size of the inner type (STRING or nested array) - // TODO: use `if let Some(...) if ` once rust is updated and get rid of "is_nested_array" above - let Some(inner_type) = self.index.find_effective_type_by_name(inner_type_name) else { - unreachable!("type must exist in index due to previous checks") - }; - - let element_size = match inner_type.get_type_information() { - DataTypeInformation::String { size, .. } => { - size.as_int_value(self.index).unwrap_or((DEFAULT_STRING_LEN + 1_u32).into()) - as u64 - } - DataTypeInformation::Array { dimensions, .. } => { - // For nested arrays, calculate total size - dimensions - .iter() - .map(|d| d.get_length(self.index).unwrap_or(1) as u64) - .product() - } - _ => unreachable!("Must be STRING or ARRAY type due to previous checks"), + }) { + // For flattened array-of-array parameters (fundamental element pointer): + // Calculate proper stride: index * element_size + // This handles cases like i8* representing [N x STRING]* or i32* representing [N x [M x i32]]* + let DataTypeInformation::Array { inner_type_name, .. } = + self.get_type_hint_info_for(reference)? + else { + log::error!("Uncaught resolve error for inner type of nested array"); + return Err(Diagnostic::codegen_error( + "Expected inner type to be resolvable", + reference, + ) + .into()); + }; + + // Get the size of the inner type (STRING or nested array) + // TODO: use `if let Some(...) if ` once rust is updated and get rid of "is_nested_array" above + let Some(inner_type) = self.index.find_effective_type_by_name(inner_type_name) + else { + unreachable!("type must exist in index due to previous checks") + }; + + let element_size = match inner_type.get_type_information() { + DataTypeInformation::String { size, .. } => size + .as_int_value(self.index) + .unwrap_or((DEFAULT_STRING_LEN + 1_u32).into()) + as u64, + DataTypeInformation::Array { dimensions, .. } => { + // For nested arrays, calculate total size + dimensions + .iter() + .map(|d| d.get_length(self.index).unwrap_or(1) as u64) + .product() + } + _ => unreachable!("Must be STRING or ARRAY type due to previous checks"), + }; + + let byte_offset = self.llvm.builder.build_int_mul( + index_access, + self.llvm.i32_type().const_int(element_size, false), + "array_stride_offset", + )?; + vec![byte_offset] + } else { + // lvalue is a simple pointer to type -> e.g.: i32* + // only one index (index_access) is needed to access the element + vec![index_access] }; - let byte_offset = self.llvm.builder.build_int_mul( - index_access, - self.llvm.i32_type().const_int(element_size, false), - "array_stride_offset", - )?; - vec![byte_offset] - } else { - // lvalue is a simple pointer to type -> e.g.: i32* - // only one index (index_access) is needed to access the element - vec![index_access] - }; - // load the access from that array - let pointer = self.llvm.load_array_element(lvalue, &accessor_sequence, "tmpVar")?; + let pointee = self.llvm_index.get_associated_type(name).unwrap(); + let pointer = + self.llvm.load_array_element(pointee, lvalue, &accessor_sequence, "tmpVar")?; return Ok(pointer); } @@ -1793,28 +1767,33 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let result = match operator { Operator::Plus | Operator::Minus => { - let (ptr, index, name) = if left_type.is_pointer() && right_type.is_int() { + let (ptr, pointee, index, name) = if left_type.is_pointer() && right_type.is_int() { let ptr = left_expr.into_pointer_value(); + let pointee = self.llvm_index.get_associated_type(left_type.get_inner_name()).unwrap(); let index = right_expr.into_int_value(); let name = format!("access_{}", left_type.get_name()); - (Some(ptr), Some(index), Some(name)) + (Some(ptr), Some(pointee), Some(index), Some(name)) } else if left_type.is_int() && right_type.is_pointer() { let ptr = right_expr.into_pointer_value(); + let pointee = self.llvm_index.get_associated_type(right_type.get_inner_name()).unwrap(); let index = left_expr.into_int_value(); let name = format!("access_{}", right_type.get_name()); - (Some(ptr), Some(index), Some(name)) + (Some(ptr), Some(pointee), Some(index), Some(name)) } else { // if left and right are both pointers we can not perform plus/minus - (None, None, None) + (None, None, None, None) }; - if let (Some(ptr), Some(mut index), Some(name)) = (ptr, index, name) { + if let (Some(ptr), Some(pointee), Some(mut index), Some(name)) = (ptr, pointee, index, name) { // if operator is minus we need to negate the index if let Operator::Minus = operator { index = self.int_neg(index)?; } - Ok(self.llvm.load_array_element(ptr, &[index], name.as_str())?.as_basic_value_enum()) + Ok(self + .llvm + .load_array_element(pointee, ptr, &[index], name.as_str())? + .as_basic_value_enum()) } else { Err(Diagnostic::codegen_error( format!("'{operator}' operation must contain one int type").as_str(), @@ -2147,13 +2126,14 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { ) })? as usize; + let pointee = self.llvm_index.get_associated_type(expected_type.get_name()).unwrap(); match encoding { StringEncoding::Utf8 => { let literal = self.llvm_index.find_utf08_literal_string(value).map(|it| it.as_pointer_value()); if let Some((literal_value, _)) = literal.zip(self.function_context) { //global constant string - Ok(ExpressionValue::LValue(literal_value)) + Ok(ExpressionValue::LValue(literal_value, pointee)) } else { //note that .len() will give us the number of bytes, not the number of characters let actual_length = value.chars().count() + 1; // +1 to account for a final \0 @@ -2171,7 +2151,9 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { && self.function_context.is_some() { //global constant string - Ok(literal.map(|it| ExpressionValue::LValue(it.as_pointer_value())).unwrap()) + Ok(literal + .map(|it| ExpressionValue::LValue(it.as_pointer_value(), pointee)) + .unwrap()) } else { //note that .len() will give us the number of bytes, not the number of characters let actual_length = value.encode_utf16().count() + 1; // +1 to account for a final \0 @@ -2651,39 +2633,35 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { ) -> Result, CodegenError> { let builder = &self.llvm.builder; - // array access is either directly on a reference or on another array access (ARRAY OF ARRAY) - let StatementAnnotation::Variable { resulting_type: reference_type, .. } = reference_annotation else { unreachable!(); }; let struct_ptr = reference.get_basic_value_enum().into_pointer_value(); - // GEPs into the VLA struct, getting an LValue for the array pointer and the dimension array and - // dereferences the former - let arr_ptr_gep = self.llvm.builder.build_struct_gep(struct_ptr, 0, "vla_arr_gep").map_err(|_| { - Diagnostic::codegen_error("Cannot access VLA array pointer", access.get_location()) - })?; - let vla_arr_ptr = builder.build_load(arr_ptr_gep, "vla_arr_ptr")?.into_pointer_value(); - // get pointer to array containing dimension information - let dim_arr_gep = builder.build_struct_gep(struct_ptr, 1, "dim_arr")?; - - // get lengths of dimensions + let type_ = self.index.get_type_information_or_void(reference_type); + let vla_struct_type = self.llvm_index.get_associated_type(type_.get_name())?; + + let arr_ptr_gep = + builder.build_struct_gep(vla_struct_type, struct_ptr, 0, "vla_arr_gep").map_err(|_| { + Diagnostic::codegen_error("Cannot access VLA array pointer", access.get_location()) + })?; + let ptr_type = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); + let vla_arr_ptr = builder.build_load(ptr_type, arr_ptr_gep, "vla_arr_ptr")?.into_pointer_value(); + + let dim_arr_gep = builder.build_struct_gep(vla_struct_type, struct_ptr, 1, "dim_arr")?; + let Some(ndims) = type_.get_type_information().get_dimension_count() else { unreachable!() }; - // get the start/end offsets for each dimension ( ARRAY[4..10, -4..4] ...) - let index_offsets = get_indices(self.llvm, ndims, dim_arr_gep)?; + let dimensions_array_type = vla_struct_type.into_struct_type().get_field_type_at_index(1).unwrap(); + let index_offsets = get_indices(self.llvm, ndims, dim_arr_gep, dimensions_array_type)?; - // calculate the required offset from the array pointer for the given accessor statements. this is - // relatively straightforward for single-dimensional arrays, but is quite costly (O(n²)) for multi-dimensional arrays let access_statements = access.get_as_list(); let accessor = if access_statements.len() == 1 { let Some(stmt) = access_statements.first() else { unreachable!("Must have exactly 1 access statement") }; - //turn it into i32 immediately - // this is the same logic we use for normal array accessors let access_value = cast_if_needed!( self, self.index.get_type(DINT_TYPE)?, @@ -2692,21 +2670,16 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { None )?; - // if start offset is not 0, adjust the access value accordingly let Some(start_offset) = index_offsets.first().map(|(start, _)| *start) else { unreachable!("VLA must have information about dimension offsets") }; self.create_llvm_int_binary_expression(&Operator::Minus, access_value, start_offset.into())? .into_int_value() } else { - // see https://plc-lang.github.io/rusty/arch/codegen.html#multi-dimensional-arrays - // for more details on multi-dimensional array accessor calculation let accessors = access_statements .iter() .map(|it| { let value = self.generate_expression(it).expect("Uncaught invalid accessor statement"); - //turn it into i32 immediately - // this is the same logic we use for normal array accessors Ok(cast_if_needed!( self, self.index.get_type(DINT_TYPE)?, @@ -2722,23 +2695,22 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { unreachable!("Amount of access statements and dimensions does not match.") } - // length of a dimension is 'end - start + 1' let lengths = get_dimension_lengths(self.llvm, &index_offsets)?; - - // calculate the accessor multiplicators for each dimension. let dimension_offsets = get_vla_accessor_factors(self.llvm, &lengths)?; - - // adjust accessors for 0-indexing let adjusted_accessors = normalize_offsets(self.llvm, &accessors, &index_offsets)?; - // calculate the resulting accessor for the given accessor statements and dimension offsets int_value_multiply_accumulate( self.llvm, &adjusted_accessors.iter().zip(&dimension_offsets).collect::>(), )? }; - unsafe { builder.build_in_bounds_gep(vla_arr_ptr, &[accessor], "arr_val").map_err(Into::into) } + let inner_type = self.index.find_elementary_pointer_type(type_.get_type_information()); + let inner_type_name = inner_type.get_inner_array_type_name().unwrap_or_else(|| inner_type.get_name()); + let element_type = self.llvm_index.get_associated_type(inner_type_name)?; + + unsafe { builder.build_in_bounds_gep(element_type, vla_arr_ptr, &[accessor], "arr_val") } + .map_err(Into::into) } /// generates a reference expression (member, index, deref, etc.) @@ -2757,11 +2729,18 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { (ReferenceAccess::Global(node), _) => { let name = node.get_flat_reference_name().unwrap_or("unknown"); - self.create_llvm_pointer_value_for_reference( + let value = self.create_llvm_pointer_value_for_reference( None, self.get_load_name(node).as_deref().unwrap_or(name), node, - ).map(ExpressionValue::LValue) + )?; + + let pointee = { + let datatype = self.annotations.get_type(node, self.index).unwrap(); + self.llvm_index.get_associated_type(&datatype.name).unwrap() + }; + + Ok(ExpressionValue::LValue(value, pointee)) } // `base.member` or just `member` @@ -2776,28 +2755,45 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { } else { let member_name = member.get_flat_reference_name().unwrap_or("unknown"); - self.create_llvm_pointer_value_for_reference( - base_value.map(|it| it.get_basic_value_enum().into_pointer_value()).as_ref(), + let value = self.create_llvm_pointer_value_for_reference( + base_value.map(|it| (base.unwrap(), it.get_basic_value_enum().into_pointer_value())), self.get_load_name(member).as_deref().unwrap_or(member_name), original_expression, - ).map(ExpressionValue::LValue) + )?; + + let pointee = { + // TODO: Not 100% sure if correct; also I feel like `create_llvm_pointer_value_for_reference` should return an ExpressionValue? + let datatype = self.annotations.get_type(original_expression, self.index).unwrap(); + let effective_ty = self.index.find_effective_type(datatype).unwrap_or(datatype); + self.llvm_index.get_associated_type(&effective_ty.name).unwrap() + }; + + Ok(ExpressionValue::LValue(value, pointee)) } } // `base[idx]` (ReferenceAccess::Index(array_idx), Some(base)) => { if self.annotations.get_type_or_void(base, self.index).is_vla() { - // vla array needs special handling - self.generate_element_pointer_for_vla( + let value = self.generate_element_pointer_for_vla( self.generate_expression_value(base)?, self.annotations.get(base).expect(""), array_idx.as_ref(), - ) - .map_err(|_| unreachable!("invalid access statement")) - .map(ExpressionValue::LValue) + )?; + let pointee = { + let datatype = self.annotations.get_type(original_expression, self.index).unwrap(); + self.llvm_index.get_associated_type(datatype.get_name()).unwrap() + }; + Ok(ExpressionValue::LValue(value, pointee)) } else { // normal array expression - self.generate_element_pointer_for_array(base, array_idx).map(ExpressionValue::LValue) + let value = self.generate_element_pointer_for_array(base, array_idx)?; + let pointee = { + let datatype = self.annotations.get_type(original_expression, self.index).unwrap(); + self.llvm_index.get_associated_type(datatype.get_name()).unwrap() + }; + + Ok(ExpressionValue::LValue(value, pointee)) } } @@ -2818,9 +2814,8 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let target_value = self.generate_expression_value(target.as_ref())?; // Get the LLVM type for the cast target - let target_llvm_type = self.llvm_index.get_associated_type(base_type_name) - .map(|t| t.ptr_type(AddressSpace::from(0))) - .unwrap_or_else(|_| self.llvm.context.i8_type().ptr_type(AddressSpace::from(0))); + let _ = self.llvm_index.get_associated_type(base_type_name); + let target_llvm_type = self.llvm.context.ptr_type(AddressSpace::from(0)); // Perform the bitcast let basic_value = target_value.get_basic_value_enum(); @@ -2833,12 +2828,24 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { // `base^` (ReferenceAccess::Deref, Some(base)) => { - let ptr = self.generate_expression_value(base)?; - Ok(ExpressionValue::LValue( - self.llvm - .load_pointer(&ptr.get_basic_value_enum().into_pointer_value(), "deref")? - .into_pointer_value(), - )) + let base_lvalue = self.generate_expression_value(base)?; + + let value = self.llvm.load_pointer( + // Normally it wouldn't be safe to just assume the pointee in the `load_pointer` call to + // be of type `ptr`. However, we call `into_pointer_value` on the result of it, as such + // LLVM actually expects the type to be `ptr` as it will panic otherwise. + self.llvm.context.ptr_type( + AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(), + &base_lvalue.get_basic_value_enum().into_pointer_value(), + "deref" + )?; + + let pointee = { + // TODO: Not 100% sure if correct + let datatype = self.annotations.get_type(original_expression, self.index).unwrap(); + self.llvm_index.get_associated_type(&datatype.name).unwrap() + }; + Ok(ExpressionValue::LValue(value.into_pointer_value(), pointee)) } // `&base` @@ -2961,24 +2968,32 @@ fn get_indices<'ink>( llvm: &Llvm<'ink>, ndims: usize, dimensions_array: PointerValue<'ink>, + dimensions_array_type: BasicTypeEnum<'ink>, ) -> Result, IntValue<'ink>)>, CodegenError> { + let i32_type = llvm.i32_type(); (0..ndims) .map(|i| unsafe { let (start_ptr, end_ptr) = ( llvm.builder.build_in_bounds_gep( + dimensions_array_type, dimensions_array, - &[llvm.i32_type().const_zero(), llvm.i32_type().const_int(i as u64 * 2, false)], + &[i32_type.const_zero(), i32_type.const_int(i as u64 * 2, false)], format!("start_idx_ptr{i}").as_str(), )?, llvm.builder.build_in_bounds_gep( + dimensions_array_type, dimensions_array, - &[llvm.i32_type().const_zero(), llvm.i32_type().const_int(1 + i as u64 * 2, false)], + &[i32_type.const_zero(), i32_type.const_int(1 + i as u64 * 2, false)], format!("end_idx_ptr{i}").as_str(), )?, ); Ok(( - llvm.builder.build_load(start_ptr, format!("start_idx_value{i}").as_str())?.into_int_value(), - llvm.builder.build_load(end_ptr, format!("end_idx_value{i}").as_str())?.into_int_value(), + llvm.builder + .build_load(i32_type, start_ptr, format!("start_idx_value{i}").as_str())? + .into_int_value(), + llvm.builder + .build_load(i32_type, end_ptr, format!("end_idx_value{i}").as_str())? + .into_int_value(), )) }) .collect::, CodegenError>>() @@ -3045,21 +3060,19 @@ fn int_value_product<'ink>( llvm: &Llvm<'ink>, values: &[IntValue<'ink>], ) -> Result, CodegenError> { - // initialize the accumulator with 1 - let accum_ptr = llvm.builder.build_alloca(llvm.i32_type(), "accum")?; - llvm.builder.build_store(accum_ptr, llvm.i32_type().const_int(1, false))?; + let i32_type = llvm.i32_type(); + let accum_ptr = llvm.builder.build_alloca(i32_type, "accum")?; + llvm.builder.build_store(accum_ptr, i32_type.const_int(1, false))?; for val in values { - // load previous value from accumulator and multiply with current value let product = llvm.builder.build_int_mul( - llvm.builder.build_load(accum_ptr, "load_accum")?.into_int_value(), + llvm.builder.build_load(i32_type, accum_ptr, "load_accum")?.into_int_value(), *val, "product", )?; - // store new value into accumulator llvm.builder.build_store(accum_ptr, product)?; } - Ok(llvm.builder.build_load(accum_ptr, "accessor_factor")?.into_int_value()) + Ok(llvm.builder.build_load(i32_type, accum_ptr, "accessor_factor")?.into_int_value()) } /// Iterates over a collection of tuples, computes the product of the two numbers @@ -3070,22 +3083,19 @@ fn int_value_multiply_accumulate<'ink>( llvm: &Llvm<'ink>, values: &[(&IntValue<'ink>, &IntValue<'ink>)], ) -> Result, CodegenError> { - // initialize the accumulator with 0 - let accum = llvm.builder.build_alloca(llvm.i32_type(), "accum")?; - llvm.builder.build_store(accum, llvm.i32_type().const_zero())?; + let i32_type = llvm.i32_type(); + let accum = llvm.builder.build_alloca(i32_type, "accum")?; + llvm.builder.build_store(accum, i32_type.const_zero())?; for (left, right) in values { - // multiply accessor with dimension factor let product = llvm.builder.build_int_mul(**left, **right, "multiply")?; - // load previous value from accum and add product let curr = llvm.builder.build_int_add( - llvm.builder.build_load(accum, "load_accum")?.into_int_value(), + llvm.builder.build_load(i32_type, accum, "load_accum")?.into_int_value(), product, "accumulate", )?; - // store new value into accumulator llvm.builder.build_store(accum, curr)?; } - Ok(llvm.builder.build_load(accum, "accessor")?.into_int_value()) + Ok(llvm.builder.build_load(i32_type, accum, "accessor")?.into_int_value()) } // XXX: Could be problematic with https://github.com/PLC-lang/rusty/issues/668 diff --git a/src/codegen/generators/llvm.rs b/src/codegen/generators/llvm.rs index dfb12a94883..f18e9916006 100644 --- a/src/codegen/generators/llvm.rs +++ b/src/codegen/generators/llvm.rs @@ -122,13 +122,14 @@ impl<'a> Llvm<'a> { /// - `name` the name of the resulting variable pub fn load_array_element( &self, + pointee: BasicTypeEnum<'a>, pointer_to_array_instance: PointerValue<'a>, accessor_sequence: &[IntValue<'a>], name: &str, ) -> Result, CodegenError> { unsafe { self.builder - .build_in_bounds_gep(pointer_to_array_instance, accessor_sequence, name) + .build_in_bounds_gep(pointee, pointer_to_array_instance, accessor_sequence, name) .map_err(Into::into) } } @@ -141,11 +142,14 @@ impl<'a> Llvm<'a> { /// - `offset` the location in case of a Diagnostic pub fn get_member_pointer_from_struct( &self, + pointee: BasicTypeEnum<'a>, pointer_to_struct_instance: PointerValue<'a>, member_index: u32, name: &str, ) -> Result, CodegenError> { - self.builder.build_struct_gep(pointer_to_struct_instance, member_index, name).map_err(Into::into) + self.builder + .build_struct_gep(pointee, pointer_to_struct_instance, member_index, name) + .map_err(Into::into) } /// loads the value behind the given pointer @@ -154,10 +158,11 @@ impl<'a> Llvm<'a> { /// - `name` the name of the temporary variable pub fn load_pointer( &self, + pointee_ty: BasicTypeEnum<'a>, lvalue: &PointerValue<'a>, name: &str, ) -> Result, CodegenError> { - self.builder.build_load(lvalue.to_owned(), name).map_err(Into::into) + self.builder.build_load(pointee_ty, lvalue.to_owned(), name).map_err(Into::into) } /// creates a placeholder datatype for a struct with the given name @@ -216,7 +221,7 @@ impl<'a> Llvm<'a> { /// create a null pointer pub fn create_null_ptr(&self) -> Result, CodegenError> { - let itype = self.context.i32_type().ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); + let itype = self.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); let value = itype.const_null(); Ok(value.into()) } @@ -402,36 +407,3 @@ impl<'a> Llvm<'a> { Ok(()) } } - -/// A trait to get the fundamental element type from nested arrays -pub(crate) trait FundamentalElementType<'a> { - fn into_fundamental_type(self) -> BasicTypeEnum<'a>; -} - -impl<'a> FundamentalElementType<'a> for PointerValue<'a> { - /// Gets the fundamental element type from a pointer to nested arrays - /// - /// For example: `[2 x [81 x i8]]*` -> `i8`, `[3 x i32]*` -> `i32` - fn into_fundamental_type(self) -> BasicTypeEnum<'a> { - let element_type = self.get_type().get_element_type(); - if element_type.is_array_type() { - element_type.into_array_type().into_fundamental_type() - } else { - element_type.try_into().expect("Expected basic type") - } - } -} - -impl<'a> FundamentalElementType<'a> for ArrayType<'a> { - /// Recursively gets the fundamental element type from nested arrays - /// - /// For example: `[2 x [81 x i8]` -> `i8`, `[3 x i32]` -> `i32` - fn into_fundamental_type(self) -> BasicTypeEnum<'a> { - let element_type = self.get_element_type(); - if element_type.is_array_type() { - element_type.into_array_type().into_fundamental_type() - } else { - element_type - } - } -} diff --git a/src/codegen/generators/pou_generator.rs b/src/codegen/generators/pou_generator.rs index 74a9b692767..6a8f158de03 100644 --- a/src/codegen/generators/pou_generator.rs +++ b/src/codegen/generators/pou_generator.rs @@ -10,7 +10,6 @@ use super::{ use crate::{ codegen::{ debug::{Debug, DebugBuilderEnum}, - generators::llvm::FundamentalElementType, llvm_index::LlvmTypedIndex, CodegenError, }, @@ -32,14 +31,11 @@ use index::VariableType; use inkwell::{ module::{Linkage, Module}, - types::{BasicMetadataTypeEnum, BasicTypeEnum, FunctionType}, + types::{BasicMetadataTypeEnum, BasicType, BasicTypeEnum, FunctionType}, values::{BasicValue, BasicValueEnum, FunctionValue}, AddressSpace, }; -use inkwell::{ - types::{BasicType, StructType}, - values::PointerValue, -}; +use inkwell::{types::StructType, values::PointerValue}; use plc_ast::ast::{AstNode, Implementation, PouType}; use plc_diagnostics::diagnostics::{Diagnostic, INTERNAL_LLVM_ERROR}; use plc_source::source_location::SourceLocation; @@ -215,24 +211,10 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { let param = declared_parameters.get(i); let dti = param.map(|it| self.index.get_type_information_or_void(it.get_type_name())); match param { - Some(v) - if v.is_in_parameter_by_ref() && - // parameters by ref will always be a pointer - p.into_pointer_type().get_element_type().is_array_type() => - { - // for by-ref array types we will generate a pointer to the fundamental element type - // not a pointer to array - let fundamental_element_type = p - .into_pointer_type() - .get_element_type() - .into_array_type() - .into_fundamental_type(); - - let ty = fundamental_element_type.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); - - // set the new type for further codegen + Some(v) if v.is_in_parameter_by_ref() => { + // TODO: Not sure if this is 100% correct, previously it was `v.is_in_parameter_by_ref() && p.into_pointer_type().get_element_type().is_array_type()` but we don't distinguish between pointer types so just a `ptr` is fine here? + let ty = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); let _ = new_llvm_index.associate_type(v.get_type_name(), ty.into()); - ty.into() } _ => { @@ -243,15 +225,14 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { // for aggregate function parameters we will generate a pointer instead of the value type. // it will then later be memcopied into a locally allocated variable match it { - DataTypeInformation::Struct { .. } => p - .into_struct_type() + DataTypeInformation::Struct { .. } => self + .llvm + .context .ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)) .into(), DataTypeInformation::Array { .. } | DataTypeInformation::String { .. } => { - // For arrays, get the fundamental element type - let fundamental_element_type = - p.into_array_type().into_fundamental_type(); - fundamental_element_type + self.llvm + .context .ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)) .into() } @@ -345,7 +326,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { // Function pointer curr_f.as_global_value().as_basic_value_enum().get_type(), //Data - self.llvm.context.i8_type().ptr_type(AddressSpace::default()).as_basic_type_enum(), + self.llvm.context.ptr_type(AddressSpace::default()).as_basic_type_enum(), ], false, ); @@ -354,7 +335,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { let str_value = ctor_str.const_named_struct(&[ self.llvm.context.i32_type().const_zero().as_basic_value_enum(), curr_f.as_global_value().as_basic_value_enum(), - self.llvm.context.i8_type().ptr_type(AddressSpace::default()).const_zero().as_basic_value_enum(), + self.llvm.context.ptr_type(AddressSpace::default()).const_zero().as_basic_value_enum(), ]); //Create an array with the global constructor as an entry let arr = ctor_str.const_array(&[str_value]); @@ -377,11 +358,11 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { ) -> Result>, CodegenError> { if !implementation.implementation_type.is_function_method_or_init() { let mut parameters = vec![]; - let instance_struct_type: StructType = self + let _instance_struct_type: StructType = self .llvm_index .get_associated_pou_type(implementation.get_type_name()) .map(|it| it.into_struct_type())?; - parameters.push(instance_struct_type.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into()); + parameters.push(self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into()); Ok(parameters) } else { let declared_params = self.index.get_declared_parameters(implementation.get_call_name()); @@ -394,12 +375,10 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { if implementation.get_implementation_type() == &ImplementationType::Method { let class_name = implementation.get_associated_class_name().expect("Method needs to have a class-name"); - let instance_members_struct_type: StructType = + let _instance_members_struct_type: StructType = self.llvm_index.get_associated_type(class_name).map(|it| it.into_struct_type())?; - parameters.insert( - 0, - instance_members_struct_type.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(), - ); + parameters + .insert(0, self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into()); } Ok(parameters) @@ -619,13 +598,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { && type_info.is_aggregate() { // a by-value aggregate type => we need to memcpy the data into the local variable - let ty = if ty.is_array_type() { - ty.into_array_type() - .get_element_type() - .ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)) - } else { - ty.into_struct_type().ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)) - }; + let ty = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)); let bitcast = self.llvm.builder.build_bit_cast(ptr, ty, "bitcast")?.into_pointer_value(); let (size, alignment) = if let DataTypeInformation::String { size, encoding } = type_info { @@ -728,10 +701,11 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { let temp_type = index.get_associated_type(m.get_type_name())?; (parameter_name, self.llvm.create_local_variable(parameter_name, &temp_type)?) } else { + let pointee = self.llvm_index.get_associated_pou_type(type_name).unwrap(); let ptr = self .llvm .builder - .build_struct_gep(param_pointer, var_count as u32, parameter_name) + .build_struct_gep(pointee, param_pointer, var_count as u32, parameter_name) .expect(INTERNAL_LLVM_ERROR); var_count += 1; @@ -788,10 +762,9 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { .is_some_and(|it| it.is_reference_to() || it.is_alias()) { // aliases and reference to variables have special handling for initialization. initialize with a nullpointer - self.llvm.builder.build_store( - left, - left.get_type().get_element_type().into_pointer_type().const_null(), - )?; + let pointee = + self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).const_null(); + self.llvm.builder.build_store(left, pointee)?; continue; }; let right_stmt = @@ -838,28 +811,17 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { //Create a size parameter of type i32 (DINT) let size = self.llvm_index.find_associated_type(DINT_TYPE).map(Into::into)?; - let ty = self - .llvm_index - .find_associated_type(type_name) - .map(|it| { - if it.is_array_type() && var.get_declaration_type().is_by_ref() { - // the declaration for array types passed by ref are generatad as pointer to element type - // we need to match the declaration - it.into_array_type().get_element_type() - } else { - it - } - }) - .map(|it| { - if var.get_declaration_type().is_by_ref() { - // variadic by ref will result in a double pointer - it.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).as_basic_type_enum() - } else { - it - } - })? - .ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)) - .into(); + let _ = self.llvm_index.find_associated_type(type_name).map(|it| { + if it.is_array_type() && var.get_declaration_type().is_by_ref() { + // the declaration for array types passed by ref are generatad as pointer to element type + // we need to match the declaration + it.into_array_type().get_element_type() + } else { + it + } + })?; + + let ty = self.llvm.context.ptr_type(AddressSpace::from(ADDRESS_SPACE_GENERIC)).into(); Some([size, ty]) } else { diff --git a/src/codegen/generators/statement_generator.rs b/src/codegen/generators/statement_generator.rs index d53ce2cea3e..9954793199c 100644 --- a/src/codegen/generators/statement_generator.rs +++ b/src/codegen/generators/statement_generator.rs @@ -433,6 +433,10 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { self.generate_assignment_statement(llvm_index, &stmt.counter, &stmt.start)?; let counter = exp_gen.generate_lvalue(&stmt.counter)?; + let counter_pointee = { + let datatype = self.annotations.get_type(&stmt.counter, self.index).unwrap(); + self.llvm_index.get_associated_type(&datatype.name).unwrap() + }; // generate loop predicate selector. since `STEP` can be a reference, this needs to be a runtime eval // XXX(mhasel): IR could possibly be improved by generating phi instructions. @@ -457,10 +461,11 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { let end = exp_gen.generate_expression_value(&stmt.end).unwrap(); let end_value = match end { - ExpressionValue::LValue(ptr) => builder.build_load(ptr, "")?, + ExpressionValue::LValue(value, pointee) => builder.build_load(pointee, value, "")?, ExpressionValue::RValue(val) => val, }; - let counter_value = builder.build_load(counter, "")?; + + let counter_value = builder.build_load(counter_pointee, counter, "")?; let cmp = builder.build_int_compare( predicate, cast_if_needed!(exp_gen, cast_target_ty, counter_ty, counter_value, None)?.into_int_value(), @@ -494,7 +499,7 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { // increment counter builder.build_unconditional_branch(increment)?; builder.position_at_end(increment); - let counter_value = builder.build_load(counter, "")?; + let counter_value = builder.build_load(counter_pointee, counter, "")?; let inc = inkwell::values::BasicValue::as_basic_value_enum(&builder.build_int_add( eval_step()?.into_int_value(), cast_if_needed!(exp_gen, cast_target_ty, counter_ty, counter_value, None)?.into_int_value(), @@ -825,7 +830,9 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { SourceLocation::undefined(), ) })?; - let loaded_value = self.llvm.load_pointer(&value_ptr, var_name.as_str())?; + + let pointee = self.llvm_index.get_associated_type(ret_v.get_type_name()).unwrap(); + let loaded_value = self.llvm.load_pointer(pointee, &value_ptr, var_name.as_str())?; self.llvm.builder.build_return(Some(&loaded_value))?; } } else { diff --git a/src/codegen/llvm_index.rs b/src/codegen/llvm_index.rs index 521f9ab44b9..d86a8a3e56d 100644 --- a/src/codegen/llvm_index.rs +++ b/src/codegen/llvm_index.rs @@ -1,7 +1,6 @@ // Copyright (c) 2020 Ghaith Hachem and Mathias Rieder -use inkwell::types::{AnyTypeEnum, BasicType, BasicTypeEnum, PointerType}; +use inkwell::types::{AnyTypeEnum, BasicType, BasicTypeEnum}; use inkwell::values::{AnyValue, BasicValueEnum, FunctionValue, GlobalValue, PointerValue}; -use inkwell::AddressSpace; use plc_diagnostics::diagnostics::Diagnostic; use plc_source::source_location::SourceLocation; use plc_util::convention::qualified_name; @@ -28,7 +27,6 @@ pub struct LlvmTypedIndex<'ink> { pub trait TypeHelper<'ink> { #[allow(clippy::wrong_self_convention)] fn as_basic_type(self) -> Option>; - fn create_ptr_type(&self, address_space: AddressSpace) -> PointerType<'ink>; } impl<'ink> TypeHelper<'ink> for AnyTypeEnum<'ink> { @@ -45,20 +43,6 @@ impl<'ink> TypeHelper<'ink> for AnyTypeEnum<'ink> { AnyTypeEnum::FunctionType(_) => None, } } - - fn create_ptr_type(&self, address_space: AddressSpace) -> PointerType<'ink> { - match self { - AnyTypeEnum::ArrayType(value) => value.ptr_type(address_space), - AnyTypeEnum::FloatType(value) => value.ptr_type(address_space), - AnyTypeEnum::IntType(value) => value.ptr_type(address_space), - AnyTypeEnum::PointerType(value) => value.ptr_type(address_space), - AnyTypeEnum::StructType(value) => value.ptr_type(address_space), - AnyTypeEnum::VectorType(value) => value.ptr_type(address_space), - AnyTypeEnum::ScalableVectorType(value) => value.ptr_type(address_space), - AnyTypeEnum::FunctionType(value) => value.ptr_type(address_space), - AnyTypeEnum::VoidType(_) => unreachable!("Void type cannot be converted to pointer"), - } - } } impl<'ink> LlvmTypedIndex<'ink> { diff --git a/src/codegen/llvm_typesystem.rs b/src/codegen/llvm_typesystem.rs index 3f82dee9c6d..20905bebcb0 100644 --- a/src/codegen/llvm_typesystem.rs +++ b/src/codegen/llvm_typesystem.rs @@ -405,7 +405,10 @@ impl<'ctx, 'cast> Castable<'ctx, 'cast> for PointerValue<'ctx> { .. } => { // we are dealing with an auto-deref vla parameter. first we have to deref our array and build the fat pointer - let struct_val = cast_data.llvm.builder.build_load(self, "auto_deref")?.cast(cast_data)?; + let pointee = + cast_data.llvm_type_index.get_associated_type(cast_data.value_type.get_name())?; + let struct_val = + cast_data.llvm.builder.build_load(pointee, self, "auto_deref")?.cast(cast_data)?; // create a pointer to the generated StructValue let struct_ptr = @@ -463,15 +466,18 @@ impl<'ctx, 'cast> Castable<'ctx, 'cast> for ArrayValue<'ctx> { })?; // gep into the original array. the resulting address will be stored in the VLA struct - let arr_gep = unsafe { builder.build_in_bounds_gep(array_pointer, &[zero, zero], "outer_arr_gep")? }; + let pointee = cast_data.llvm_type_index.get_associated_type(cast_data.value_type.get_name())?; + let arr_gep = + unsafe { builder.build_in_bounds_gep(pointee, array_pointer, &[zero, zero], "outer_arr_gep")? }; // -- Generate struct & arr_ptr -- let ty = associated_type.into_struct_type(); let vla_struct = builder.build_alloca(ty, "vla_struct")?; - let vla_arr_ptr = builder.build_struct_gep(vla_struct, 0, "vla_array_gep")?; + let vla_arr_ptr = builder.build_struct_gep(associated_type, vla_struct, 0, "vla_array_gep")?; - let vla_dimensions_ptr = builder.build_struct_gep(vla_struct, 1, "vla_dimensions_gep")?; + let vla_dimensions_ptr = + builder.build_struct_gep(associated_type, vla_struct, 1, "vla_dimensions_gep")?; // -- Generate dimensions -- let DataTypeInformation::Array { dimensions, .. } = cast_data.value_type else { unreachable!() }; @@ -490,7 +496,7 @@ impl<'ctx, 'cast> Castable<'ctx, 'cast> for ArrayValue<'ctx> { builder.build_store(vla_arr_ptr, arr_gep)?; - builder.build_load(vla_struct, "").map_err(Into::into) + builder.build_load(associated_type, vla_struct, "").map_err(Into::into) } fn cast_constant( diff --git a/src/codegen/tests.rs b/src/codegen/tests.rs index ccbe645acf0..1ca2d2e0689 100644 --- a/src/codegen/tests.rs +++ b/src/codegen/tests.rs @@ -12,7 +12,6 @@ mod function_tests; mod generics_test; mod initialization_test; mod multifile_codegen_tests; -mod online_change_tests; mod oop_tests; mod parameters_tests; mod polymorphism; diff --git a/src/codegen/tests/address_tests.rs b/src/codegen/tests/address_tests.rs index b5b4e22bed0..fd8103716de 100644 --- a/src/codegen/tests/address_tests.rs +++ b/src/codegen/tests/address_tests.rs @@ -18,7 +18,7 @@ fn aliased_address_in_global_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - @foo = global i8* null + @foo = global ptr null @__PI_1_2_3_4 = global i8 0 "#); } @@ -40,9 +40,9 @@ fn duplicate_aliased_address_in_global_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - @foo = global i8* null + @foo = global ptr null @__PI_1_2_3_4 = global i8 0 - @baz = global i8* null + @baz = global ptr null "#); } @@ -70,17 +70,17 @@ fn address_variable_used_with_symbolic_name() { %mainProg = type {} - @foo = global i8* null + @foo = global ptr null @__PI_1_2_3_4 = global i8 0 - @baz = global i8* null + @baz = global ptr null @mainProg_instance = global %mainProg zeroinitializer - define void @mainProg(%mainProg* %0) { + define void @mainProg(ptr %0) { entry: - %deref = load i8*, i8** @foo, align 8 - store i8 0, i8* %deref, align 1 - %deref1 = load i8*, i8** @baz, align 8 - store i8 1, i8* %deref1, align 1 + %deref = load ptr, ptr @foo, align 8 + store i8 0, ptr %deref, align 1 + %deref1 = load ptr, ptr @baz, align 8 + store i8 1, ptr %deref1, align 1 ret void } "#); @@ -111,18 +111,18 @@ fn address_used_in_body() { %mainProg = type {} - @foo = global i8* null + @foo = global ptr null @__PI_1_2_3_4 = global i8 0 - @baz = global i8* null + @baz = global ptr null @__PI_1_2_3_5 = global i8 0 @x = global i8 1 @mainProg_instance = global %mainProg zeroinitializer - define void @mainProg(%mainProg* %0) { + define void @mainProg(ptr %0) { entry: - store i8 1, i8* @__PI_1_2_3_4, align 1 - %1 = load i8, i8* @__PI_1_2_3_5, align 1 - store i8 %1, i8* @x, align 1 + store i8 1, ptr @__PI_1_2_3_4, align 1 + %1 = load i8, ptr @__PI_1_2_3_5, align 1 + store i8 %1, ptr @x, align 1 ret void } "#); diff --git a/src/codegen/tests/code_gen_tests.rs b/src/codegen/tests/code_gen_tests.rs index acdc823d77e..cdb5e25daa3 100644 --- a/src/codegen/tests/code_gen_tests.rs +++ b/src/codegen/tests/code_gen_tests.rs @@ -1115,32 +1115,32 @@ fn fb_method_called_locally() { @__foo__init = unnamed_addr constant %foo { i32 42 } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %call = call i32 @foo__addToBar(%foo* %0, i16 42) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %call = call i32 @foo__addToBar(ptr %0, i16 42) ret void } - define i32 @foo__addToBar(%foo* %0, i16 %1) { + define i32 @foo__addToBar(ptr %0, i16 %1) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.addToBar = alloca i32, align 4 %in = alloca i16, align 2 - store i16 %1, i16* %in, align 2 - store i32 0, i32* %foo.addToBar, align 4 - %load_in = load i16, i16* %in, align 2 + store i16 %1, ptr %in, align 2 + store i32 0, ptr %foo.addToBar, align 4 + %load_in = load i16, ptr %in, align 2 %2 = sext i16 %load_in to i32 - %load_bar = load i32, i32* %bar, align 4 + %load_bar = load i32, ptr %bar, align 4 %tmpVar = add i32 %2, %load_bar - store i32 %tmpVar, i32* %bar, align 4 - %load_bar1 = load i32, i32* %bar, align 4 - store i32 %load_bar1, i32* %foo.addToBar, align 4 - %foo__addToBar_ret = load i32, i32* %foo.addToBar, align 4 + store i32 %tmpVar, ptr %bar, align 4 + %load_bar1 = load i32, ptr %bar, align 4 + store i32 %load_bar1, ptr %foo.addToBar, align 4 + %foo__addToBar_ret = load i32, ptr %foo.addToBar, align 4 ret i32 %foo__addToBar_ret } @@ -1148,18 +1148,17 @@ fn fb_method_called_locally() { entry: %fb = alloca %foo, align 8 %x = alloca i32, align 4 - %0 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - store i32 0, i32* %x, align 4 - %call = call i32 @foo__addToBar(%foo* %fb, i16 3) - store i32 %call, i32* %x, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %x, align 4 + %call = call i32 @foo__addToBar(ptr %fb, i16 3) + store i32 %call, ptr %x, align 4 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1204,34 +1203,34 @@ fn fb_local_method_var_shadows_parent_var() { @__foo__init = unnamed_addr constant %foo { i32 42 } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %call = call i32 @foo__addToBar(%foo* %0, i16 42) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %call = call i32 @foo__addToBar(ptr %0, i16 42) ret void } - define i32 @foo__addToBar(%foo* %0, i16 %1) { + define i32 @foo__addToBar(ptr %0, i16 %1) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.addToBar = alloca i32, align 4 %in = alloca i16, align 2 - store i16 %1, i16* %in, align 2 + store i16 %1, ptr %in, align 2 %bar1 = alloca i32, align 4 - store i32 69, i32* %bar1, align 4 - store i32 0, i32* %foo.addToBar, align 4 - %load_in = load i16, i16* %in, align 2 + store i32 69, ptr %bar1, align 4 + store i32 0, ptr %foo.addToBar, align 4 + %load_in = load i16, ptr %in, align 2 %2 = sext i16 %load_in to i32 - %load_bar = load i32, i32* %bar1, align 4 + %load_bar = load i32, ptr %bar1, align 4 %tmpVar = add i32 %2, %load_bar - store i32 %tmpVar, i32* %bar1, align 4 - %load_bar2 = load i32, i32* %bar1, align 4 - store i32 %load_bar2, i32* %foo.addToBar, align 4 - %foo__addToBar_ret = load i32, i32* %foo.addToBar, align 4 + store i32 %tmpVar, ptr %bar1, align 4 + %load_bar2 = load i32, ptr %bar1, align 4 + store i32 %load_bar2, ptr %foo.addToBar, align 4 + %foo__addToBar_ret = load i32, ptr %foo.addToBar, align 4 ret i32 %foo__addToBar_ret } @@ -1239,18 +1238,17 @@ fn fb_local_method_var_shadows_parent_var() { entry: %fb = alloca %foo, align 8 %x = alloca i32, align 4 - %0 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - store i32 0, i32* %x, align 4 - %call = call i32 @foo__addToBar(%foo* %fb, i16 3) - store i32 %call, i32* %x, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %x, align 4 + %call = call i32 @foo__addToBar(ptr %fb, i16 3) + store i32 %call, ptr %x, align 4 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1292,37 +1290,37 @@ fn prog_method_called_locally() { @foo_instance = global %foo { i32 42 } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %call = call i32 @foo__addToBar(%foo* %0, i16 42) + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %call = call i32 @foo__addToBar(ptr %0, i16 42) ret void } - define i32 @foo__addToBar(%foo* %0, i16 %1) { + define i32 @foo__addToBar(ptr %0, i16 %1) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.addToBar = alloca i32, align 4 %in = alloca i16, align 2 - store i16 %1, i16* %in, align 2 - store i32 0, i32* %foo.addToBar, align 4 - %load_in = load i16, i16* %in, align 2 + store i16 %1, ptr %in, align 2 + store i32 0, ptr %foo.addToBar, align 4 + %load_in = load i16, ptr %in, align 2 %2 = sext i16 %load_in to i32 - %load_bar = load i32, i32* %bar, align 4 + %load_bar = load i32, ptr %bar, align 4 %tmpVar = add i32 %2, %load_bar - store i32 %tmpVar, i32* %bar, align 4 - %load_bar1 = load i32, i32* %bar, align 4 - store i32 %load_bar1, i32* %foo.addToBar, align 4 - %foo__addToBar_ret = load i32, i32* %foo.addToBar, align 4 + store i32 %tmpVar, ptr %bar, align 4 + %load_bar1 = load i32, ptr %bar, align 4 + store i32 %load_bar1, ptr %foo.addToBar, align 4 + %foo__addToBar_ret = load i32, ptr %foo.addToBar, align 4 ret i32 %foo__addToBar_ret } define void @main() { entry: %x = alloca i32, align 4 - store i32 0, i32* %x, align 4 - %call = call i32 @foo__addToBar(%foo* @foo_instance, i16 3) - store i32 %call, i32* %x, align 4 + store i32 0, ptr %x, align 4 + %call = call i32 @foo__addToBar(ptr @foo_instance, i16 3) + store i32 %call, ptr %x, align 4 ret void } "#) @@ -1368,39 +1366,39 @@ fn prog_local_method_var_shadows_parent_var() { @foo_instance = global %foo { i32 42 } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %call = call i32 @foo__addToBar(%foo* %0, i16 42) + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %call = call i32 @foo__addToBar(ptr %0, i16 42) ret void } - define i32 @foo__addToBar(%foo* %0, i16 %1) { + define i32 @foo__addToBar(ptr %0, i16 %1) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.addToBar = alloca i32, align 4 %in = alloca i16, align 2 - store i16 %1, i16* %in, align 2 + store i16 %1, ptr %in, align 2 %bar1 = alloca i32, align 4 - store i32 69, i32* %bar1, align 4 - store i32 0, i32* %foo.addToBar, align 4 - %load_in = load i16, i16* %in, align 2 + store i32 69, ptr %bar1, align 4 + store i32 0, ptr %foo.addToBar, align 4 + %load_in = load i16, ptr %in, align 2 %2 = sext i16 %load_in to i32 - %load_bar = load i32, i32* %bar1, align 4 + %load_bar = load i32, ptr %bar1, align 4 %tmpVar = add i32 %2, %load_bar - store i32 %tmpVar, i32* %bar1, align 4 - %load_bar2 = load i32, i32* %bar1, align 4 - store i32 %load_bar2, i32* %foo.addToBar, align 4 - %foo__addToBar_ret = load i32, i32* %foo.addToBar, align 4 + store i32 %tmpVar, ptr %bar1, align 4 + %load_bar2 = load i32, ptr %bar1, align 4 + store i32 %load_bar2, ptr %foo.addToBar, align 4 + %foo__addToBar_ret = load i32, ptr %foo.addToBar, align 4 ret i32 %foo__addToBar_ret } define void @main() { entry: %x = alloca i32, align 4 - store i32 0, i32* %x, align 4 - %call = call i32 @foo__addToBar(%foo* @foo_instance, i16 3) - store i32 %call, i32* %x, align 4 + store i32 0, ptr %x, align 4 + %call = call i32 @foo__addToBar(ptr @foo_instance, i16 3) + store i32 %call, ptr %x, align 4 ret void } "#) @@ -1623,44 +1621,44 @@ fn for_statement_with_binary_expressions() { @prg_instance = global %prg zeroinitializer - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %step = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %load_y = load i32, i32* %y, align 4 + %step = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %load_y = load i32, ptr %y, align 4 %tmpVar = add i32 %load_y, 1 - store i32 %tmpVar, i32* %x, align 4 - %load_step = load i32, i32* %step, align 4 + store i32 %tmpVar, ptr %x, align 4 + %load_step = load i32, ptr %step, align 4 %tmpVar1 = mul i32 %load_step, 3 %is_incrementing = icmp sgt i32 %tmpVar1, 0 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %load_z = load i32, i32* %z, align 4 + %load_z = load i32, ptr %z, align 4 %tmpVar2 = sub i32 %load_z, 2 - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, %tmpVar2 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %load_z3 = load i32, i32* %z, align 4 + %load_z3 = load i32, ptr %z, align 4 %tmpVar4 = sub i32 %load_z3, 2 - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition5 = icmp sge i32 %2, %tmpVar4 br i1 %condition5, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %increment increment: ; preds = %loop - %3 = load i32, i32* %x, align 4 - %load_step6 = load i32, i32* %step, align 4 + %3 = load i32, ptr %x, align 4 + %load_step6 = load i32, ptr %step, align 4 %tmpVar7 = mul i32 %load_step6, 3 %next = add i32 %tmpVar7, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle @@ -1692,44 +1690,44 @@ fn for_statement_type_casting() { entry: %a = alloca i8, align 1 %b = alloca i16, align 2 - store i8 0, i8* %a, align 1 - store i16 1, i16* %b, align 2 - store i8 0, i8* %a, align 1 - %load_b = load i16, i16* %b, align 2 + store i8 0, ptr %a, align 1 + store i16 1, ptr %b, align 2 + store i8 0, ptr %a, align 1 + %load_b = load i16, ptr %b, align 2 %0 = trunc i16 %load_b to i8 %1 = sext i8 %0 to i32 %is_incrementing = icmp sgt i32 %1, 0 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %2 = load i8, i8* %a, align 1 + %2 = load i8, ptr %a, align 1 %3 = zext i8 %2 to i32 %condition = icmp sle i32 %3, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %4 = load i8, i8* %a, align 1 + %4 = load i8, ptr %a, align 1 %5 = zext i8 %4 to i32 %condition1 = icmp sge i32 %5, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_b2 = load i16, i16* %b, align 2 + %load_b2 = load i16, ptr %b, align 2 %6 = sext i16 %load_b2 to i32 %tmpVar = mul i32 %6, 3 %7 = trunc i32 %tmpVar to i16 - store i16 %7, i16* %b, align 2 + store i16 %7, ptr %b, align 2 br label %increment increment: ; preds = %loop - %8 = load i8, i8* %a, align 1 - %load_b3 = load i16, i16* %b, align 2 + %8 = load i8, ptr %a, align 1 + %load_b3 = load i16, ptr %b, align 2 %9 = trunc i16 %load_b3 to i8 %10 = sext i8 %9 to i32 %11 = zext i8 %8 to i32 %next = add i32 %10, %11 %12 = trunc i32 %next to i8 - store i8 %12, i8* %a, align 1 + store i8 %12, ptr %a, align 1 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle @@ -3990,19 +3988,19 @@ fn variables_in_var_external_block_are_not_generated() { ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define void @baz(%baz* %0) { + define void @baz(ptr %0) { entry: ret void } - define void @qux(%qux* %0) { + define void @qux(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/debug_tests.rs b/src/codegen/tests/debug_tests.rs index d57a304aeaf..2660f3e1b2f 100644 --- a/src/codegen/tests/debug_tests.rs +++ b/src/codegen/tests/debug_tests.rs @@ -224,7 +224,7 @@ fn switch_case_debug_info() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] define i32 @main() !dbg !4 { entry: @@ -232,14 +232,14 @@ fn switch_case_debug_info() { %x1 = alloca i16, align 2 %x2 = alloca i16, align 2 %x3 = alloca i16, align 2 - call void @llvm.dbg.declare(metadata i16* %x1, metadata !8, metadata !DIExpression()), !dbg !10 - store i16 0, i16* %x1, align 2 - call void @llvm.dbg.declare(metadata i16* %x2, metadata !11, metadata !DIExpression()), !dbg !12 - store i16 0, i16* %x2, align 2 - call void @llvm.dbg.declare(metadata i16* %x3, metadata !13, metadata !DIExpression()), !dbg !14 - store i16 0, i16* %x3, align 2 - call void @llvm.dbg.declare(metadata i32* %main, metadata !15, metadata !DIExpression()), !dbg !17 - store i32 0, i32* %main, align 4 + #dbg_declare(ptr %x1, !8, !DIExpression(), !10) + store i16 0, ptr %x1, align 2 + #dbg_declare(ptr %x2, !11, !DIExpression(), !12) + store i16 0, ptr %x2, align 2 + #dbg_declare(ptr %x3, !13, !DIExpression(), !14) + store i16 0, ptr %x3, align 2 + #dbg_declare(ptr %main, !15, !DIExpression(), !17) + store i32 0, ptr %main, align 4 br label %condition_check, !dbg !18 condition_check: ; preds = %continue2, %entry @@ -249,7 +249,7 @@ fn switch_case_debug_info() { br i1 false, label %condition_body, label %continue1, !dbg !19 continue: ; preds = %condition_body, %condition_check - %main_ret = load i32, i32* %main, align 4, !dbg !20 + %main_ret = load i32, ptr %main, align 4, !dbg !20 ret i32 %main_ret, !dbg !20 condition_body: ; preds = %while_body @@ -259,12 +259,12 @@ fn switch_case_debug_info() { br label %continue1, !dbg !21 continue1: ; preds = %buffer_block, %while_body - %load_x1 = load i16, i16* %x1, align 2, !dbg !22 + %load_x1 = load i16, ptr %x1, align 2, !dbg !22 %0 = sext i16 %load_x1 to i32, !dbg !22 %tmpVar = add i32 %0, 1, !dbg !22 %1 = trunc i32 %tmpVar to i16, !dbg !22 - store i16 %1, i16* %x1, align 2, !dbg !22 - %load_x13 = load i16, i16* %x1, align 2, !dbg !22 + store i16 %1, ptr %x1, align 2, !dbg !22 + %load_x13 = load i16, ptr %x1, align 2, !dbg !22 switch i16 %load_x13, label %else [ i16 1, label %case i16 2, label %case4 @@ -272,37 +272,32 @@ fn switch_case_debug_info() { ], !dbg !23 case: ; preds = %continue1 - store i16 1, i16* %x2, align 2, !dbg !24 + store i16 1, ptr %x2, align 2, !dbg !24 br label %continue2, !dbg !25 case4: ; preds = %continue1 - store i16 2, i16* %x2, align 2, !dbg !26 + store i16 2, ptr %x2, align 2, !dbg !26 br label %continue2, !dbg !25 case5: ; preds = %continue1 - store i16 3, i16* %x2, align 2, !dbg !27 + store i16 3, ptr %x2, align 2, !dbg !27 br label %continue2, !dbg !25 else: ; preds = %continue1 - store i16 0, i16* %x1, align 2, !dbg !28 - store i16 1, i16* %x2, align 2, !dbg !29 - store i16 2, i16* %x3, align 2, !dbg !30 + store i16 0, ptr %x1, align 2, !dbg !28 + store i16 1, ptr %x2, align 2, !dbg !29 + store i16 2, ptr %x3, align 2, !dbg !30 br label %continue2, !dbg !25 continue2: ; preds = %else, %case5, %case4, %case br label %condition_check, !dbg !18 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - define void @__init___Test() { entry: ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} @@ -357,81 +352,76 @@ fn dbg_declare_has_valid_metadata_references_for_methods() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_fb = type { void (%fb*)*, void (%fb*)* } - %fb = type { i32* } + %__vtable_fb = type { ptr, ptr } + %fb = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_fb__init = unnamed_addr constant %__vtable_fb zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer, !dbg !0 @__vtable_fb_instance = global %__vtable_fb zeroinitializer - define void @fb(%fb* %0) !dbg !14 { + define void @fb(ptr %0) !dbg !14 { entry: - call void @llvm.dbg.declare(metadata %fb* %0, metadata !18, metadata !DIExpression()), !dbg !19 - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !18, !DIExpression(), !19) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void, !dbg !19 } - define void @fb__foo(%fb* %0) !dbg !20 { + define void @fb__foo(ptr %0) !dbg !20 { entry: - call void @llvm.dbg.declare(metadata %fb* %0, metadata !21, metadata !DIExpression()), !dbg !22 - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !21, !DIExpression(), !22) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void, !dbg !22 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init___vtable_fb(%__vtable_fb* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 - %deref = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref, i32 0, i32 0 - store void (%fb*)* @fb, void (%fb*)** %__body, align 8 - %deref1 = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %foo = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref1, i32 0, i32 1 - store void (%fb*)* @fb__foo, void (%fb*)** %foo, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_fb, ptr %deref1, i32 0, i32 1 + store ptr @fb__foo, ptr %foo, align 8 ret void } - define void @__init_fb(%fb* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 - %deref = load %fb*, %fb** %self, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_fb* @__vtable_fb_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %deref, i32 0, i32 0 + store ptr @__vtable_fb_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_fb(%fb* %0) { + define void @__user_init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_fb(%__vtable_fb* %0) { + define void @__user_init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__user_init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) + call void @__init___vtable_fb(ptr @__vtable_fb_instance) + call void @__user_init___vtable_fb(ptr @__vtable_fb_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!10, !11} !llvm.dbg.cu = !{!12} @@ -494,68 +484,63 @@ fn action_with_var_temp() { %PLC_PRG = type {} - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @PLC_PRG_instance = global %PLC_PRG zeroinitializer, !dbg !0 define i32 @main() !dbg !9 { entry: %main = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %main, metadata !12, metadata !DIExpression()), !dbg !14 - store i32 0, i32* %main, align 4 - call void @PLC_PRG(%PLC_PRG* @PLC_PRG_instance), !dbg !15 - call void @PLC_PRG__act(%PLC_PRG* @PLC_PRG_instance), !dbg !16 - %main_ret = load i32, i32* %main, align 4, !dbg !17 + #dbg_declare(ptr %main, !12, !DIExpression(), !14) + store i32 0, ptr %main, align 4 + call void @PLC_PRG(ptr @PLC_PRG_instance), !dbg !15 + call void @PLC_PRG__act(ptr @PLC_PRG_instance), !dbg !16 + %main_ret = load i32, ptr %main, align 4, !dbg !17 ret i32 %main_ret, !dbg !17 } - define void @PLC_PRG(%PLC_PRG* %0) !dbg !18 { + define void @PLC_PRG(ptr %0) !dbg !18 { entry: - call void @llvm.dbg.declare(metadata %PLC_PRG* %0, metadata !21, metadata !DIExpression()), !dbg !22 + #dbg_declare(ptr %0, !21, !DIExpression(), !22) %x = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %x, metadata !23, metadata !DIExpression()), !dbg !24 - store i32 0, i32* %x, align 4 - store i32 0, i32* %x, align 4, !dbg !22 + #dbg_declare(ptr %x, !23, !DIExpression(), !24) + store i32 0, ptr %x, align 4 + store i32 0, ptr %x, align 4, !dbg !22 ret void, !dbg !25 } - define void @PLC_PRG__act(%PLC_PRG* %0) !dbg !26 { + define void @PLC_PRG__act(ptr %0) !dbg !26 { entry: - call void @llvm.dbg.declare(metadata %PLC_PRG* %0, metadata !27, metadata !DIExpression()), !dbg !28 + #dbg_declare(ptr %0, !27, !DIExpression(), !28) %x = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %x, metadata !29, metadata !DIExpression()), !dbg !30 - store i32 0, i32* %x, align 4 - %load_x = load i32, i32* %x, align 4, !dbg !28 + #dbg_declare(ptr %x, !29, !DIExpression(), !30) + store i32 0, ptr %x, align 4 + %load_x = load i32, ptr %x, align 4, !dbg !28 %tmpVar = add i32 %load_x, 1, !dbg !28 - store i32 %tmpVar, i32* %x, align 4, !dbg !28 + store i32 %tmpVar, ptr %x, align 4, !dbg !28 ret void, !dbg !31 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_plc_prg(%PLC_PRG* %0) { + define void @__init_plc_prg(ptr %0) { entry: - %self = alloca %PLC_PRG*, align 8 - store %PLC_PRG* %0, %PLC_PRG** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_PLC_PRG(%PLC_PRG* %0) { + define void @__user_init_PLC_PRG(ptr %0) { entry: - %self = alloca %PLC_PRG*, align 8 - store %PLC_PRG* %0, %PLC_PRG** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_plc_prg(%PLC_PRG* @PLC_PRG_instance) - call void @__user_init_PLC_PRG(%PLC_PRG* @PLC_PRG_instance) + call void @__init_plc_prg(ptr @PLC_PRG_instance) + call void @__user_init_PLC_PRG(ptr @PLC_PRG_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!5, !6} !llvm.dbg.cu = !{!7} @@ -645,7 +630,7 @@ END_FUNCTION ", ); - filtered_assert_snapshot!(result, @r###" + filtered_assert_snapshot!(result, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" @@ -657,7 +642,7 @@ END_FUNCTION @__struct___init = unnamed_addr constant %struct_ { %inner { [81 x i8] c"Hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 1, float 0x400921CAC0000000, [3 x [81 x i8]] [[81 x i8] c"aaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"bbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"cccc\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], i16 42 }, [3 x %inner] zeroinitializer, [81 x i8] c"Hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 1, float 0x400921CAC0000000, [3 x [81 x i8]] [[81 x i8] c"aa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"bb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"cc\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], i16 42 }, !dbg !0 @__inner__init = unnamed_addr constant %inner { [81 x i8] c"Hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 1, float 0x400921CAC0000000, [3 x [81 x i8]] [[81 x i8] c"aaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"bbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"cccc\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], i16 42 }, !dbg !32 @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"Hello\00" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] define void @main() !dbg !39 { entry: @@ -666,145 +651,123 @@ END_FUNCTION %b = alloca i8, align 1 %arr = alloca [3 x [81 x i8]], align 1 %i = alloca i16, align 2 - call void @llvm.dbg.declare(metadata %struct_* %st, metadata !43, metadata !DIExpression()), !dbg !44 - %0 = bitcast %struct_* %st to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%struct_, %struct_* @__struct___init, i32 0, i32 0, i32 0, i32 0), i64 ptrtoint (%struct_* getelementptr (%struct_, %struct_* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata [81 x i8]* %s, metadata !45, metadata !DIExpression()), !dbg !46 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata i8* %b, metadata !47, metadata !DIExpression()), !dbg !48 - store i8 0, i8* %b, align 1 - call void @llvm.dbg.declare(metadata [3 x [81 x i8]]* %arr, metadata !49, metadata !DIExpression()), !dbg !50 - %2 = bitcast [3 x [81 x i8]]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([3 x [81 x i8]]* getelementptr ([3 x [81 x i8]], [3 x [81 x i8]]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata i16* %i, metadata !51, metadata !DIExpression()), !dbg !52 - store i16 0, i16* %i, align 2 - call void @__init_struct_(%struct_* %st), !dbg !53 - call void @__user_init_struct_(%struct_* %st), !dbg !53 - %s1 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 2, !dbg !54 - %3 = bitcast [81 x i8]* %s to i8*, !dbg !54 - %4 = bitcast [81 x i8]* %s1 to i8*, !dbg !54 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false), !dbg !54 - %inner = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !55 - %s2 = getelementptr inbounds %inner, %inner* %inner, i32 0, i32 0, !dbg !55 - %5 = bitcast [81 x i8]* %s to i8*, !dbg !55 - %6 = bitcast [81 x i8]* %s2 to i8*, !dbg !55 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %5, i8* align 1 %6, i32 80, i1 false), !dbg !55 - %b3 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 3, !dbg !56 - %load_b = load i8, i8* %b3, align 1, !dbg !56 - store i8 %load_b, i8* %b, align 1, !dbg !56 - %inner4 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !57 - %b5 = getelementptr inbounds %inner, %inner* %inner4, i32 0, i32 1, !dbg !57 - %load_b6 = load i8, i8* %b5, align 1, !dbg !57 - store i8 %load_b6, i8* %b, align 1, !dbg !57 - %arr7 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 5, !dbg !58 - %7 = bitcast [3 x [81 x i8]]* %arr to i8*, !dbg !58 - %8 = bitcast [3 x [81 x i8]]* %arr7 to i8*, !dbg !58 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %7, i8* align 1 %8, i64 ptrtoint ([3 x [81 x i8]]* getelementptr ([3 x [81 x i8]], [3 x [81 x i8]]* null, i32 1) to i64), i1 false), !dbg !58 - %inner8 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !59 - %arr9 = getelementptr inbounds %inner, %inner* %inner8, i32 0, i32 3, !dbg !59 - %9 = bitcast [3 x [81 x i8]]* %arr to i8*, !dbg !59 - %10 = bitcast [3 x [81 x i8]]* %arr9 to i8*, !dbg !59 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %9, i8* align 1 %10, i64 ptrtoint ([3 x [81 x i8]]* getelementptr ([3 x [81 x i8]], [3 x [81 x i8]]* null, i32 1) to i64), i1 false), !dbg !59 - %i10 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 6, !dbg !60 - %load_i = load i16, i16* %i10, align 2, !dbg !60 - store i16 %load_i, i16* %i, align 2, !dbg !60 - %inner11 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !61 - %i12 = getelementptr inbounds %inner, %inner* %inner11, i32 0, i32 4, !dbg !61 - %load_i13 = load i16, i16* %i12, align 2, !dbg !61 - store i16 %load_i13, i16* %i, align 2, !dbg !61 - %tmpVar = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr, i32 0, i32 0, !dbg !62 - %arr14 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 5, !dbg !62 - %tmpVar15 = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr14, i32 0, i32 0, !dbg !62 - %11 = bitcast [81 x i8]* %tmpVar to i8*, !dbg !62 - %12 = bitcast [81 x i8]* %tmpVar15 to i8*, !dbg !62 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %11, i8* align 1 %12, i32 80, i1 false), !dbg !62 - %tmpVar16 = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr, i32 0, i32 1, !dbg !63 - %inner17 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !63 - %arr18 = getelementptr inbounds %inner, %inner* %inner17, i32 0, i32 3, !dbg !63 - %tmpVar19 = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr18, i32 0, i32 1, !dbg !63 - %13 = bitcast [81 x i8]* %tmpVar16 to i8*, !dbg !63 - %14 = bitcast [81 x i8]* %tmpVar19 to i8*, !dbg !63 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %13, i8* align 1 %14, i32 80, i1 false), !dbg !63 - %tmpVar20 = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr, i32 0, i32 2, !dbg !64 - %inner21 = getelementptr inbounds %struct_, %struct_* %st, i32 0, i32 0, !dbg !64 - %arr22 = getelementptr inbounds %inner, %inner* %inner21, i32 0, i32 3, !dbg !64 - %tmpVar23 = getelementptr inbounds [3 x [81 x i8]], [3 x [81 x i8]]* %arr22, i32 0, i32 2, !dbg !64 - %15 = bitcast [81 x i8]* %tmpVar20 to i8*, !dbg !64 - %16 = bitcast [81 x i8]* %tmpVar23 to i8*, !dbg !64 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %15, i8* align 1 %16, i32 80, i1 false), !dbg !64 + #dbg_declare(ptr %st, !43, !DIExpression(), !44) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %st, ptr align 1 @__struct___init, i64 ptrtoint (ptr getelementptr (%struct_, ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %s, !45, !DIExpression(), !46) + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %b, !47, !DIExpression(), !48) + store i8 0, ptr %b, align 1 + #dbg_declare(ptr %arr, !49, !DIExpression(), !50) + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([3 x [81 x i8]], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %i, !51, !DIExpression(), !52) + store i16 0, ptr %i, align 2 + call void @__init_struct_(ptr %st), !dbg !53 + call void @__user_init_struct_(ptr %st), !dbg !53 + %s1 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 2, !dbg !54 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 %s1, i32 80, i1 false), !dbg !54 + %inner = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !55 + %s2 = getelementptr inbounds nuw %inner, ptr %inner, i32 0, i32 0, !dbg !55 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 %s2, i32 80, i1 false), !dbg !55 + %b3 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 3, !dbg !56 + %load_b = load i8, ptr %b3, align 1, !dbg !56 + store i8 %load_b, ptr %b, align 1, !dbg !56 + %inner4 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !57 + %b5 = getelementptr inbounds nuw %inner, ptr %inner4, i32 0, i32 1, !dbg !57 + %load_b6 = load i8, ptr %b5, align 1, !dbg !57 + store i8 %load_b6, ptr %b, align 1, !dbg !57 + %arr7 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 5, !dbg !58 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr, ptr align 1 %arr7, i64 ptrtoint (ptr getelementptr ([3 x [81 x i8]], ptr null, i32 1) to i64), i1 false), !dbg !58 + %inner8 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !59 + %arr9 = getelementptr inbounds nuw %inner, ptr %inner8, i32 0, i32 3, !dbg !59 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr, ptr align 1 %arr9, i64 ptrtoint (ptr getelementptr ([3 x [81 x i8]], ptr null, i32 1) to i64), i1 false), !dbg !59 + %i10 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 6, !dbg !60 + %load_i = load i16, ptr %i10, align 2, !dbg !60 + store i16 %load_i, ptr %i, align 2, !dbg !60 + %inner11 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !61 + %i12 = getelementptr inbounds nuw %inner, ptr %inner11, i32 0, i32 4, !dbg !61 + %load_i13 = load i16, ptr %i12, align 2, !dbg !61 + store i16 %load_i13, ptr %i, align 2, !dbg !61 + %tmpVar = getelementptr inbounds [3 x [81 x i8]], ptr %arr, i32 0, i32 0, !dbg !62 + %arr14 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 5, !dbg !62 + %tmpVar15 = getelementptr inbounds [3 x [81 x i8]], ptr %arr14, i32 0, i32 0, !dbg !62 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 %tmpVar15, i32 80, i1 false), !dbg !62 + %tmpVar16 = getelementptr inbounds [3 x [81 x i8]], ptr %arr, i32 0, i32 1, !dbg !63 + %inner17 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !63 + %arr18 = getelementptr inbounds nuw %inner, ptr %inner17, i32 0, i32 3, !dbg !63 + %tmpVar19 = getelementptr inbounds [3 x [81 x i8]], ptr %arr18, i32 0, i32 1, !dbg !63 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar16, ptr align 1 %tmpVar19, i32 80, i1 false), !dbg !63 + %tmpVar20 = getelementptr inbounds [3 x [81 x i8]], ptr %arr, i32 0, i32 2, !dbg !64 + %inner21 = getelementptr inbounds nuw %struct_, ptr %st, i32 0, i32 0, !dbg !64 + %arr22 = getelementptr inbounds nuw %inner, ptr %inner21, i32 0, i32 3, !dbg !64 + %tmpVar23 = getelementptr inbounds [3 x [81 x i8]], ptr %arr22, i32 0, i32 2, !dbg !64 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar20, ptr align 1 %tmpVar23, i32 80, i1 false), !dbg !64 ret void, !dbg !65 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - define void @__init_struct_(%struct_* %0) { + define void @__init_struct_(ptr %0) { entry: - %self = alloca %struct_*, align 8 - store %struct_* %0, %struct_** %self, align 8 - %deref = load %struct_*, %struct_** %self, align 8 - %inner = getelementptr inbounds %struct_, %struct_* %deref, i32 0, i32 0 - call void @__init_inner(%inner* %inner) - %deref1 = load %struct_*, %struct_** %self, align 8 - %s = getelementptr inbounds %struct_, %struct_* %deref1, i32 0, i32 2 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref2 = load %struct_*, %struct_** %self, align 8 - %b = getelementptr inbounds %struct_, %struct_* %deref2, i32 0, i32 3 - store i8 1, i8* %b, align 1 - %deref3 = load %struct_*, %struct_** %self, align 8 - %r = getelementptr inbounds %struct_, %struct_* %deref3, i32 0, i32 4 - store float 0x400921CAC0000000, float* %r, align 4 - %deref4 = load %struct_*, %struct_** %self, align 8 - %i = getelementptr inbounds %struct_, %struct_* %deref4, i32 0, i32 6 - store i16 42, i16* %i, align 2 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %inner = getelementptr inbounds nuw %struct_, ptr %deref, i32 0, i32 0 + call void @__init_inner(ptr %inner) + %deref1 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %struct_, ptr %deref1, i32 0, i32 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref2 = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %struct_, ptr %deref2, i32 0, i32 3 + store i8 1, ptr %b, align 1 + %deref3 = load ptr, ptr %self, align 8 + %r = getelementptr inbounds nuw %struct_, ptr %deref3, i32 0, i32 4 + store float 0x400921CAC0000000, ptr %r, align 4 + %deref4 = load ptr, ptr %self, align 8 + %i = getelementptr inbounds nuw %struct_, ptr %deref4, i32 0, i32 6 + store i16 42, ptr %i, align 2 ret void } - define void @__init_inner(%inner* %0) { + define void @__init_inner(ptr %0) { entry: - %self = alloca %inner*, align 8 - store %inner* %0, %inner** %self, align 8 - %deref = load %inner*, %inner** %self, align 8 - %s = getelementptr inbounds %inner, %inner* %deref, i32 0, i32 0 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref1 = load %inner*, %inner** %self, align 8 - %b = getelementptr inbounds %inner, %inner* %deref1, i32 0, i32 1 - store i8 1, i8* %b, align 1 - %deref2 = load %inner*, %inner** %self, align 8 - %r = getelementptr inbounds %inner, %inner* %deref2, i32 0, i32 2 - store float 0x400921CAC0000000, float* %r, align 4 - %deref3 = load %inner*, %inner** %self, align 8 - %i = getelementptr inbounds %inner, %inner* %deref3, i32 0, i32 4 - store i16 42, i16* %i, align 2 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %inner, ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref1 = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %inner, ptr %deref1, i32 0, i32 1 + store i8 1, ptr %b, align 1 + %deref2 = load ptr, ptr %self, align 8 + %r = getelementptr inbounds nuw %inner, ptr %deref2, i32 0, i32 2 + store float 0x400921CAC0000000, ptr %r, align 4 + %deref3 = load ptr, ptr %self, align 8 + %i = getelementptr inbounds nuw %inner, ptr %deref3, i32 0, i32 4 + store i16 42, ptr %i, align 2 ret void } - define void @__user_init_inner(%inner* %0) { + define void @__user_init_inner(ptr %0) { entry: - %self = alloca %inner*, align 8 - store %inner* %0, %inner** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_struct_(%struct_* %0) { + define void @__user_init_struct_(ptr %0) { entry: - %self = alloca %struct_*, align 8 - store %struct_* %0, %struct_** %self, align 8 - %deref = load %struct_*, %struct_** %self, align 8 - %inner = getelementptr inbounds %struct_, %struct_* %deref, i32 0, i32 0 - call void @__user_init_inner(%inner* %inner) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %inner = getelementptr inbounds nuw %struct_, ptr %deref, i32 0, i32 0 + call void @__user_init_inner(ptr %inner) ret void } @@ -813,9 +776,8 @@ END_FUNCTION ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn } - attributes #2 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } !llvm.module.flags = !{!35, !36} !llvm.dbg.cu = !{!37} @@ -886,7 +848,7 @@ END_FUNCTION !63 = !DILocation(line: 42, column: 4, scope: !39) !64 = !DILocation(line: 43, column: 4, scope: !39) !65 = !DILocation(line: 45, scope: !39) - "###); + "#); } #[test] @@ -918,7 +880,7 @@ fn constants_are_tagged_as_such() { ", ); - filtered_assert_snapshot!(result, @r###" + filtered_assert_snapshot!(result, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" @@ -929,17 +891,17 @@ fn constants_are_tagged_as_such() { @x = unnamed_addr constant i32 0, !dbg !0 @s = unnamed_addr constant [81 x i8] zeroinitializer, !dbg !5 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer, !dbg !13 @__foo__init = unnamed_addr constant %foo zeroinitializer, !dbg !20 @f = unnamed_addr constant %foo zeroinitializer, !dbg !26 - define void @prog(%prog* %0) !dbg !32 { + define void @prog(ptr %0) !dbg !32 { entry: - call void @llvm.dbg.declare(metadata %prog* %0, metadata !36, metadata !DIExpression()), !dbg !37 - %a = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %b = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %c = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !36, !DIExpression(), !37) + %a = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void, !dbg !37 } @@ -947,56 +909,51 @@ fn constants_are_tagged_as_such() { entry: %bar = alloca i32, align 4 %d = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %d, metadata !41, metadata !DIExpression()), !dbg !42 - store i32 42, i32* %d, align 4 - call void @llvm.dbg.declare(metadata i32* %bar, metadata !43, metadata !DIExpression()), !dbg !44 - store i32 0, i32* %bar, align 4 - %bar_ret = load i32, i32* %bar, align 4, !dbg !45 + #dbg_declare(ptr %d, !41, !DIExpression(), !42) + store i32 42, ptr %d, align 4 + #dbg_declare(ptr %bar, !43, !DIExpression(), !44) + store i32 0, ptr %bar, align 4 + %bar_ret = load i32, ptr %bar, align 4, !dbg !45 ret i32 %bar_ret, !dbg !45 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init_foo(%foo* @f) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init_foo(%foo* @f) + call void @__init_prog(ptr @prog_instance) + call void @__init_foo(ptr @f) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init_foo(ptr @f) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!28, !29} !llvm.dbg.cu = !{!30} @@ -1046,7 +1003,7 @@ fn constants_are_tagged_as_such() { !43 = !DILocalVariable(name: "bar", scope: !38, file: !2, line: 19, type: !4, align: 32) !44 = !DILocation(line: 19, column: 17, scope: !38) !45 = !DILocation(line: 23, column: 8, scope: !38) - "###); + "#); } #[test] @@ -1074,24 +1031,24 @@ fn test_debug_info_regular_pointer_types() { %myStruct = type { i32, i8 } - @basic_ptr = global i32* null, !dbg !0 - @array_ptr = global [11 x i32]* null, !dbg !6 - @struct_ptr = global %myStruct* null, !dbg !13 - @string_ptr = global [81 x i8]* null, !dbg !22 + @basic_ptr = global ptr null, !dbg !0 + @array_ptr = global ptr null, !dbg !6 + @struct_ptr = global ptr null, !dbg !13 + @string_ptr = global ptr null, !dbg !22 @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !31 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } @@ -1174,64 +1131,59 @@ fn test_debug_info_auto_deref_parameters() { target datalayout = "[filtered]" target triple = "[filtered]" - %test_with_ref_params = type { [81 x i8]*, [6 x i32]*, i32*, %myStruct*, i32* } + %test_with_ref_params = type { ptr, ptr, ptr, ptr, ptr } %myStruct = type { i32, i8 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @test_with_ref_params_instance = global %test_with_ref_params zeroinitializer, !dbg !0 @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !34 - define void @test_with_ref_params(%test_with_ref_params* %0) !dbg !41 { + define void @test_with_ref_params(ptr %0) !dbg !41 { entry: - call void @llvm.dbg.declare(metadata %test_with_ref_params* %0, metadata !45, metadata !DIExpression()), !dbg !46 - %input_ref = getelementptr inbounds %test_with_ref_params, %test_with_ref_params* %0, i32 0, i32 0 - %array_ref = getelementptr inbounds %test_with_ref_params, %test_with_ref_params* %0, i32 0, i32 1 - %inout_value = getelementptr inbounds %test_with_ref_params, %test_with_ref_params* %0, i32 0, i32 2 - %inout_struct = getelementptr inbounds %test_with_ref_params, %test_with_ref_params* %0, i32 0, i32 3 - %local_ref = getelementptr inbounds %test_with_ref_params, %test_with_ref_params* %0, i32 0, i32 4 + #dbg_declare(ptr %0, !45, !DIExpression(), !46) + %input_ref = getelementptr inbounds nuw %test_with_ref_params, ptr %0, i32 0, i32 0 + %array_ref = getelementptr inbounds nuw %test_with_ref_params, ptr %0, i32 0, i32 1 + %inout_value = getelementptr inbounds nuw %test_with_ref_params, ptr %0, i32 0, i32 2 + %inout_struct = getelementptr inbounds nuw %test_with_ref_params, ptr %0, i32 0, i32 3 + %local_ref = getelementptr inbounds nuw %test_with_ref_params, ptr %0, i32 0, i32 4 ret void, !dbg !46 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_test_with_ref_params(%test_with_ref_params* %0) { + define void @__init_test_with_ref_params(ptr %0) { entry: - %self = alloca %test_with_ref_params*, align 8 - store %test_with_ref_params* %0, %test_with_ref_params** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_test_with_ref_params(%test_with_ref_params* %0) { + define void @__user_init_test_with_ref_params(ptr %0) { entry: - %self = alloca %test_with_ref_params*, align 8 - store %test_with_ref_params* %0, %test_with_ref_params** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_test_with_ref_params(%test_with_ref_params* @test_with_ref_params_instance) - call void @__user_init_test_with_ref_params(%test_with_ref_params* @test_with_ref_params_instance) + call void @__init_test_with_ref_params(ptr @test_with_ref_params_instance) + call void @__user_init_test_with_ref_params(ptr @test_with_ref_params_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!37, !38} !llvm.dbg.cu = !{!39} @@ -1303,7 +1255,7 @@ fn test_debug_info_auto_deref_alias_pointers() { END_STRUCT END_TYPE "#, ); - filtered_assert_snapshot!(codegen, @r###" + filtered_assert_snapshot!(codegen, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" @@ -1311,33 +1263,33 @@ fn test_debug_info_auto_deref_alias_pointers() { %myStruct = type { i32, i8 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !0 @global_struct = global %myStruct zeroinitializer, !dbg !10 @global_var = global i32 42, !dbg !12 - @alias_int = global i32* null, !dbg !14 - @alias_struct = global %myStruct* null, !dbg !18 + @alias_int = global ptr null, !dbg !14 + @alias_struct = global ptr null, !dbg !18 - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_mystruct(%myStruct* @global_struct) - store i32* @global_var, i32** @alias_int, align 8 - store %myStruct* @global_struct, %myStruct** @alias_struct, align 8 - call void @__user_init_myStruct(%myStruct* @global_struct) + call void @__init_mystruct(ptr @global_struct) + store ptr @global_var, ptr @alias_int, align 8 + store ptr @global_struct, ptr @alias_struct, align 8 + call void @__user_init_myStruct(ptr @global_struct) ret void } @@ -1370,7 +1322,7 @@ fn test_debug_info_auto_deref_alias_pointers() { !23 = !{i32 2, !"Debug Info Version", i32 3} !24 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "RuSTy Structured text Compiler", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !25, splitDebugInlining: false) !25 = !{!12, !14, !10, !0, !18} - "###) + "#) } #[test] @@ -1402,50 +1354,45 @@ fn test_debug_info_mixed_pointer_types() { target datalayout = "[filtered]" target triple = "[filtered]" - %mixed_ptr = type { [81 x i8]*, i32*, i8*, i8* } + %mixed_ptr = type { ptr, ptr, ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @mixed_ptr_instance = global %mixed_ptr zeroinitializer, !dbg !0 - @regular_ptr = global i32* null, !dbg !24 - @alias_var = global i32** null, !dbg !28 + @regular_ptr = global ptr null, !dbg !24 + @alias_var = global ptr null, !dbg !28 - define void @mixed_ptr(%mixed_ptr* %0) !dbg !38 { + define void @mixed_ptr(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %mixed_ptr* %0, metadata !42, metadata !DIExpression()), !dbg !43 - %ref_param = getelementptr inbounds %mixed_ptr, %mixed_ptr* %0, i32 0, i32 0 - %inout_param = getelementptr inbounds %mixed_ptr, %mixed_ptr* %0, i32 0, i32 1 - %local_ptr = getelementptr inbounds %mixed_ptr, %mixed_ptr* %0, i32 0, i32 2 - %local_ref = getelementptr inbounds %mixed_ptr, %mixed_ptr* %0, i32 0, i32 3 + #dbg_declare(ptr %0, !42, !DIExpression(), !43) + %ref_param = getelementptr inbounds nuw %mixed_ptr, ptr %0, i32 0, i32 0 + %inout_param = getelementptr inbounds nuw %mixed_ptr, ptr %0, i32 0, i32 1 + %local_ptr = getelementptr inbounds nuw %mixed_ptr, ptr %0, i32 0, i32 2 + %local_ref = getelementptr inbounds nuw %mixed_ptr, ptr %0, i32 0, i32 3 ret void, !dbg !43 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_mixed_ptr(%mixed_ptr* %0) { + define void @__init_mixed_ptr(ptr %0) { entry: - %self = alloca %mixed_ptr*, align 8 - store %mixed_ptr* %0, %mixed_ptr** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_mixed_ptr(%mixed_ptr* %0) { + define void @__user_init_mixed_ptr(ptr %0) { entry: - %self = alloca %mixed_ptr*, align 8 - store %mixed_ptr* %0, %mixed_ptr** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_mixed_ptr(%mixed_ptr* @mixed_ptr_instance) - store i32** @regular_ptr, i32*** @alias_var, align 8 - call void @__user_init_mixed_ptr(%mixed_ptr* @mixed_ptr_instance) + call void @__init_mixed_ptr(ptr @mixed_ptr_instance) + store ptr @regular_ptr, ptr @alias_var, align 8 + call void @__user_init_mixed_ptr(ptr @mixed_ptr_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!34, !35} !llvm.dbg.cu = !{!36} @@ -1529,66 +1476,61 @@ fn test_debug_info_auto_deref_reference_to_pointers() { target datalayout = "[filtered]" target triple = "[filtered]" + %test_with_reference_params = type { ptr, ptr, ptr } %myStruct = type { i32, i8 } - %test_with_reference_params = type { i32*, [6 x i8]*, %myStruct* } - @basic_reference = global i32* null, !dbg !0 - @array_reference = global [11 x i32]* null, !dbg !6 - @struct_reference = global %myStruct* null, !dbg !13 - @string_reference = global [81 x i8]* null, !dbg !22 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @basic_reference = global ptr null, !dbg !0 + @array_reference = global ptr null, !dbg !6 + @struct_reference = global ptr null, !dbg !13 + @string_reference = global ptr null, !dbg !22 + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @test_with_reference_params_instance = global %test_with_reference_params zeroinitializer, !dbg !31 @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !47 - define void @test_with_reference_params(%test_with_reference_params* %0) !dbg !54 { + define void @test_with_reference_params(ptr %0) !dbg !54 { entry: - call void @llvm.dbg.declare(metadata %test_with_reference_params* %0, metadata !58, metadata !DIExpression()), !dbg !59 - %ref_param = getelementptr inbounds %test_with_reference_params, %test_with_reference_params* %0, i32 0, i32 0 - %array_ref_param = getelementptr inbounds %test_with_reference_params, %test_with_reference_params* %0, i32 0, i32 1 - %local_reference = getelementptr inbounds %test_with_reference_params, %test_with_reference_params* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !58, !DIExpression(), !59) + %ref_param = getelementptr inbounds nuw %test_with_reference_params, ptr %0, i32 0, i32 0 + %array_ref_param = getelementptr inbounds nuw %test_with_reference_params, ptr %0, i32 0, i32 1 + %local_reference = getelementptr inbounds nuw %test_with_reference_params, ptr %0, i32 0, i32 2 ret void, !dbg !59 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_test_with_reference_params(%test_with_reference_params* %0) { + define void @__init_test_with_reference_params(ptr %0) { entry: - %self = alloca %test_with_reference_params*, align 8 - store %test_with_reference_params* %0, %test_with_reference_params** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_test_with_reference_params(%test_with_reference_params* %0) { + define void @__user_init_test_with_reference_params(ptr %0) { entry: - %self = alloca %test_with_reference_params*, align 8 - store %test_with_reference_params* %0, %test_with_reference_params** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_test_with_reference_params(%test_with_reference_params* @test_with_reference_params_instance) - call void @__user_init_test_with_reference_params(%test_with_reference_params* @test_with_reference_params_instance) + call void @__init_test_with_reference_params(ptr @test_with_reference_params_instance) + call void @__user_init_test_with_reference_params(ptr @test_with_reference_params_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!50, !51} !llvm.dbg.cu = !{!52} @@ -1678,33 +1620,28 @@ fn range_datatype_debug() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] define i32 @main() !dbg !4 { entry: %main = alloca i32, align 4 %r = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %r, metadata !8, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %r, align 4 - call void @llvm.dbg.declare(metadata i32* %main, metadata !12, metadata !DIExpression()), !dbg !13 - store i32 0, i32* %main, align 4 - store i32 50, i32* %r, align 4, !dbg !14 - %load_r = load i32, i32* %r, align 4, !dbg !15 - store i32 %load_r, i32* %main, align 4, !dbg !15 - %main_ret = load i32, i32* %main, align 4, !dbg !16 + #dbg_declare(ptr %r, !8, !DIExpression(), !11) + store i32 0, ptr %r, align 4 + #dbg_declare(ptr %main, !12, !DIExpression(), !13) + store i32 0, ptr %main, align 4 + store i32 50, ptr %r, align 4, !dbg !14 + %load_r = load i32, ptr %r, align 4, !dbg !15 + store i32 %load_r, ptr %main, align 4, !dbg !15 + %main_ret = load i32, ptr %main, align 4, !dbg !16 ret i32 %main_ret, !dbg !16 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - define void @__init___Test() { entry: ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} @@ -1756,33 +1693,28 @@ fn range_datatype_reference_expr_bounds_debug() { target triple = "[filtered]" @ZERO = unnamed_addr constant i32 0, !dbg !0 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] define i32 @main() !dbg !9 { entry: %main = alloca i32, align 4 %r = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %r, metadata !13, metadata !DIExpression()), !dbg !15 - store i32 0, i32* %r, align 4 - call void @llvm.dbg.declare(metadata i32* %main, metadata !16, metadata !DIExpression()), !dbg !17 - store i32 0, i32* %main, align 4 - store i32 50, i32* %r, align 4, !dbg !18 - %load_r = load i32, i32* %r, align 4, !dbg !19 - store i32 %load_r, i32* %main, align 4, !dbg !19 - %main_ret = load i32, i32* %main, align 4, !dbg !20 + #dbg_declare(ptr %r, !13, !DIExpression(), !15) + store i32 0, ptr %r, align 4 + #dbg_declare(ptr %main, !16, !DIExpression(), !17) + store i32 0, ptr %main, align 4 + store i32 50, ptr %r, align 4, !dbg !18 + %load_r = load i32, ptr %r, align 4, !dbg !19 + store i32 %load_r, ptr %main, align 4, !dbg !19 + %main_ret = load i32, ptr %main, align 4, !dbg !20 ret i32 %main_ret, !dbg !20 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - define void @__init___Test() { entry: ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!5, !6} !llvm.dbg.cu = !{!7} @@ -1836,43 +1768,38 @@ fn range_datatype_fqn_reference_bounds_debug() { %prog = type { i32, i32 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog { i32 10, i32 0 }, !dbg !0 - define void @prog(%prog* %0) !dbg !14 { + define void @prog(ptr %0) !dbg !14 { entry: - call void @llvm.dbg.declare(metadata %prog* %0, metadata !18, metadata !DIExpression()), !dbg !19 - %TEN = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %r = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !18, !DIExpression(), !19) + %TEN = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %r = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 ret void, !dbg !19 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__user_init_prog(%prog* @prog_instance) + call void @__init_prog(ptr @prog_instance) + call void @__user_init_prog(ptr @prog_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!10, !11} !llvm.dbg.cu = !{!12} @@ -1927,45 +1854,40 @@ fn range_datatype_debug_alias_reused() { %prog = type { i32, i32, i32, i32 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog { i32 10, i32 0, i32 0, i32 0 }, !dbg !0 - define void @prog(%prog* %0) !dbg !16 { + define void @prog(ptr %0) !dbg !16 { entry: - call void @llvm.dbg.declare(metadata %prog* %0, metadata !20, metadata !DIExpression()), !dbg !21 - %ZERO = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %u = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %v = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 - %w = getelementptr inbounds %prog, %prog* %0, i32 0, i32 3 + #dbg_declare(ptr %0, !20, !DIExpression(), !21) + %ZERO = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %u = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %v = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 + %w = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 3 ret void, !dbg !21 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__user_init_prog(%prog* @prog_instance) + call void @__init_prog(ptr @prog_instance) + call void @__user_init_prog(ptr @prog_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!12, !13} !llvm.dbg.cu = !{!14} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__aggregate_return_value_variable_in_function.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__aggregate_return_value_variable_in_function.snap index 84a4db90766..dfa01b38ff7 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__aggregate_return_value_variable_in_function.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__aggregate_return_value_variable_in_function.snap @@ -9,24 +9,20 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -define void @myFunc(i8* %0) !dbg !4 { +define void @myFunc(ptr %0) !dbg !4 { entry: - %myFunc = alloca i8*, align 8 - call void @llvm.dbg.declare(metadata i8** %myFunc, metadata !16, metadata !DIExpression()), !dbg !17 - store i8* %0, i8** %myFunc, align 8 - %deref = load i8*, i8** %myFunc, align 8, !dbg !18 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false), !dbg !18 + %myFunc = alloca ptr, align 8 + #dbg_declare(ptr %myFunc, !16, !DIExpression(), !17) + store ptr %0, ptr %myFunc, align 8 + %deref = load ptr, ptr %myFunc, align 8, !dbg !18 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false), !dbg !18 ret void, !dbg !19 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__array_size_correctly_set_in_dwarf_info.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__array_size_correctly_set_in_dwarf_info.snap index 6e404bbe9f4..3060a82cc21 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__array_size_correctly_set_in_dwarf_info.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__array_size_correctly_set_in_dwarf_info.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,23 +11,18 @@ define i32 @foo() !dbg !4 { entry: %foo = alloca i32, align 4 %a = alloca [64 x i32], align 4 - call void @llvm.dbg.declare(metadata [64 x i32]* %a, metadata !9, metadata !DIExpression()), !dbg !14 - %0 = bitcast [64 x i32]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([64 x i32]* getelementptr ([64 x i32], [64 x i32]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata i32* %foo, metadata !15, metadata !DIExpression()), !dbg !16 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4, !dbg !17 + #dbg_declare(ptr %a, !9, !DIExpression(), !14) + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([64 x i32], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %foo, !15, !DIExpression(), !16) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4, !dbg !17 ret i32 %foo_ret, !dbg !17 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__assignment_statement_have_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__assignment_statement_have_location.snap index a502b7fa104..5a95a0e2c35 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__assignment_statement_have_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__assignment_statement_have_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,18 +10,13 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 - store i32 3, i32* %myFunc, align 4, !dbg !12 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !13 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 + store i32 3, ptr %myFunc, align 4, !dbg !12 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !13 ret i32 %myFunc_ret, !dbg !13 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__case_conditions_location_marked.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__case_conditions_location_marked.snap index 2f49ccc588f..f9cf0d23aa4 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__case_conditions_location_marked.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__case_conditions_location_marked.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,37 +10,32 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 - %load_myFunc = load i32, i32* %myFunc, align 4, !dbg !12 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 + %load_myFunc = load i32, ptr %myFunc, align 4, !dbg !12 switch i32 %load_myFunc, label %else [ i32 1, label %case i32 2, label %case1 ], !dbg !13 case: ; preds = %entry - store i32 1, i32* %myFunc, align 4, !dbg !14 + store i32 1, ptr %myFunc, align 4, !dbg !14 br label %continue, !dbg !15 case1: ; preds = %entry - store i32 1, i32* %myFunc, align 4, !dbg !16 + store i32 1, ptr %myFunc, align 4, !dbg !16 br label %continue, !dbg !15 else: ; preds = %entry - store i32 1, i32* %myFunc, align 4, !dbg !17 + store i32 1, ptr %myFunc, align 4, !dbg !17 br label %continue, !dbg !15 continue: ; preds = %else, %case1, %case - store i32 1, i32* %myFunc, align 4, !dbg !18 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !19 + store i32 1, ptr %myFunc, align 4, !dbg !18 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !19 ret i32 %myFunc_ret, !dbg !19 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__exit_statement_have_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__exit_statement_have_location.snap index 7264034f190..de0a0dd8c83 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__exit_statement_have_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__exit_statement_have_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,8 +10,8 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 br label %condition_check, !dbg !12 condition_check: ; preds = %entry, %continue1 @@ -22,8 +21,8 @@ while_body: ; preds = %condition_check br i1 false, label %condition_body, label %continue1, !dbg !13 continue: ; preds = %condition_body, %condition_check - store i32 1, i32* %myFunc, align 4, !dbg !14 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !15 + store i32 1, ptr %myFunc, align 4, !dbg !14 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !15 ret i32 %myFunc_ret, !dbg !15 condition_body: ; preds = %while_body @@ -36,11 +35,6 @@ continue1: ; preds = %buffer_block, %whil br label %condition_check, !dbg !12 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__external_impl_is_not_added_as_external_subroutine.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__external_impl_is_not_added_as_external_subroutine.snap index b1c4d01bd6e..e0f6ac7a096 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__external_impl_is_not_added_as_external_subroutine.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__external_impl_is_not_added_as_external_subroutine.snap @@ -15,9 +15,9 @@ target triple = "[filtered]" declare i32 @myFunc() -declare void @myPrg(%myPrg*) +declare void @myPrg(ptr) -declare void @myFb(%myFb*) +declare void @myFb(ptr) !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__for_conditions_location_marked.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__for_conditions_location_marked.snap index b7700cffec2..f5a1189e40d 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__for_conditions_location_marked.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__for_conditions_location_marked.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,41 +10,36 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 - store i32 1, i32* %myFunc, align 4, !dbg !12 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 + store i32 1, ptr %myFunc, align 4, !dbg !12 br i1 true, label %predicate_sle, label %predicate_sge, !dbg !12 predicate_sle: ; preds = %increment, %entry - %0 = load i32, i32* %myFunc, align 4, !dbg !12 + %0 = load i32, ptr %myFunc, align 4, !dbg !12 %condition = icmp sle i32 %0, 20, !dbg !12 br i1 %condition, label %loop, label %continue, !dbg !12 predicate_sge: ; preds = %increment, %entry - %1 = load i32, i32* %myFunc, align 4, !dbg !12 + %1 = load i32, ptr %myFunc, align 4, !dbg !12 %condition1 = icmp sge i32 %1, 20, !dbg !12 br i1 %condition1, label %loop, label %continue, !dbg !12 loop: ; preds = %predicate_sge, %predicate_sle - store i32 1, i32* %myFunc, align 4, !dbg !13 + store i32 1, ptr %myFunc, align 4, !dbg !13 br label %increment, !dbg !14 increment: ; preds = %loop - %2 = load i32, i32* %myFunc, align 4, !dbg !14 + %2 = load i32, ptr %myFunc, align 4, !dbg !14 %next = add i32 2, %2, !dbg !14 - store i32 %next, i32* %myFunc, align 4, !dbg !14 + store i32 %next, ptr %myFunc, align 4, !dbg !14 br i1 true, label %predicate_sle, label %predicate_sge, !dbg !14 continue: ; preds = %predicate_sge, %predicate_sle - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !15 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !15 ret i32 %myFunc_ret, !dbg !15 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_have_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_have_location.snap index d2a6bed650b..9e3ffb9265e 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_have_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_have_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,18 +10,13 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 %call = call i32 @myFunc(), !dbg !12 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !13 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !13 ret i32 %myFunc_ret, !dbg !13 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_in_expressions_have_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_in_expressions_have_location.snap index 5d089028175..12809603aa6 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_in_expressions_have_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__function_calls_in_expressions_have_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,19 +10,14 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 %call = call i32 @myFunc(), !dbg !12 %tmpVar = add i32 1, %call, !dbg !12 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !13 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !13 ret i32 %myFunc_ret, !dbg !13 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__if_conditions_location_marked.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__if_conditions_location_marked.snap index 8f820044442..2ff1fcd08a5 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__if_conditions_location_marked.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__if_conditions_location_marked.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,36 +10,31 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 br i1 true, label %condition_body, label %branch, !dbg !12 condition_body: ; preds = %entry - store i32 1, i32* %myFunc, align 4, !dbg !13 + store i32 1, ptr %myFunc, align 4, !dbg !13 br label %continue, !dbg !14 branch: ; preds = %entry br i1 false, label %condition_body1, label %else, !dbg !15 condition_body1: ; preds = %branch - store i32 1, i32* %myFunc, align 4, !dbg !16 + store i32 1, ptr %myFunc, align 4, !dbg !16 br label %continue, !dbg !14 else: ; preds = %branch - store i32 1, i32* %myFunc, align 4, !dbg !17 + store i32 1, ptr %myFunc, align 4, !dbg !17 br label %continue, !dbg !14 continue: ; preds = %else, %condition_body1, %condition_body - store i32 1, i32* %myFunc, align 4, !dbg !18 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !19 + store i32 1, ptr %myFunc, align 4, !dbg !18 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !19 ret i32 %myFunc_ret, !dbg !19 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__implementation_added_as_subroutine.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__implementation_added_as_subroutine.snap index da48c3a0d1e..2e77db8186a 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__implementation_added_as_subroutine.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__implementation_added_as_subroutine.snap @@ -16,31 +16,26 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !14 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !17, metadata !DIExpression()), !dbg !19 - store i32 0, i32* %myFunc, align 4 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !20 + #dbg_declare(ptr %myFunc, !17, !DIExpression(), !19) + store i32 0, ptr %myFunc, align 4 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !20 ret i32 %myFunc_ret, !dbg !20 } -define void @myPrg(%myPrg* %0) !dbg !21 { +define void @myPrg(ptr %0) !dbg !21 { entry: - call void @llvm.dbg.declare(metadata %myPrg* %0, metadata !24, metadata !DIExpression()), !dbg !25 + #dbg_declare(ptr %0, !24, !DIExpression(), !25) ret void, !dbg !25 } -define void @myFb(%myFb* %0) !dbg !26 { +define void @myFb(ptr %0) !dbg !26 { entry: - call void @llvm.dbg.declare(metadata %myFb* %0, metadata !29, metadata !DIExpression()), !dbg !30 - %this = alloca %myFb*, align 8 - store %myFb* %0, %myFb** %this, align 8 + #dbg_declare(ptr %0, !29, !DIExpression(), !30) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void, !dbg !30 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!9, !10} !llvm.dbg.cu = !{!11} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__nested_function_calls_get_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__nested_function_calls_get_location.snap index d9ee6c7b9df..c1235b690d2 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__nested_function_calls_get_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__nested_function_calls_get_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,21 +11,16 @@ define i32 @myFunc(i32 %0) !dbg !4 { entry: %myFunc = alloca i32, align 4 %x = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %x, metadata !10, metadata !DIExpression()), !dbg !11 - store i32 %0, i32* %x, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !12, metadata !DIExpression()), !dbg !13 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %x, !10, !DIExpression(), !11) + store i32 %0, ptr %x, align 4 + #dbg_declare(ptr %myFunc, !12, !DIExpression(), !13) + store i32 0, ptr %myFunc, align 4 %call = call i32 @myFunc(i32 1), !dbg !14 %call1 = call i32 @myFunc(i32 %call), !dbg !15 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !16 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !16 ret i32 %myFunc_ret, !dbg !16 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_callable_expressions_have_no_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_callable_expressions_have_no_location.snap index 842f6b68a2c..8e81f73207a 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_callable_expressions_have_no_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_callable_expressions_have_no_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,18 +10,13 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 - %load_myFunc = load i32, i32* %myFunc, align 4, !dbg !12 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !13 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 + %load_myFunc = load i32, ptr %myFunc, align 4, !dbg !12 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !13 ret i32 %myFunc_ret, !dbg !13 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_function_pous_have_struct_as_param.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_function_pous_have_struct_as_param.snap index 8fcde6169a8..1fe30f541e5 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_function_pous_have_struct_as_param.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__non_function_pous_have_struct_as_param.snap @@ -13,33 +13,28 @@ target triple = "[filtered]" @myProg_instance = global %myProg zeroinitializer, !dbg !0 @__fb__init = unnamed_addr constant %fb zeroinitializer, !dbg !7 -define void @myProg(%myProg* %0) !dbg !18 { +define void @myProg(ptr %0) !dbg !18 { entry: - call void @llvm.dbg.declare(metadata %myProg* %0, metadata !22, metadata !DIExpression()), !dbg !23 - %x = getelementptr inbounds %myProg, %myProg* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4, !dbg !23 + #dbg_declare(ptr %0, !22, !DIExpression(), !23) + %x = getelementptr inbounds nuw %myProg, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4, !dbg !23 %tmpVar = add i32 %load_x, 2, !dbg !23 - store i32 %tmpVar, i32* %x, align 4, !dbg !23 + store i32 %tmpVar, ptr %x, align 4, !dbg !23 ret void, !dbg !24 } -define void @fb(%fb* %0) !dbg !25 { +define void @fb(ptr %0) !dbg !25 { entry: - call void @llvm.dbg.declare(metadata %fb* %0, metadata !28, metadata !DIExpression()), !dbg !29 - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4, !dbg !29 + #dbg_declare(ptr %0, !28, !DIExpression(), !29) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4, !dbg !29 %tmpVar = add i32 %load_x, 2, !dbg !29 - store i32 %tmpVar, i32* %x, align 4, !dbg !29 + store i32 %tmpVar, ptr %x, align 4, !dbg !29 ret void, !dbg !30 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!13, !14} !llvm.dbg.cu = !{!15} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__repeat_conditions_location_marked.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__repeat_conditions_location_marked.snap index 6e17e4d99be..90be5723607 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__repeat_conditions_location_marked.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__repeat_conditions_location_marked.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,24 +10,24 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 br label %condition_check, !dbg !12 condition_check: ; preds = %entry, %continue1 br i1 true, label %while_body, label %continue, !dbg !13 while_body: ; preds = %condition_check - store i32 1, i32* %myFunc, align 4, !dbg !14 - %load_myFunc = load i32, i32* %myFunc, align 4, !dbg !13 + store i32 1, ptr %myFunc, align 4, !dbg !14 + %load_myFunc = load i32, ptr %myFunc, align 4, !dbg !13 %tmpVar = icmp sgt i32 %load_myFunc, 10, !dbg !13 %0 = zext i1 %tmpVar to i8, !dbg !13 %1 = icmp ne i8 %0, 0, !dbg !13 br i1 %1, label %condition_body, label %continue1, !dbg !13 continue: ; preds = %condition_body, %condition_check - store i32 1, i32* %myFunc, align 4, !dbg !15 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !16 + store i32 1, ptr %myFunc, align 4, !dbg !15 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !16 ret i32 %myFunc_ret, !dbg !16 condition_body: ; preds = %while_body @@ -41,11 +40,6 @@ continue1: ; preds = %buffer_block, %whil br label %condition_check, !dbg !12 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__return_statement_have_location.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__return_statement_have_location.snap index 4d8bf4fccf3..9ed1e0ace1f 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__return_statement_have_location.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__return_statement_have_location.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,21 +10,16 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !12 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !12 ret i32 %myFunc_ret, !dbg !12 buffer_block: ; No predecessors! - %myFunc_ret1 = load i32, i32* %myFunc, align 4, !dbg !13 + %myFunc_ret1 = load i32, ptr %myFunc, align 4, !dbg !13 ret i32 %myFunc_ret1, !dbg !13 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_and_vartemp_variables_in_pous_added_as_local.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_and_vartemp_variables_in_pous_added_as_local.snap index c948ce2acbd..43408fb55b7 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_and_vartemp_variables_in_pous_added_as_local.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_and_vartemp_variables_in_pous_added_as_local.snap @@ -19,55 +19,50 @@ entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %a, metadata !17, metadata !DIExpression()), !dbg !19 - store i32 0, i32* %a, align 4 - call void @llvm.dbg.declare(metadata i32* %b, metadata !20, metadata !DIExpression()), !dbg !21 - store i32 0, i32* %b, align 4 - call void @llvm.dbg.declare(metadata i32* %c, metadata !22, metadata !DIExpression()), !dbg !23 - store i32 0, i32* %c, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !24, metadata !DIExpression()), !dbg !25 - store i32 0, i32* %myFunc, align 4 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !26 + #dbg_declare(ptr %a, !17, !DIExpression(), !19) + store i32 0, ptr %a, align 4 + #dbg_declare(ptr %b, !20, !DIExpression(), !21) + store i32 0, ptr %b, align 4 + #dbg_declare(ptr %c, !22, !DIExpression(), !23) + store i32 0, ptr %c, align 4 + #dbg_declare(ptr %myFunc, !24, !DIExpression(), !25) + store i32 0, ptr %myFunc, align 4 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !26 ret i32 %myFunc_ret, !dbg !26 } -define void @myPrg(%myPrg* %0) !dbg !27 { +define void @myPrg(ptr %0) !dbg !27 { entry: - call void @llvm.dbg.declare(metadata %myPrg* %0, metadata !30, metadata !DIExpression()), !dbg !31 + #dbg_declare(ptr %0, !30, !DIExpression(), !31) %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %a, metadata !32, metadata !DIExpression()), !dbg !33 - store i32 0, i32* %a, align 4 - call void @llvm.dbg.declare(metadata i32* %b, metadata !34, metadata !DIExpression()), !dbg !35 - store i32 0, i32* %b, align 4 - call void @llvm.dbg.declare(metadata i32* %c, metadata !36, metadata !DIExpression()), !dbg !37 - store i32 0, i32* %c, align 4 + #dbg_declare(ptr %a, !32, !DIExpression(), !33) + store i32 0, ptr %a, align 4 + #dbg_declare(ptr %b, !34, !DIExpression(), !35) + store i32 0, ptr %b, align 4 + #dbg_declare(ptr %c, !36, !DIExpression(), !37) + store i32 0, ptr %c, align 4 ret void, !dbg !31 } -define void @myFb(%myFb* %0) !dbg !38 { +define void @myFb(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %myFb* %0, metadata !41, metadata !DIExpression()), !dbg !42 - %this = alloca %myFb*, align 8 - store %myFb* %0, %myFb** %this, align 8 + #dbg_declare(ptr %0, !41, !DIExpression(), !42) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %a, metadata !43, metadata !DIExpression()), !dbg !44 - store i32 0, i32* %a, align 4 - call void @llvm.dbg.declare(metadata i32* %b, metadata !45, metadata !DIExpression()), !dbg !46 - store i32 0, i32* %b, align 4 - call void @llvm.dbg.declare(metadata i32* %c, metadata !47, metadata !DIExpression()), !dbg !48 - store i32 0, i32* %c, align 4 + #dbg_declare(ptr %a, !43, !DIExpression(), !44) + store i32 0, ptr %a, align 4 + #dbg_declare(ptr %b, !45, !DIExpression(), !46) + store i32 0, ptr %b, align 4 + #dbg_declare(ptr %c, !47, !DIExpression(), !48) + store i32 0, ptr %c, align 4 ret void, !dbg !42 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!9, !10} !llvm.dbg.cu = !{!11} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_in_out_inout_in_function_added_as_params.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_in_out_inout_in_function_added_as_params.snap index 96c08fc85af..3853e894fc5 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_in_out_inout_in_function_added_as_params.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__var_in_out_inout_in_function_added_as_params.snap @@ -7,28 +7,23 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i32 @myFunc(i16* %0) !dbg !4 { +define i32 @myFunc(ptr %0) !dbg !4 { entry: %myFunc = alloca i32, align 4 - %x = alloca i16*, align 8 - call void @llvm.dbg.declare(metadata i16** %x, metadata !12, metadata !DIExpression()), !dbg !13 - store i16* %0, i16** %x, align 8 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !14, metadata !DIExpression()), !dbg !16 - store i32 0, i32* %myFunc, align 4 - %deref = load i16*, i16** %x, align 8, !dbg !17 - %load_x = load i16, i16* %deref, align 2, !dbg !17 + %x = alloca ptr, align 8 + #dbg_declare(ptr %x, !12, !DIExpression(), !13) + store ptr %0, ptr %x, align 8 + #dbg_declare(ptr %myFunc, !14, !DIExpression(), !16) + store i32 0, ptr %myFunc, align 4 + %deref = load ptr, ptr %x, align 8, !dbg !17 + %load_x = load i16, ptr %deref, align 2, !dbg !17 %1 = sext i16 %load_x to i32, !dbg !17 %tmpVar = add i32 %1, 2, !dbg !17 - store i32 %tmpVar, i32* %myFunc, align 4, !dbg !17 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !18 + store i32 %tmpVar, ptr %myFunc, align 4, !dbg !17 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !18 ret i32 %myFunc_ret, !dbg !18 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__while_conditions_location_marked.snap b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__while_conditions_location_marked.snap index 770af9dec12..2225aa7dca7 100644 --- a/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__while_conditions_location_marked.snap +++ b/src/codegen/tests/debug_tests/snapshots/rusty__codegen__tests__debug_tests__expression_debugging__while_conditions_location_marked.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/debug_tests/expression_debugging.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,15 +10,15 @@ target triple = "[filtered]" define i32 @myFunc() !dbg !4 { entry: %myFunc = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %myFunc, metadata !9, metadata !DIExpression()), !dbg !11 - store i32 0, i32* %myFunc, align 4 + #dbg_declare(ptr %myFunc, !9, !DIExpression(), !11) + store i32 0, ptr %myFunc, align 4 br label %condition_check, !dbg !12 condition_check: ; preds = %entry, %continue1 br i1 true, label %while_body, label %continue, !dbg !13 while_body: ; preds = %condition_check - %load_myFunc = load i32, i32* %myFunc, align 4, !dbg !13 + %load_myFunc = load i32, ptr %myFunc, align 4, !dbg !13 %tmpVar = icmp sgt i32 %load_myFunc, 1, !dbg !13 %0 = zext i1 %tmpVar to i8, !dbg !13 %1 = icmp ne i8 %0, 0, !dbg !13 @@ -27,8 +26,8 @@ while_body: ; preds = %condition_check br i1 %tmpVar2, label %condition_body, label %continue1, !dbg !13 continue: ; preds = %condition_body, %condition_check - store i32 1, i32* %myFunc, align 4, !dbg !14 - %myFunc_ret = load i32, i32* %myFunc, align 4, !dbg !15 + store i32 1, ptr %myFunc, align 4, !dbg !14 + %myFunc_ret = load i32, ptr %myFunc, align 4, !dbg !15 ret i32 %myFunc_ret, !dbg !15 condition_body: ; preds = %while_body @@ -38,15 +37,10 @@ buffer_block: ; No predecessors! br label %continue1, !dbg !16 continue1: ; preds = %buffer_block, %while_body - store i32 1, i32* %myFunc, align 4, !dbg !17 + store i32 1, ptr %myFunc, align 4, !dbg !17 br label %condition_check, !dbg !12 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/src/codegen/tests/directaccess_test.rs b/src/codegen/tests/directaccess_test.rs index b7d3c99c767..256b4d909c0 100644 --- a/src/codegen/tests/directaccess_test.rs +++ b/src/codegen/tests/directaccess_test.rs @@ -151,12 +151,12 @@ fn direct_acess_in_output_assignment_implicit_explicit_and_mixed() { @__FOO__init = unnamed_addr constant %FOO zeroinitializer - define void @FOO(%FOO* %0) { + define void @FOO(ptr %0) { entry: - %this = alloca %FOO*, align 8 - store %FOO* %0, %FOO** %this, align 8 - %X = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 0 - %Y = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %X = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 0 + %Y = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 1 ret void } @@ -165,63 +165,62 @@ fn direct_acess_in_output_assignment_implicit_explicit_and_mixed() { %main = alloca i32, align 4 %error_bits = alloca i8, align 1 %f = alloca %FOO, align 8 - store i8 0, i8* %error_bits, align 1 - %0 = bitcast %FOO* %f to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%FOO, %FOO* @__FOO__init, i32 0, i32 0), i64 ptrtoint (%FOO* getelementptr (%FOO, %FOO* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %1 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %load_error_bits = load i8, i8* %error_bits, align 1 + store i8 0, ptr %error_bits, align 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %f, ptr align 1 @__FOO__init, i64 ptrtoint (ptr getelementptr (%FOO, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %0 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %load_error_bits = load i8, ptr %error_bits, align 1 %shift = lshr i8 %load_error_bits, 0 - %2 = and i8 %shift, 1 - store i8 %2, i8* %1, align 1 - call void @FOO(%FOO* %f) - %3 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 1 - %4 = load i8, i8* %error_bits, align 1 - %5 = load i8, i8* %3, align 1 - %erase = and i8 %4, -2 - %value = shl i8 %5, 0 + %1 = and i8 %shift, 1 + store i8 %1, ptr %0, align 1 + call void @FOO(ptr %f) + %2 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 1 + %3 = load i8, ptr %error_bits, align 1 + %4 = load i8, ptr %2, align 1 + %erase = and i8 %3, -2 + %value = shl i8 %4, 0 %or = or i8 %erase, %value - store i8 %or, i8* %error_bits, align 1 - %6 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %load_error_bits1 = load i8, i8* %error_bits, align 1 + store i8 %or, ptr %error_bits, align 1 + %5 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %load_error_bits1 = load i8, ptr %error_bits, align 1 %shift2 = lshr i8 %load_error_bits1, 0 - %7 = and i8 %shift2, 1 - store i8 %7, i8* %6, align 1 - call void @FOO(%FOO* %f) - %8 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 1 - %9 = load i8, i8* %error_bits, align 1 - %10 = load i8, i8* %8, align 1 - %erase3 = and i8 %9, -2 - %value4 = shl i8 %10, 0 + %6 = and i8 %shift2, 1 + store i8 %6, ptr %5, align 1 + call void @FOO(ptr %f) + %7 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 1 + %8 = load i8, ptr %error_bits, align 1 + %9 = load i8, ptr %7, align 1 + %erase3 = and i8 %8, -2 + %value4 = shl i8 %9, 0 %or5 = or i8 %erase3, %value4 - store i8 %or5, i8* %error_bits, align 1 - %11 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %load_error_bits6 = load i8, i8* %error_bits, align 1 + store i8 %or5, ptr %error_bits, align 1 + %10 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %load_error_bits6 = load i8, ptr %error_bits, align 1 %shift7 = lshr i8 %load_error_bits6, 0 - %12 = and i8 %shift7, 1 - store i8 %12, i8* %11, align 1 - call void @FOO(%FOO* %f) - %13 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 1 - %14 = load i8, i8* %error_bits, align 1 - %15 = load i8, i8* %13, align 1 - %erase8 = and i8 %14, -2 - %value9 = shl i8 %15, 0 + %11 = and i8 %shift7, 1 + store i8 %11, ptr %10, align 1 + call void @FOO(ptr %f) + %12 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 1 + %13 = load i8, ptr %error_bits, align 1 + %14 = load i8, ptr %12, align 1 + %erase8 = and i8 %13, -2 + %value9 = shl i8 %14, 0 %or10 = or i8 %erase8, %value9 - store i8 %or10, i8* %error_bits, align 1 - %16 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %load_error_bits11 = load i8, i8* %error_bits, align 1 + store i8 %or10, ptr %error_bits, align 1 + %15 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %load_error_bits11 = load i8, ptr %error_bits, align 1 %shift12 = lshr i8 %load_error_bits11, 0 - %17 = and i8 %shift12, 1 - store i8 %17, i8* %16, align 1 - call void @FOO(%FOO* %f) - %main_ret = load i32, i32* %main, align 4 + %16 = and i8 %shift12, 1 + store i8 %16, ptr %15, align 1 + call void @FOO(ptr %f) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -256,11 +255,11 @@ fn direct_acess_in_output_assignment_with_simple_expression() { @__FOO__init = unnamed_addr constant %FOO { i8 1 } - define void @FOO(%FOO* %0) { + define void @FOO(ptr %0) { entry: - %this = alloca %FOO*, align 8 - store %FOO* %0, %FOO** %this, align 8 - %Q = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %Q = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 0 ret void } @@ -269,26 +268,25 @@ fn direct_acess_in_output_assignment_with_simple_expression() { %main = alloca i32, align 4 %error_bits = alloca i8, align 1 %f = alloca %FOO, align 8 - store i8 -17, i8* %error_bits, align 1 - %0 = bitcast %FOO* %f to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%FOO, %FOO* @__FOO__init, i32 0, i32 0), i64 ptrtoint (%FOO* getelementptr (%FOO, %FOO* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - call void @FOO(%FOO* %f) - %1 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %2 = load i8, i8* %error_bits, align 1 - %3 = load i8, i8* %1, align 1 - %erase = and i8 %2, -17 - %value = shl i8 %3, 4 + store i8 -17, ptr %error_bits, align 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %f, ptr align 1 @__FOO__init, i64 ptrtoint (ptr getelementptr (%FOO, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + call void @FOO(ptr %f) + %0 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %1 = load i8, ptr %error_bits, align 1 + %2 = load i8, ptr %0, align 1 + %erase = and i8 %1, -17 + %value = shl i8 %2, 4 %or = or i8 %erase, %value - store i8 %or, i8* %error_bits, align 1 - %main_ret = load i32, i32* %main, align 4 + store i8 %or, ptr %error_bits, align 1 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -323,11 +321,11 @@ fn direct_acess_in_output_assignment_with_simple_expression_implicit() { @__FOO__init = unnamed_addr constant %FOO { i8 1 } - define void @FOO(%FOO* %0) { + define void @FOO(ptr %0) { entry: - %this = alloca %FOO*, align 8 - store %FOO* %0, %FOO** %this, align 8 - %Q = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %Q = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 0 ret void } @@ -336,26 +334,25 @@ fn direct_acess_in_output_assignment_with_simple_expression_implicit() { %main = alloca i32, align 4 %error_bits = alloca i8, align 1 %f = alloca %FOO, align 8 - store i8 -17, i8* %error_bits, align 1 - %0 = bitcast %FOO* %f to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%FOO, %FOO* @__FOO__init, i32 0, i32 0), i64 ptrtoint (%FOO* getelementptr (%FOO, %FOO* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - call void @FOO(%FOO* %f) - %1 = getelementptr inbounds %FOO, %FOO* %f, i32 0, i32 0 - %2 = load i8, i8* %error_bits, align 1 - %3 = load i8, i8* %1, align 1 - %erase = and i8 %2, -17 - %value = shl i8 %3, 4 + store i8 -17, ptr %error_bits, align 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %f, ptr align 1 @__FOO__init, i64 ptrtoint (ptr getelementptr (%FOO, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + call void @FOO(ptr %f) + %0 = getelementptr inbounds nuw %FOO, ptr %f, i32 0, i32 0 + %1 = load i8, ptr %error_bits, align 1 + %2 = load i8, ptr %0, align 1 + %erase = and i8 %1, -17 + %value = shl i8 %2, 4 %or = or i8 %erase, %value - store i8 %or, i8* %error_bits, align 1 - %main_ret = load i32, i32* %main, align 4 + store i8 %or, ptr %error_bits, align 1 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -403,11 +400,11 @@ fn direct_acess_in_output_assignment_with_complexe_expression() { @__foo_struct__init = unnamed_addr constant %foo_struct zeroinitializer @__bar_struct__init = unnamed_addr constant %bar_struct zeroinitializer - define void @QUUX(%QUUX* %0) { + define void @QUUX(ptr %0) { entry: - %this = alloca %QUUX*, align 8 - store %QUUX* %0, %QUUX** %this, align 8 - %Q = getelementptr inbounds %QUUX, %QUUX* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %Q = getelementptr inbounds nuw %QUUX, ptr %0, i32 0, i32 0 ret void } @@ -416,40 +413,38 @@ fn direct_acess_in_output_assignment_with_complexe_expression() { %main = alloca i32, align 4 %foo = alloca %foo_struct, align 8 %f = alloca %QUUX, align 8 - %0 = bitcast %foo_struct* %foo to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo_struct* @__foo_struct__init to i8*), i64 ptrtoint (%foo_struct* getelementptr (%foo_struct, %foo_struct* null, i32 1) to i64), i1 false) - %1 = bitcast %QUUX* %f to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds (%QUUX, %QUUX* @__QUUX__init, i32 0, i32 0), i64 ptrtoint (%QUUX* getelementptr (%QUUX, %QUUX* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - call void @QUUX(%QUUX* %f) - %bar = getelementptr inbounds %foo_struct, %foo_struct* %foo, i32 0, i32 0 - %baz = getelementptr inbounds %bar_struct, %bar_struct* %bar, i32 0, i32 0 - %2 = getelementptr inbounds %QUUX, %QUUX* %f, i32 0, i32 0 - %3 = load i64, i64* %baz, align 8 - %4 = load i8, i8* %2, align 1 - %erase = and i64 %3, -281474976710657 - %5 = zext i8 %4 to i64 - %value = shl i64 %5, 48 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %foo, ptr align 1 @__foo_struct__init, i64 ptrtoint (ptr getelementptr (%foo_struct, ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %f, ptr align 1 @__QUUX__init, i64 ptrtoint (ptr getelementptr (%QUUX, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + call void @QUUX(ptr %f) + %bar = getelementptr inbounds nuw %foo_struct, ptr %foo, i32 0, i32 0 + %baz = getelementptr inbounds nuw %bar_struct, ptr %bar, i32 0, i32 0 + %0 = getelementptr inbounds nuw %QUUX, ptr %f, i32 0, i32 0 + %1 = load i64, ptr %baz, align 8 + %2 = load i8, ptr %0, align 1 + %erase = and i64 %1, -281474976710657 + %3 = zext i8 %2 to i64 + %value = shl i64 %3, 48 %or = or i64 %erase, %value - store i64 %or, i64* %baz, align 8 - call void @QUUX(%QUUX* %f) - %bar1 = getelementptr inbounds %foo_struct, %foo_struct* %foo, i32 0, i32 0 - %baz2 = getelementptr inbounds %bar_struct, %bar_struct* %bar1, i32 0, i32 0 - %6 = getelementptr inbounds %QUUX, %QUUX* %f, i32 0, i32 0 - %7 = load i64, i64* %baz2, align 8 - %8 = load i8, i8* %6, align 1 - %erase3 = and i64 %7, -1125899906842625 - %9 = zext i8 %8 to i64 - %value4 = shl i64 %9, 50 + store i64 %or, ptr %baz, align 8 + call void @QUUX(ptr %f) + %bar1 = getelementptr inbounds nuw %foo_struct, ptr %foo, i32 0, i32 0 + %baz2 = getelementptr inbounds nuw %bar_struct, ptr %bar1, i32 0, i32 0 + %4 = getelementptr inbounds nuw %QUUX, ptr %f, i32 0, i32 0 + %5 = load i64, ptr %baz2, align 8 + %6 = load i8, ptr %4, align 1 + %erase3 = and i64 %5, -1125899906842625 + %7 = zext i8 %6 to i64 + %value4 = shl i64 %7, 50 %or5 = or i64 %erase3, %value4 - store i64 %or5, i64* %baz2, align 8 - %main_ret = load i32, i32* %main, align 4 + store i64 %or5, ptr %baz2, align 8 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } diff --git a/src/codegen/tests/expression_tests.rs b/src/codegen/tests/expression_tests.rs index 44bd3159764..8465392053d 100644 --- a/src/codegen/tests/expression_tests.rs +++ b/src/codegen/tests/expression_tests.rs @@ -298,16 +298,16 @@ fn builtin_function_call_adr() { target datalayout = "[filtered]" target triple = "[filtered]" - %main = type { i32*, i32 } + %main = type { ptr, i32 } @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store i32* %b, i32** %a, align 8 - store i32* %b, i32** %a, align 8 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store ptr %b, ptr %a, align 8 + store ptr %b, ptr %a, align 8 ret void } "#); @@ -336,16 +336,16 @@ fn builtin_function_call_ref() { target datalayout = "[filtered]" target triple = "[filtered]" - %main = type { i32*, i32 } + %main = type { ptr, i32 } @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store i32* %b, i32** %a, align 8 - store i32* %b, i32** %a, align 8 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store ptr %b, ptr %a, align 8 + store ptr %b, ptr %a, align 8 ret void } "#); @@ -401,19 +401,19 @@ fn builtin_function_call_sel() { @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %c = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_b = load i32, i32* %b, align 4 - %load_c = load i32, i32* %c, align 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_b = load i32, ptr %b, align 4 + %load_c = load i32, ptr %c, align 4 %1 = select i1 true, i32 %load_c, i32 %load_b - store i32 %1, i32* %a, align 4 - %load_b1 = load i32, i32* %b, align 4 - %load_c2 = load i32, i32* %c, align 4 + store i32 %1, ptr %a, align 4 + %load_b1 = load i32, ptr %b, align 4 + %load_c2 = load i32, ptr %c, align 4 %2 = select i1 true, i32 %load_c2, i32 %load_b1 - store i32 %2, i32* %a, align 4 + store i32 %2, ptr %a, align 4 ret void } "#); @@ -455,14 +455,14 @@ fn builtin_function_call_move() { @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %load_b = load i32, i32* %b, align 4 - store i32 %load_b, i32* %a, align 4 - %load_b1 = load i32, i32* %b, align 4 - store i32 %load_b1, i32* %a, align 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %load_b = load i32, ptr %b, align 4 + store i32 %load_b, ptr %a, align 4 + %load_b1 = load i32, ptr %b, align 4 + store i32 %load_b1, ptr %a, align 4 ret void } "#); @@ -491,12 +491,12 @@ fn builtin_function_call_sizeof() { @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store i32 ptrtoint (i64* getelementptr (i64, i64* null, i32 1) to i32), i32* %a, align 4 - store i32 ptrtoint (i64* getelementptr (i64, i64* null, i32 1) to i32), i32* %a, align 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store i32 ptrtoint (ptr getelementptr (i64, ptr null, i32 1) to i32), ptr %a, align 4 + store i32 ptrtoint (ptr getelementptr (i64, ptr null, i32 1) to i32), ptr %a, align 4 ret void } "#); @@ -531,47 +531,47 @@ fn builtin_function_call_lower_bound() { target triple = "[filtered]" %main = type { [2 x i32], i32 } - %__foo_vla = type { i32*, [2 x i32] } + %__foo_vla = type { ptr, [2 x i32] } @main_instance = global %main zeroinitializer @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %auto_deref = load [2 x i32], [2 x i32]* %a, align 4 - %outer_arr_gep = getelementptr inbounds [2 x i32], [2 x i32]* %a, i32 0, i32 0 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %auto_deref = load [2 x i32], ptr %a, align 4 + %outer_arr_gep = getelementptr inbounds [2 x i32], ptr %a, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i32* %outer_arr_gep, i32** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %1 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i32 @foo(%__foo_vla* %vla_struct_ptr) - store i32 %call, i32* %b, align 4 + store %__foo_vla %1, ptr %vla_struct_ptr, align 8 + %call = call i32 @foo(ptr %vla_struct_ptr) + store i32 %call, ptr %b, align 4 ret void } - define i32 @foo(%__foo_vla* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %vla = alloca %__foo_vla*, align 8 - store %__foo_vla* %0, %__foo_vla** %vla, align 8 - store i32 0, i32* %foo, align 4 - %deref = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim = getelementptr inbounds %__foo_vla, %__foo_vla* %deref, i32 0, i32 1 - %1 = getelementptr inbounds [2 x i32], [2 x i32]* %dim, i32 0, i32 0 - %2 = load i32, i32* %1, align 4 - store i32 %2, i32* %foo, align 4 - %deref1 = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim2 = getelementptr inbounds %__foo_vla, %__foo_vla* %deref1, i32 0, i32 1 - %3 = getelementptr inbounds [2 x i32], [2 x i32]* %dim2, i32 0, i32 0 - %4 = load i32, i32* %3, align 4 - store i32 %4, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + %vla = alloca ptr, align 8 + store ptr %0, ptr %vla, align 8 + store i32 0, ptr %foo, align 4 + %deref = load ptr, ptr %vla, align 8 + %dim = getelementptr inbounds nuw %__foo_vla, ptr %deref, i32 0, i32 1 + %1 = getelementptr inbounds [2 x i32], ptr %dim, i32 0, i32 0 + %2 = load i32, ptr %1, align 4 + store i32 %2, ptr %foo, align 4 + %deref1 = load ptr, ptr %vla, align 8 + %dim2 = getelementptr inbounds nuw %__foo_vla, ptr %deref1, i32 0, i32 1 + %3 = getelementptr inbounds [2 x i32], ptr %dim2, i32 0, i32 0 + %4 = load i32, ptr %3, align 4 + store i32 %4, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } "#); @@ -606,47 +606,47 @@ fn builtin_function_call_upper_bound() { target triple = "[filtered]" %main = type { [2 x i32], i32 } - %__foo_vla = type { i32*, [2 x i32] } + %__foo_vla = type { ptr, [2 x i32] } @main_instance = global %main zeroinitializer @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %auto_deref = load [2 x i32], [2 x i32]* %a, align 4 - %outer_arr_gep = getelementptr inbounds [2 x i32], [2 x i32]* %a, i32 0, i32 0 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %auto_deref = load [2 x i32], ptr %a, align 4 + %outer_arr_gep = getelementptr inbounds [2 x i32], ptr %a, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i32* %outer_arr_gep, i32** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %1 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i32 @foo(%__foo_vla* %vla_struct_ptr) - store i32 %call, i32* %b, align 4 + store %__foo_vla %1, ptr %vla_struct_ptr, align 8 + %call = call i32 @foo(ptr %vla_struct_ptr) + store i32 %call, ptr %b, align 4 ret void } - define i32 @foo(%__foo_vla* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %vla = alloca %__foo_vla*, align 8 - store %__foo_vla* %0, %__foo_vla** %vla, align 8 - store i32 0, i32* %foo, align 4 - %deref = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim = getelementptr inbounds %__foo_vla, %__foo_vla* %deref, i32 0, i32 1 - %1 = getelementptr inbounds [2 x i32], [2 x i32]* %dim, i32 0, i32 1 - %2 = load i32, i32* %1, align 4 - store i32 %2, i32* %foo, align 4 - %deref1 = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim2 = getelementptr inbounds %__foo_vla, %__foo_vla* %deref1, i32 0, i32 1 - %3 = getelementptr inbounds [2 x i32], [2 x i32]* %dim2, i32 0, i32 1 - %4 = load i32, i32* %3, align 4 - store i32 %4, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + %vla = alloca ptr, align 8 + store ptr %0, ptr %vla, align 8 + store i32 0, ptr %foo, align 4 + %deref = load ptr, ptr %vla, align 8 + %dim = getelementptr inbounds nuw %__foo_vla, ptr %deref, i32 0, i32 1 + %1 = getelementptr inbounds [2 x i32], ptr %dim, i32 0, i32 1 + %2 = load i32, ptr %1, align 4 + store i32 %2, ptr %foo, align 4 + %deref1 = load ptr, ptr %vla, align 8 + %dim2 = getelementptr inbounds nuw %__foo_vla, ptr %deref1, i32 0, i32 1 + %3 = getelementptr inbounds [2 x i32], ptr %dim2, i32 0, i32 1 + %4 = load i32, ptr %3, align 4 + store i32 %4, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } "#); @@ -980,13 +980,13 @@ fn builtin_div_with_named_arguments() { %main = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 - store i32 20, i32* %x, align 4 - store i32 4, i32* %y, align 4 - store i32 0, i32* %main, align 4 - %load_x = load i32, i32* %x, align 4 - %load_y = load i32, i32* %y, align 4 + store i32 20, ptr %x, align 4 + store i32 4, ptr %y, align 4 + store i32 0, ptr %main, align 4 + %load_x = load i32, ptr %x, align 4 + %load_y = load i32, ptr %y, align 4 %tmpVar = sdiv i32 %load_x, %load_y - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } "#); @@ -1017,13 +1017,13 @@ fn builtin_sub_with_named_arguments() { %main = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 - store i32 20, i32* %x, align 4 - store i32 4, i32* %y, align 4 - store i32 0, i32* %main, align 4 - %load_x = load i32, i32* %x, align 4 - %load_y = load i32, i32* %y, align 4 + store i32 20, ptr %x, align 4 + store i32 4, ptr %y, align 4 + store i32 0, ptr %main, align 4 + %load_x = load i32, ptr %x, align 4 + %load_y = load i32, ptr %y, align 4 %tmpVar = sub i32 %load_x, %load_y - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } "#); @@ -1061,23 +1061,23 @@ fn global_namespace_operator() { @foo = global i32 0 @main_instance = global %main zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %foo = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %load_foo = load i32, i32* @foo, align 4 - store i32 %load_foo, i32* %foo, align 4 - %load_foo1 = load i32, i32* @foo, align 4 + %foo = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %load_foo = load i32, ptr @foo, align 4 + store i32 %load_foo, ptr %foo, align 4 + %load_foo1 = load i32, ptr @foo, align 4 %tmpVar = add i32 %load_foo1, 1 - store i32 %tmpVar, i32* %foo, align 4 - %load_foo2 = load i32, i32* @foo, align 4 - %load_foo3 = load i32, i32* @foo, align 4 + store i32 %tmpVar, ptr %foo, align 4 + %load_foo2 = load i32, ptr @foo, align 4 + %load_foo3 = load i32, ptr @foo, align 4 %tmpVar4 = add i32 %load_foo2, %load_foo3 - store i32 %tmpVar4, i32* %foo, align 4 - %load_foo5 = load i32, i32* %foo, align 4 - store i32 %load_foo5, i32* @foo, align 4 - %load_foo6 = load i32, i32* @foo, align 4 + store i32 %tmpVar4, ptr %foo, align 4 + %load_foo5 = load i32, ptr %foo, align 4 + store i32 %load_foo5, ptr @foo, align 4 + %load_foo6 = load i32, ptr @foo, align 4 %tmpVar7 = add i32 %load_foo6, 1 - store i32 %tmpVar7, i32* @foo, align 4 + store i32 %tmpVar7, ptr @foo, align 4 ret void } "#); @@ -1117,19 +1117,19 @@ fn unary_plus_expression_test() { @exp_instance = global %exp zeroinitializer - define void @exp(%exp* %0) { + define void @exp(ptr %0) { entry: - %x = getelementptr inbounds %exp, %exp* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4 - %load_x1 = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %exp, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4 + %load_x1 = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x1, 4 - store i32 %tmpVar, i32* %x, align 4 - store i32 1, i32* %x, align 4 - %load_x2 = load i32, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 + store i32 1, ptr %x, align 4 + %load_x2 = load i32, ptr %x, align 4 %tmpVar3 = sub i32 0, %load_x2 - %load_x4 = load i32, i32* %x, align 4 + %load_x4 = load i32, ptr %x, align 4 %call = call i32 @foo(i32 %load_x4) - store i32 %call, i32* %x, align 4 + store i32 %call, ptr %x, align 4 ret void } @@ -1137,11 +1137,11 @@ fn unary_plus_expression_test() { entry: %foo = alloca i32, align 4 %x = alloca i32, align 4 - store i32 %0, i32* %x, align 4 - store i32 0, i32* %foo, align 4 - %load_x = load i32, i32* %x, align 4 - store i32 %load_x, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %x, align 4 + store i32 0, ptr %foo, align 4 + %load_x = load i32, ptr %x, align 4 + store i32 %load_x, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } "#) diff --git a/src/codegen/tests/fnptr.rs b/src/codegen/tests/fnptr.rs index fd962c8d07e..e97505e932f 100644 --- a/src/codegen/tests/fnptr.rs +++ b/src/codegen/tests/fnptr.rs @@ -31,36 +31,35 @@ fn function_pointer_method_no_parameters() { @__A__init = unnamed_addr constant %A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define void @A__foo(%A* %0) { + define void @A__foo(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } define void @main() { entry: %instanceA = alloca %A, align 8 - %fooPtr = alloca void (%A*)*, align 8 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - store void (%A*)* @A__foo, void (%A*)** %fooPtr, align 8 - %1 = load void (%A*)*, void (%A*)** %fooPtr, align 8 - call void %1(%A* %instanceA) + %fooPtr = alloca ptr, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + store ptr @A__foo, ptr %fooPtr, align 8 + %0 = load ptr, ptr %fooPtr, align 8 + call void %0(ptr %instanceA) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -94,39 +93,38 @@ fn function_pointer_method_with_return_type() { @__A__init = unnamed_addr constant %A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define i32 @A__foo(%A* %0) { + define i32 @A__foo(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %A.foo = alloca i32, align 4 - store i32 0, i32* %A.foo, align 4 - %A__foo_ret = load i32, i32* %A.foo, align 4 + store i32 0, ptr %A.foo, align 4 + %A__foo_ret = load i32, ptr %A.foo, align 4 ret i32 %A__foo_ret } define void @main() { entry: %instanceA = alloca %A, align 8 - %fooPtr = alloca i32 (%A*)*, align 8 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - store i32 (%A*)* @A__foo, i32 (%A*)** %fooPtr, align 8 - %1 = load i32 (%A*)*, i32 (%A*)** %fooPtr, align 8 - %fnptr_call = call i32 %1(%A* %instanceA) + %fooPtr = alloca ptr, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + store ptr @A__foo, ptr %fooPtr, align 8 + %0 = load ptr, ptr %fooPtr, align 8 + %fnptr_call = call i32 %0(ptr %instanceA) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -168,72 +166,67 @@ fn function_pointer_method_with_return_type_aggregate() { @__A__init = unnamed_addr constant %A zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"aaaaa\00" - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define void @A__foo(%A* %0, i8* %1) { + define void @A__foo(ptr %0, ptr %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %foo = alloca i8*, align 8 - store i8* %1, i8** %foo, align 8 - %deref = load i8*, i8** %foo, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %foo = alloca ptr, align 8 + store ptr %1, ptr %foo, align 8 + %deref = load ptr, ptr %foo, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } - define void @A__bar(%A* %0, i32* %1) { + define void @A__bar(ptr %0, ptr %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %bar = alloca i32*, align 8 - store i32* %1, i32** %bar, align 8 - %deref = load i32*, i32** %bar, align 8 - store [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5], i32* %deref, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar = alloca ptr, align 8 + store ptr %1, ptr %bar, align 8 + %deref = load ptr, ptr %bar, align 8 + store [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5], ptr %deref, align 4 ret void } define void @main() { entry: %instanceA = alloca %A, align 8 - %fooPtr = alloca void (%A*, [81 x i8]*)*, align 8 - %barPtr = alloca void (%A*, [5 x i32]*)*, align 8 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - store void (%A*, [81 x i8]*)* bitcast (void (%A*, i8*)* @A__foo to void (%A*, [81 x i8]*)*), void (%A*, [81 x i8]*)** %fooPtr, align 8 - store void (%A*, [5 x i32]*)* bitcast (void (%A*, i32*)* @A__bar to void (%A*, [5 x i32]*)*), void (%A*, [5 x i32]*)** %barPtr, align 8 + %fooPtr = alloca ptr, align 8 + %barPtr = alloca ptr, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + store ptr @A__foo, ptr %fooPtr, align 8 + store ptr @A__bar, ptr %barPtr, align 8 %__0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = load void (%A*, [81 x i8]*)*, void (%A*, [81 x i8]*)** %fooPtr, align 8 - %3 = bitcast [81 x i8]* %__0 to i8* - call void %2(%A* %instanceA, i8* %3) - %load___0 = load [81 x i8], [81 x i8]* %__0, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %__0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + %0 = load ptr, ptr %fooPtr, align 8 + call void %0(ptr %instanceA, ptr %__0) + %load___0 = load [81 x i8], ptr %__0, align 1 %__1 = alloca [5 x i32], align 4 - %4 = bitcast [5 x i32]* %__1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %4, i8 0, i64 ptrtoint ([5 x i32]* getelementptr ([5 x i32], [5 x i32]* null, i32 1) to i64), i1 false) - %5 = load void (%A*, [5 x i32]*)*, void (%A*, [5 x i32]*)** %barPtr, align 8 - %6 = bitcast [5 x i32]* %__1 to i32* - call void %5(%A* %instanceA, i32* %6) - %load___1 = load [5 x i32], [5 x i32]* %__1, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %__1, i8 0, i64 ptrtoint (ptr getelementptr ([5 x i32], ptr null, i32 1) to i64), i1 false) + %1 = load ptr, ptr %barPtr, align 8 + call void %1(ptr %instanceA, ptr %__1) + %load___1 = load [5 x i32], ptr %__1, align 4 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -283,60 +276,55 @@ fn function_pointer_method_with_all_variable_parameter_types() { @__A__init = unnamed_addr constant %A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define i32 @A__foo(%A* %0, i32 %1, [81 x i8]* %2, i32* %3) { + define i32 @A__foo(ptr %0, i32 %1, ptr %2, ptr %3) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %A.foo = alloca i32, align 4 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - %out = alloca [81 x i8]*, align 8 - store [81 x i8]* %2, [81 x i8]** %out, align 8 - %inout = alloca i32*, align 8 - store i32* %3, i32** %inout, align 8 - store i32 0, i32* %A.foo, align 4 - %A__foo_ret = load i32, i32* %A.foo, align 4 + store i32 %1, ptr %in, align 4 + %out = alloca ptr, align 8 + store ptr %2, ptr %out, align 8 + %inout = alloca ptr, align 8 + store ptr %3, ptr %inout, align 8 + store i32 0, ptr %A.foo, align 4 + %A__foo_ret = load i32, ptr %A.foo, align 4 ret i32 %A__foo_ret } define void @main() { entry: %instanceA = alloca %A, align 8 - %fooPtr = alloca i32 (%A*, i32, [81 x i8]*, [5 x i32]*)*, align 8 + %fooPtr = alloca ptr, align 8 %localIn = alloca i32, align 4 %localOut = alloca [81 x i8], align 1 %localInOut = alloca [5 x i32], align 4 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - store i32 (%A*, i32, [81 x i8]*, [5 x i32]*)* bitcast (i32 (%A*, i32, [81 x i8]*, i32*)* @A__foo to i32 (%A*, i32, [81 x i8]*, [5 x i32]*)*), i32 (%A*, i32, [81 x i8]*, [5 x i32]*)** %fooPtr, align 8 - store i32 0, i32* %localIn, align 4 - %1 = bitcast [81 x i8]* %localOut to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [5 x i32]* %localInOut to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([5 x i32]* getelementptr ([5 x i32], [5 x i32]* null, i32 1) to i64), i1 false) - %3 = load i32 (%A*, i32, [81 x i8]*, [5 x i32]*)*, i32 (%A*, i32, [81 x i8]*, [5 x i32]*)** %fooPtr, align 8 - %4 = bitcast [81 x i8]* %localOut to i8* - %5 = bitcast [5 x i32]* %localInOut to i32* - %load_localIn = load i32, i32* %localIn, align 4 - %fnptr_call = call i32 %3(%A* %instanceA, i32 %load_localIn, i8* %4, i32* %5) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + store ptr @A__foo, ptr %fooPtr, align 8 + store i32 0, ptr %localIn, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %localOut, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %localInOut, i8 0, i64 ptrtoint (ptr getelementptr ([5 x i32], ptr null, i32 1) to i64), i1 false) + %0 = load ptr, ptr %fooPtr, align 8 + %load_localIn = load i32, ptr %localIn, align 4 + %fnptr_call = call i32 %0(ptr %instanceA, i32 %load_localIn, ptr %localOut, ptr %localInOut) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -383,51 +371,50 @@ fn function_block_body() { target datalayout = "[filtered]" target triple = "[filtered]" - %A = type { i32, i16, i32, i64* } + %A = type { i32, i16, i32, ptr } @__A__init = unnamed_addr constant %A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %local = getelementptr inbounds %A, %A* %0, i32 0, i32 0 - %in = getelementptr inbounds %A, %A* %0, i32 0, i32 1 - %out = getelementptr inbounds %A, %A* %0, i32 0, i32 2 - %inout = getelementptr inbounds %A, %A* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %local = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 + %in = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 1 + %out = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 2 + %inout = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 3 ret void } define void @main() { entry: %instanceA = alloca %A, align 8 - %bodyPtr = alloca void (%A*)*, align 8 + %bodyPtr = alloca ptr, align 8 %localIn = alloca i16, align 2 %localOut = alloca i32, align 4 %localInout = alloca i64, align 8 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - store void (%A*)* @A, void (%A*)** %bodyPtr, align 8 - store i16 0, i16* %localIn, align 2 - store i32 0, i32* %localOut, align 4 - store i64 0, i64* %localInout, align 8 - %1 = load void (%A*)*, void (%A*)** %bodyPtr, align 8 - %2 = getelementptr inbounds %A, %A* %instanceA, i32 0, i32 1 - %load_localIn = load i16, i16* %localIn, align 2 - store i16 %load_localIn, i16* %2, align 2 - %3 = getelementptr inbounds %A, %A* %instanceA, i32 0, i32 3 - store i64* %localInout, i64** %3, align 8 - call void %1(%A* %instanceA) - %4 = getelementptr inbounds %A, %A* %instanceA, i32 0, i32 2 - %5 = load i32, i32* %4, align 4 - store i32 %5, i32* %localOut, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + store ptr @A, ptr %bodyPtr, align 8 + store i16 0, ptr %localIn, align 2 + store i32 0, ptr %localOut, align 4 + store i64 0, ptr %localInout, align 8 + %0 = load ptr, ptr %bodyPtr, align 8 + %1 = getelementptr inbounds nuw %A, ptr %instanceA, i32 0, i32 1 + %load_localIn = load i16, ptr %localIn, align 2 + store i16 %load_localIn, ptr %1, align 2 + %2 = getelementptr inbounds nuw %A, ptr %instanceA, i32 0, i32 3 + store ptr %localInout, ptr %2, align 8 + call void %0(ptr %instanceA) + %3 = getelementptr inbounds nuw %A, ptr %instanceA, i32 0, i32 2 + %4 = load i32, ptr %3, align 4 + store i32 %4, ptr %localOut, align 4 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -458,19 +445,19 @@ fn regular_pointers_to_function_blocks_are_called_directly() { @__A__init = unnamed_addr constant %A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } define void @main() { entry: - %fooPtr = alloca %A*, align 8 - store %A* null, %A** %fooPtr, align 8 - %deref = load %A*, %A** %fooPtr, align 8 - call void @A(%A* %deref) + %fooPtr = alloca ptr, align 8 + store ptr null, ptr %fooPtr, align 8 + %deref = load ptr, ptr %fooPtr, align 8 + call void @A(ptr %deref) ret void } "#); diff --git a/src/codegen/tests/initialization_test/complex_initializers.rs b/src/codegen/tests/initialization_test/complex_initializers.rs index e77d1a97077..3edc9dd3ad7 100644 --- a/src/codegen/tests/initialization_test/complex_initializers.rs +++ b/src/codegen/tests/initialization_test/complex_initializers.rs @@ -23,13 +23,13 @@ fn simple_global() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @s = global [81 x i8] c"hello world!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - @ps = global [81 x i8]* null + @ps = global ptr null define void @__init___Test() { entry: - store [81 x i8]* @s, [81 x i8]** @ps, align 8 + store ptr @s, ptr @ps, align 8 ret void } "#); @@ -56,13 +56,13 @@ fn global_alias() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @s = global [81 x i8] c"hello world!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - @ps = global [81 x i8]* null + @ps = global ptr null define void @__init___Test() { entry: - store [81 x i8]* @s, [81 x i8]** @ps, align 8 + store ptr @s, ptr @ps, align 8 ret void } "#); @@ -89,13 +89,13 @@ fn global_reference_to() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @s = global [81 x i8] c"hello world!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - @ps = global [81 x i8]* null + @ps = global ptr null define void @__init___Test() { entry: - store [81 x i8]* @s, [81 x i8]** @ps, align 8 + store ptr @s, ptr @ps, align 8 ret void } "#); @@ -127,39 +127,39 @@ fn init_functions_generated_for_programs() { target datalayout = "[filtered]" target triple = "[filtered]" - %PLC_PRG = type { [81 x i8]* } + %PLC_PRG = type { ptr } @s = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @PLC_PRG_instance = global %PLC_PRG zeroinitializer - define void @PLC_PRG(%PLC_PRG* %0) { + define void @PLC_PRG(ptr %0) { entry: - %to_init = getelementptr inbounds %PLC_PRG, %PLC_PRG* %0, i32 0, i32 0 + %to_init = getelementptr inbounds nuw %PLC_PRG, ptr %0, i32 0, i32 0 ret void } - define void @__init_plc_prg(%PLC_PRG* %0) { + define void @__init_plc_prg(ptr %0) { entry: - %self = alloca %PLC_PRG*, align 8 - store %PLC_PRG* %0, %PLC_PRG** %self, align 8 - %deref = load %PLC_PRG*, %PLC_PRG** %self, align 8 - %to_init = getelementptr inbounds %PLC_PRG, %PLC_PRG* %deref, i32 0, i32 0 - store [81 x i8]* @s, [81 x i8]** %to_init, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %to_init = getelementptr inbounds nuw %PLC_PRG, ptr %deref, i32 0, i32 0 + store ptr @s, ptr %to_init, align 8 ret void } - define void @__user_init_PLC_PRG(%PLC_PRG* %0) { + define void @__user_init_PLC_PRG(ptr %0) { entry: - %self = alloca %PLC_PRG*, align 8 - store %PLC_PRG* %0, %PLC_PRG** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_plc_prg(%PLC_PRG* @PLC_PRG_instance) - call void @__user_init_PLC_PRG(%PLC_PRG* @PLC_PRG_instance) + call void @__init_plc_prg(ptr @PLC_PRG_instance) + call void @__user_init_PLC_PRG(ptr @PLC_PRG_instance) ret void } "#); @@ -275,65 +275,65 @@ fn init_functions_generated_for_function_blocks() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, [81 x i8]* } + %__vtable_foo = type { ptr } + %foo = type { ptr, ptr } @s = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %to_init = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %to_init = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %to_init = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 1 - store [81 x i8]* @s, [81 x i8]** %to_init, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %to_init = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 1 + store ptr @s, ptr %to_init, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -410,17 +410,17 @@ fn nested_initializer_pous() { target datalayout = "[filtered]" target triple = "[filtered]" - %mainProg = type { [81 x i8]*, %foo } - %foo = type { i32*, [81 x i8]*, %bar } - %bar = type { i32*, %baz } - %baz = type { i32*, [81 x i8]* } - %__vtable_baz = type { void (%baz*)* } - %__vtable_bar = type { void (%bar*)* } - %__vtable_foo = type { void (%foo*)* } - %sideProg = type { [81 x i8]*, %foo } + %mainProg = type { ptr, %foo } + %foo = type { ptr, ptr, %bar } + %bar = type { ptr, %baz } + %baz = type { ptr, ptr } + %__vtable_baz = type { ptr } + %__vtable_bar = type { ptr } + %__vtable_foo = type { ptr } + %sideProg = type { ptr, %foo } @str = global [81 x i8] c"hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @mainProg_instance = global %mainProg zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__bar__init = unnamed_addr constant %bar zeroinitializer @@ -433,259 +433,259 @@ fn nested_initializer_pous() { @__vtable_bar_instance = global %__vtable_bar zeroinitializer @__vtable_baz_instance = global %__vtable_baz zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %str_ref = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %b = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - call void @bar__print(%bar* %b) - call void @bar(%bar* %b) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %str_ref = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + call void @bar__print(ptr %b) + call void @bar(ptr %b) ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - %b = getelementptr inbounds %bar, %bar* %0, i32 0, i32 1 - call void @baz__print(%baz* %b) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 1 + call void @baz__print(ptr %b) ret void } - define void @baz(%baz* %0) { + define void @baz(ptr %0) { entry: - %this = alloca %baz*, align 8 - store %baz* %0, %baz** %this, align 8 - %__vtable = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 - %str_ref = getelementptr inbounds %baz, %baz* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 + %str_ref = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 1 ret void } - define void @mainProg(%mainProg* %0) { + define void @mainProg(ptr %0) { entry: - %other_ref_to_global = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 0 - %f = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 1 + %other_ref_to_global = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 0 + %f = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 1 ret void } - define void @sideProg(%sideProg* %0) { + define void @sideProg(ptr %0) { entry: - %other_ref_to_global = getelementptr inbounds %sideProg, %sideProg* %0, i32 0, i32 0 - %f = getelementptr inbounds %sideProg, %sideProg* %0, i32 0, i32 1 - call void @foo(%foo* %f) - call void @foo__print(%foo* %f) + %other_ref_to_global = getelementptr inbounds nuw %sideProg, ptr %0, i32 0, i32 0 + %f = getelementptr inbounds nuw %sideProg, ptr %0, i32 0, i32 1 + call void @foo(ptr %f) + call void @foo__print(ptr %f) ret void } - define void @bar__print(%bar* %0) { + define void @bar__print(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - %b = getelementptr inbounds %bar, %bar* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 1 ret void } - define void @foo__print(%foo* %0) { + define void @foo__print(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %str_ref = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %b = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %str_ref = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @baz__print(%baz* %0) { + define void @baz__print(ptr %0) { entry: - %this = alloca %baz*, align 8 - store %baz* %0, %baz** %this, align 8 - %__vtable = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 - %str_ref = getelementptr inbounds %baz, %baz* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 + %str_ref = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 1 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 ret void } - define void @__init___vtable_baz(%__vtable_baz* %0) { + define void @__init___vtable_baz(ptr %0) { entry: - %self = alloca %__vtable_baz*, align 8 - store %__vtable_baz* %0, %__vtable_baz** %self, align 8 - %deref = load %__vtable_baz*, %__vtable_baz** %self, align 8 - %__body = getelementptr inbounds %__vtable_baz, %__vtable_baz* %deref, i32 0, i32 0 - store void (%baz*)* @baz, void (%baz*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @baz, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %b = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 2 - call void @__init_bar(%bar* %b) - %deref1 = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref2 = load %foo*, %foo** %self, align 8 - %str_ref = getelementptr inbounds %foo, %foo* %deref2, i32 0, i32 1 - store [81 x i8]* @str, [81 x i8]** %str_ref, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 2 + call void @__init_bar(ptr %b) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref2 = load ptr, ptr %self, align 8 + %str_ref = getelementptr inbounds nuw %foo, ptr %deref2, i32 0, i32 1 + store ptr @str, ptr %str_ref, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %b = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 1 - call void @__init_baz(%baz* %b) - %deref1 = load %bar*, %bar** %self, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 1 + call void @__init_baz(ptr %b) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__init_baz(%baz* %0) { + define void @__init_baz(ptr %0) { entry: - %self = alloca %baz*, align 8 - store %baz* %0, %baz** %self, align 8 - %deref = load %baz*, %baz** %self, align 8 - %__vtable = getelementptr inbounds %baz, %baz* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_baz* @__vtable_baz_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %baz*, %baz** %self, align 8 - %str_ref = getelementptr inbounds %baz, %baz* %deref1, i32 0, i32 1 - store [81 x i8]* @str, [81 x i8]** %str_ref, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %baz, ptr %deref, i32 0, i32 0 + store ptr @__vtable_baz_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %str_ref = getelementptr inbounds nuw %baz, ptr %deref1, i32 0, i32 1 + store ptr @str, ptr %str_ref, align 8 ret void } - define void @__init_mainprog(%mainProg* %0) { + define void @__init_mainprog(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 - %deref = load %mainProg*, %mainProg** %self, align 8 - %f = getelementptr inbounds %mainProg, %mainProg* %deref, i32 0, i32 1 - call void @__init_foo(%foo* %f) - %deref1 = load %mainProg*, %mainProg** %self, align 8 - %other_ref_to_global = getelementptr inbounds %mainProg, %mainProg* %deref1, i32 0, i32 0 - store [81 x i8]* @str, [81 x i8]** %other_ref_to_global, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %mainProg, ptr %deref, i32 0, i32 1 + call void @__init_foo(ptr %f) + %deref1 = load ptr, ptr %self, align 8 + %other_ref_to_global = getelementptr inbounds nuw %mainProg, ptr %deref1, i32 0, i32 0 + store ptr @str, ptr %other_ref_to_global, align 8 ret void } - define void @__init_sideprog(%sideProg* %0) { + define void @__init_sideprog(ptr %0) { entry: - %self = alloca %sideProg*, align 8 - store %sideProg* %0, %sideProg** %self, align 8 - %deref = load %sideProg*, %sideProg** %self, align 8 - %f = getelementptr inbounds %sideProg, %sideProg* %deref, i32 0, i32 1 - call void @__init_foo(%foo* %f) - %deref1 = load %sideProg*, %sideProg** %self, align 8 - %other_ref_to_global = getelementptr inbounds %sideProg, %sideProg* %deref1, i32 0, i32 0 - store [81 x i8]* @str, [81 x i8]** %other_ref_to_global, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %mainProg, ptr %deref, i32 0, i32 1 + call void @__init_foo(ptr %f) + %deref1 = load ptr, ptr %self, align 8 + %other_ref_to_global = getelementptr inbounds nuw %mainProg, ptr %deref1, i32 0, i32 0 + store ptr @str, ptr %other_ref_to_global, align 8 ret void } - define void @__user_init___vtable_baz(%__vtable_baz* %0) { + define void @__user_init___vtable_baz(ptr %0) { entry: - %self = alloca %__vtable_baz*, align 8 - store %__vtable_baz* %0, %__vtable_baz** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %b = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 1 - call void @__user_init_baz(%baz* %b) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 1 + call void @__user_init_baz(ptr %b) ret void } - define void @__user_init_baz(%baz* %0) { + define void @__user_init_baz(ptr %0) { entry: - %self = alloca %baz*, align 8 - store %baz* %0, %baz** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_sideProg(%sideProg* %0) { + define void @__user_init_sideProg(ptr %0) { entry: - %self = alloca %sideProg*, align 8 - store %sideProg* %0, %sideProg** %self, align 8 - %deref = load %sideProg*, %sideProg** %self, align 8 - %f = getelementptr inbounds %sideProg, %sideProg* %deref, i32 0, i32 1 - call void @__user_init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %mainProg, ptr %deref, i32 0, i32 1 + call void @__user_init_foo(ptr %f) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %b = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 2 - call void @__user_init_bar(%bar* %b) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 2 + call void @__user_init_bar(ptr %b) ret void } - define void @__user_init_mainProg(%mainProg* %0) { + define void @__user_init_mainProg(ptr %0) { entry: - %self = alloca %mainProg*, align 8 - store %mainProg* %0, %mainProg** %self, align 8 - %deref = load %mainProg*, %mainProg** %self, align 8 - %f = getelementptr inbounds %mainProg, %mainProg* %deref, i32 0, i32 1 - call void @__user_init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %mainProg, ptr %deref, i32 0, i32 1 + call void @__user_init_foo(ptr %f) ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_mainprog(%mainProg* @mainProg_instance) - call void @__init_sideprog(%sideProg* @sideProg_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__init___vtable_baz(%__vtable_baz* @__vtable_baz_instance) - call void @__user_init_mainProg(%mainProg* @mainProg_instance) - call void @__user_init_sideProg(%sideProg* @sideProg_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_baz(%__vtable_baz* @__vtable_baz_instance) + call void @__init_mainprog(ptr @mainProg_instance) + call void @__init_sideprog(ptr @sideProg_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__init___vtable_baz(ptr @__vtable_baz_instance) + call void @__user_init_mainProg(ptr @mainProg_instance) + call void @__user_init_sideProg(ptr @sideProg_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_baz(ptr @__vtable_baz_instance) ret void } "#); @@ -714,67 +714,67 @@ fn local_address() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, i16, i16* } + %__vtable_foo = type { ptr } + %foo = type { ptr, i16, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %i = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %pi = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %i = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %pi = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %pi = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 2 - %deref2 = load %foo*, %foo** %self, align 8 - %i = getelementptr inbounds %foo, %foo* %deref2, i32 0, i32 1 - store i16* %i, i16** %pi, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %pi = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 2 + %deref2 = load ptr, ptr %self, align 8 + %i = getelementptr inbounds nuw %foo, ptr %deref2, i32 0, i32 1 + store ptr %i, ptr %pi, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -813,96 +813,95 @@ fn user_init_called_for_variables_on_stack() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32*, i16, i16* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr, i16, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %i = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %pi = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %i = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %pi = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @foo__FB_INIT(%foo* %0) { + define void @foo__FB_INIT(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %i = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %pi = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - store i16* %i, i16** %pi, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %i = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %pi = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + store ptr %i, ptr %pi, align 8 ret void } define void @main() { entry: %fb = alloca %foo, align 8 - %0 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - call void @__init_foo(%foo* %fb) - call void @__user_init_foo(%foo* %fb) - call void @foo(%foo* %fb) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + call void @__init_foo(ptr %fb) + call void @__user_init_foo(ptr %fb) + call void @foo(ptr %fb) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %FB_INIT = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__FB_INIT, void (%foo*)** %FB_INIT, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %FB_INIT = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__FB_INIT, ptr %FB_INIT, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - call void @foo__FB_INIT(%foo* %deref) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + call void @foo__FB_INIT(ptr %deref) ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1009,74 +1008,74 @@ fn struct_types() { ) .unwrap(); - filtered_assert_snapshot!(res, @r###" + filtered_assert_snapshot!(res, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" %prog = type { %myStruct } - %myStruct = type { [81 x i8]*, [2 x [81 x i8]]* } + %myStruct = type { ptr, ptr } @s = global [81 x i8] c"Hello world!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" @s2 = global [2 x [81 x i8]] [[81 x i8] c"hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [81 x i8] c"world\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"] - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %str = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %str = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 - %deref = load %myStruct*, %myStruct** %self, align 8 - %member = getelementptr inbounds %myStruct, %myStruct* %deref, i32 0, i32 0 - store [81 x i8]* @s, [81 x i8]** %member, align 8 - %deref1 = load %myStruct*, %myStruct** %self, align 8 - %member2 = getelementptr inbounds %myStruct, %myStruct* %deref1, i32 0, i32 1 - store [2 x [81 x i8]]* @s2, [2 x [81 x i8]]** %member2, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %member = getelementptr inbounds nuw %myStruct, ptr %deref, i32 0, i32 0 + store ptr @s, ptr %member, align 8 + %deref1 = load ptr, ptr %self, align 8 + %member2 = getelementptr inbounds nuw %myStruct, ptr %deref1, i32 0, i32 1 + store ptr @s2, ptr %member2, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %str = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__init_mystruct(%myStruct* %str) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %str = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__init_mystruct(ptr %str) ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %str = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_myStruct(%myStruct* %str) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %str = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_myStruct(ptr %str) ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__user_init_prog(%prog* @prog_instance) + call void @__init_prog(ptr @prog_instance) + call void @__user_init_prog(ptr @prog_instance) ret void } - "###); + "#); } #[test] @@ -1121,13 +1120,13 @@ fn stateful_pous_methods_and_structs_get_init_functions() { %myStruct = type { i32 } %prog = type {} - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } - %__vtable_cl = type { void (%cl*)* } - %cl = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } + %__vtable_cl = type { ptr } + %cl = type { ptr } @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @@ -1136,147 +1135,147 @@ fn stateful_pous_methods_and_structs_get_init_functions() { @__cl__init = unnamed_addr constant %cl zeroinitializer @__vtable_cl_instance = global %__vtable_cl zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__m(%foo* %0) { + define void @foo__m(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @cl__m(%cl* %0) { + define void @cl__m(ptr %0) { entry: - %__vtable = getelementptr inbounds %cl, %cl* %0, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %cl, ptr %0, i32 0, i32 0 ret void } - define void @cl(%cl* %0) { + define void @cl(ptr %0) { entry: - %__vtable = getelementptr inbounds %cl, %cl* %0, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %cl, ptr %0, i32 0, i32 0 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: ret void } - define void @foo__act(%foo* %0) { + define void @foo__act(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %m = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__m, void (%foo*)** %m, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %m = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__m, ptr %m, align 8 ret void } - define void @__init___vtable_cl(%__vtable_cl* %0) { + define void @__init___vtable_cl(ptr %0) { entry: - %self = alloca %__vtable_cl*, align 8 - store %__vtable_cl* %0, %__vtable_cl** %self, align 8 - %deref = load %__vtable_cl*, %__vtable_cl** %self, align 8 - %m = getelementptr inbounds %__vtable_cl, %__vtable_cl* %deref, i32 0, i32 0 - store void (%cl*)* @cl__m, void (%cl*)** %m, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %m = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @cl__m, ptr %m, align 8 ret void } - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_cl(%cl* %0) { + define void @__init_cl(ptr %0) { entry: - %self = alloca %cl*, align 8 - store %cl* %0, %cl** %self, align 8 - %deref = load %cl*, %cl** %self, align 8 - %__vtable = getelementptr inbounds %cl, %cl* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_cl* @__vtable_cl_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_cl_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_cl(%__vtable_cl* %0) { + define void @__user_init___vtable_cl(ptr %0) { entry: - %self = alloca %__vtable_cl*, align 8 - store %__vtable_cl* %0, %__vtable_cl** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_cl(%__vtable_cl* @__vtable_cl_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_cl(%__vtable_cl* @__vtable_cl_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_cl(ptr @__vtable_cl_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_cl(ptr @__vtable_cl_instance) ret void } "#); @@ -1314,91 +1313,91 @@ fn global_instance() { target triple = "[filtered]" %prog = type {} - %foo = type { i32*, [81 x i8]* } - %__vtable_foo = type { void (%foo*)* } + %foo = type { ptr, ptr } + %__vtable_foo = type { ptr } @ps = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @fb = global %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - call void @foo(%foo* @fb) + call void @foo(ptr @fb) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %s = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 1 - store [81 x i8]* @ps, [81 x i8]** %s, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 1 + store ptr @ps, ptr %s, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init_foo(%foo* @fb) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init_foo(%foo* @fb) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init_foo(ptr @fb) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init_foo(ptr @fb) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -1441,98 +1440,98 @@ fn aliased_types() { target triple = "[filtered]" %prog = type { %foo } - %foo = type { i32*, [81 x i8]* } - %__vtable_foo = type { void (%foo*)* } + %foo = type { ptr, ptr } + %__vtable_foo = type { ptr } @ps = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @global_alias = global %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %fb = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - call void @foo(%foo* %fb) + %fb = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + call void @foo(ptr %fb) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %s = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 1 - store [81 x i8]* @ps, [81 x i8]** %s, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 1 + store ptr @ps, ptr %s, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %fb = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %fb) ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %fb = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %fb) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init_foo(%foo* @global_alias) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init_foo(%foo* @global_alias) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init_foo(ptr @global_alias) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init_foo(ptr @global_alias) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -1640,10 +1639,10 @@ fn var_config_aliased_variables_initialized() { target triple = "[filtered]" %prog = type { %FB, %FB } - %FB = type { i32*, i32* } - %__vtable_FB = type { void (%FB*)* } + %FB = type { ptr, ptr } + %__vtable_FB = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__FB__init = unnamed_addr constant %FB zeroinitializer @____vtable_FB__init = unnamed_addr constant %__vtable_FB zeroinitializer @@ -1651,96 +1650,96 @@ fn var_config_aliased_variables_initialized() { @__PI_1_2_1 = global i32 0 @__PI_1_2_2 = global i32 0 - define void @FB(%FB* %0) { + define void @FB(ptr %0) { entry: - %this = alloca %FB*, align 8 - store %FB* %0, %FB** %this, align 8 - %__vtable = getelementptr inbounds %FB, %FB* %0, i32 0, i32 0 - %foo = getelementptr inbounds %FB, %FB* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 0 + %foo = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 1 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %instance1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %instance2 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 + %instance1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %instance2 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 ret void } - define void @__init___vtable_fb(%__vtable_FB* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_FB*, align 8 - store %__vtable_FB* %0, %__vtable_FB** %self, align 8 - %deref = load %__vtable_FB*, %__vtable_FB** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB, %__vtable_FB* %deref, i32 0, i32 0 - store void (%FB*)* @FB, void (%FB*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB, ptr %deref, i32 0, i32 0 + store ptr @FB, ptr %__body, align 8 ret void } - define void @__init_fb(%FB* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %FB*, align 8 - store %FB* %0, %FB** %self, align 8 - %deref = load %FB*, %FB** %self, align 8 - %__vtable = getelementptr inbounds %FB, %FB* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB* @__vtable_FB_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_instance, ptr %__vtable, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %instance1 = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__init_fb(%FB* %instance1) - %deref1 = load %prog*, %prog** %self, align 8 - %instance2 = getelementptr inbounds %prog, %prog* %deref1, i32 0, i32 1 - call void @__init_fb(%FB* %instance2) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %instance1 = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__init_fb(ptr %instance1) + %deref1 = load ptr, ptr %self, align 8 + %instance2 = getelementptr inbounds nuw %prog, ptr %deref1, i32 0, i32 1 + call void @__init_fb(ptr %instance2) ret void } - define void @__user_init_FB(%FB* %0) { + define void @__user_init_FB(ptr %0) { entry: - %self = alloca %FB*, align 8 - store %FB* %0, %FB** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB(%__vtable_FB* %0) { + define void @__user_init___vtable_FB(ptr %0) { entry: - %self = alloca %__vtable_FB*, align 8 - store %__vtable_FB* %0, %__vtable_FB** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %instance1 = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_FB(%FB* %instance1) - %deref1 = load %prog*, %prog** %self, align 8 - %instance2 = getelementptr inbounds %prog, %prog* %deref1, i32 0, i32 1 - call void @__user_init_FB(%FB* %instance2) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %instance1 = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_FB(ptr %instance1) + %deref1 = load ptr, ptr %self, align 8 + %instance2 = getelementptr inbounds nuw %prog, ptr %deref1, i32 0, i32 1 + call void @__user_init_FB(ptr %instance2) ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init___vtable_fb(%__vtable_FB* @__vtable_FB_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init___vtable_fb(ptr @__vtable_FB_instance) call void @__init___var_config() - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init___vtable_FB(%__vtable_FB* @__vtable_FB_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init___vtable_FB(ptr @__vtable_FB_instance) ret void } define void @__init___var_config() { entry: - store i32* @__PI_1_2_1, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0, i32 1), align 8 - store i32* @__PI_1_2_2, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1, i32 1), align 8 + store ptr @__PI_1_2_1, ptr getelementptr inbounds nuw (%FB, ptr @prog_instance, i32 0, i32 1), align 8 + store ptr @__PI_1_2_2, ptr getelementptr inbounds nuw (%FB, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), i32 0, i32 1), align 8 ret void } "#); @@ -1778,21 +1777,21 @@ fn var_external_blocks_are_ignored_in_init_functions() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr } + %foo = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @s = global [81 x i8] zeroinitializer - @refString = global [81 x i8]* null + @refString = global ptr null - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } @@ -1801,45 +1800,45 @@ fn var_external_blocks_are_ignored_in_init_functions() { ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - store [81 x i8]* @s, [81 x i8]** @refString, align 8 - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + store ptr @s, ptr @refString, align 8 + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#) @@ -1869,79 +1868,79 @@ fn ref_to_local_member() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, [81 x i8], [81 x i8]*, [81 x i8]*, [81 x i8]* } + %__vtable_foo = type { ptr } + %foo = type { ptr, [81 x i8], ptr, ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %ptr = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - %alias = getelementptr inbounds %foo, %foo* %0, i32 0, i32 3 - %reference_to = getelementptr inbounds %foo, %foo* %0, i32 0, i32 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %ptr = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + %alias = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 3 + %reference_to = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 4 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %ptr = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 2 - %deref2 = load %foo*, %foo** %self, align 8 - %s = getelementptr inbounds %foo, %foo* %deref2, i32 0, i32 1 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - %deref3 = load %foo*, %foo** %self, align 8 - %alias = getelementptr inbounds %foo, %foo* %deref3, i32 0, i32 3 - %deref4 = load %foo*, %foo** %self, align 8 - %s5 = getelementptr inbounds %foo, %foo* %deref4, i32 0, i32 1 - store [81 x i8]* %s5, [81 x i8]** %alias, align 8 - %deref6 = load %foo*, %foo** %self, align 8 - %reference_to = getelementptr inbounds %foo, %foo* %deref6, i32 0, i32 4 - %deref7 = load %foo*, %foo** %self, align 8 - %s8 = getelementptr inbounds %foo, %foo* %deref7, i32 0, i32 1 - store [81 x i8]* %s8, [81 x i8]** %reference_to, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %ptr = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 2 + %deref2 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %foo, ptr %deref2, i32 0, i32 1 + store ptr %s, ptr %ptr, align 8 + %deref3 = load ptr, ptr %self, align 8 + %alias = getelementptr inbounds nuw %foo, ptr %deref3, i32 0, i32 3 + %deref4 = load ptr, ptr %self, align 8 + %s5 = getelementptr inbounds nuw %foo, ptr %deref4, i32 0, i32 1 + store ptr %s5, ptr %alias, align 8 + %deref6 = load ptr, ptr %self, align 8 + %reference_to = getelementptr inbounds nuw %foo, ptr %deref6, i32 0, i32 4 + %deref7 = load ptr, ptr %self, align 8 + %s8 = getelementptr inbounds nuw %foo, ptr %deref7, i32 0, i32 1 + store ptr %s8, ptr %reference_to, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#) @@ -1975,80 +1974,80 @@ fn ref_to_local_member_shadows_global() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, [81 x i8], [81 x i8]*, [81 x i8]*, [81 x i8]* } + %__vtable_foo = type { ptr } + %foo = type { ptr, [81 x i8], ptr, ptr, ptr } @s = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %ptr = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - %alias = getelementptr inbounds %foo, %foo* %0, i32 0, i32 3 - %reference_to = getelementptr inbounds %foo, %foo* %0, i32 0, i32 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %ptr = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + %alias = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 3 + %reference_to = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 4 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %ptr = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 2 - %deref2 = load %foo*, %foo** %self, align 8 - %s = getelementptr inbounds %foo, %foo* %deref2, i32 0, i32 1 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - %deref3 = load %foo*, %foo** %self, align 8 - %alias = getelementptr inbounds %foo, %foo* %deref3, i32 0, i32 3 - %deref4 = load %foo*, %foo** %self, align 8 - %s5 = getelementptr inbounds %foo, %foo* %deref4, i32 0, i32 1 - store [81 x i8]* %s5, [81 x i8]** %alias, align 8 - %deref6 = load %foo*, %foo** %self, align 8 - %reference_to = getelementptr inbounds %foo, %foo* %deref6, i32 0, i32 4 - %deref7 = load %foo*, %foo** %self, align 8 - %s8 = getelementptr inbounds %foo, %foo* %deref7, i32 0, i32 1 - store [81 x i8]* %s8, [81 x i8]** %reference_to, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %ptr = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 2 + %deref2 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %foo, ptr %deref2, i32 0, i32 1 + store ptr %s, ptr %ptr, align 8 + %deref3 = load ptr, ptr %self, align 8 + %alias = getelementptr inbounds nuw %foo, ptr %deref3, i32 0, i32 3 + %deref4 = load ptr, ptr %self, align 8 + %s5 = getelementptr inbounds nuw %foo, ptr %deref4, i32 0, i32 1 + store ptr %s5, ptr %alias, align 8 + %deref6 = load ptr, ptr %self, align 8 + %reference_to = getelementptr inbounds nuw %foo, ptr %deref6, i32 0, i32 4 + %deref7 = load ptr, ptr %self, align 8 + %s8 = getelementptr inbounds nuw %foo, ptr %deref7, i32 0, i32 1 + store ptr %s8, ptr %reference_to, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#) @@ -2080,70 +2079,70 @@ fn temporary_variable_ref_to_local_member() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, [81 x i8] } + %__vtable_foo = type { ptr } + %foo = type { ptr, [81 x i8] } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %ptr = alloca [81 x i8]*, align 8 - %alias = alloca [81 x i8]*, align 8 - %reference_to = alloca [81 x i8]*, align 8 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - store [81 x i8]* null, [81 x i8]** %alias, align 8 - store [81 x i8]* null, [81 x i8]** %reference_to, align 8 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - store [81 x i8]* %s, [81 x i8]** %alias, align 8 - store [81 x i8]* %s, [81 x i8]** %reference_to, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %ptr = alloca ptr, align 8 + %alias = alloca ptr, align 8 + %reference_to = alloca ptr, align 8 + store ptr %s, ptr %ptr, align 8 + store ptr null, ptr %alias, align 8 + store ptr null, ptr %reference_to, align 8 + store ptr %s, ptr %ptr, align 8 + store ptr %s, ptr %alias, align 8 + store ptr %s, ptr %reference_to, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#) @@ -2175,35 +2174,34 @@ fn temporary_variable_ref_to_temporary_variable() { target datalayout = "[filtered]" target triple = "[filtered]" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] define void @foo() { entry: - %ptr = alloca [81 x i8]*, align 8 - %alias = alloca [81 x i8]*, align 8 + %ptr = alloca ptr, align 8 + %alias = alloca ptr, align 8 %s = alloca [81 x i8], align 1 - %reference_to = alloca [81 x i8]*, align 8 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - store [81 x i8]* null, [81 x i8]** %alias, align 8 - %0 = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store [81 x i8]* null, [81 x i8]** %reference_to, align 8 - store [81 x i8]* %s, [81 x i8]** %ptr, align 8 - store [81 x i8]* %s, [81 x i8]** %alias, align 8 - %deref = load [81 x i8]*, [81 x i8]** %alias, align 8 - store [81 x i8]* %deref, [81 x i8]** %reference_to, align 8 + %reference_to = alloca ptr, align 8 + store ptr %s, ptr %ptr, align 8 + store ptr null, ptr %alias, align 8 + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store ptr null, ptr %reference_to, align 8 + store ptr %s, ptr %ptr, align 8 + store ptr %s, ptr %alias, align 8 + %deref = load ptr, ptr %alias, align 8 + store ptr %deref, ptr %reference_to, align 8 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 define void @__init___Test() { entry: ret void } - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#) } @@ -2231,76 +2229,76 @@ fn initializing_method_variables_with_refs() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %x = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 10, i32* %x, align 4 - store i32* %x, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 10, ptr %x, align 4 + store ptr %x, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2333,76 +2331,76 @@ fn initializing_method_variables_with_refs_referencing_parent_pou_variable() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32*, i32 } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr, i32 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer - @__foo__init = unnamed_addr constant %foo { i32* null, i32 5 } + @__foo__init = unnamed_addr constant %foo { ptr null, i32 5 } @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %px = alloca i32*, align 8 - store i32* %x, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %px = alloca ptr, align 8 + store ptr %x, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2435,75 +2433,75 @@ fn initializing_method_variables_with_refs_referencing_global_variable() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } @x = global i32 0 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %px = alloca i32*, align 8 - store i32* @x, i32** %px, align 8 - store i32* @x, i32** %px, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %px = alloca ptr, align 8 + store ptr @x, ptr %px, align 8 + store ptr @x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2537,77 +2535,77 @@ fn initializing_method_variables_with_refs_shadowing() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } @x = global i32 0 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %x = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 0, i32* %x, align 4 - store i32* %x, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 0, ptr %x, align 4 + store ptr %x, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2637,76 +2635,76 @@ fn initializing_method_variables_with_alias() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %x = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 0, i32* %x, align 4 - store i32* null, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 0, ptr %x, align 4 + store ptr null, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2736,76 +2734,76 @@ fn initializing_method_variables_with_reference_to() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %x = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 0, i32* %x, align 4 - store i32* null, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 0, ptr %x, align 4 + store ptr null, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -2842,12 +2840,12 @@ fn methods_call_init_functions_for_their_members() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, i32, i32* } - %__vtable_bar = type { void (%bar*)*, void (%bar*)* } - %bar = type { i32* } + %__vtable_foo = type { ptr } + %foo = type { ptr, i32, ptr } + %__vtable_bar = type { ptr, ptr } + %bar = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -2855,126 +2853,125 @@ fn methods_call_init_functions_for_their_members() { @__bar__init = unnamed_addr constant %bar zeroinitializer @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 ret void } - define void @bar__baz(%bar* %0) { + define void @bar__baz(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 %fb = alloca %foo, align 8 - %1 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - call void @__init_foo(%foo* %fb) - call void @__user_init_foo(%foo* %fb) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + call void @__init_foo(ptr %fb) + call void @__user_init_foo(ptr %fb) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 - %deref1 = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %baz = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref1, i32 0, i32 1 - store void (%bar*)* @bar__baz, void (%bar*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_bar, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_bar, ptr %deref1, i32 0, i32 1 + store ptr @bar__baz, ptr %baz, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %y = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 2 - %deref2 = load %foo*, %foo** %self, align 8 - %x = getelementptr inbounds %foo, %foo* %deref2, i32 0, i32 1 - store i32* %x, i32** %y, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %y = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 2 + %deref2 = load ptr, ptr %self, align 8 + %x = getelementptr inbounds nuw %foo, ptr %deref2, i32 0, i32 1 + store ptr %x, ptr %y, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -3013,109 +3010,109 @@ fn user_fb_init_is_added_and_called_if_it_exists() { target triple = "[filtered]" %prog = type { %foo } - %foo = type { i32*, i16, i16 } - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } + %foo = type { ptr, i16, i16 } + %__vtable_foo = type { ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @foo__FB_INIT(%foo* %0) { + define void @foo__FB_INIT(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - store i16 1, i16* %x, align 2 - store i16 2, i16* %y, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + store i16 1, ptr %x, align 2 + store i16 2, ptr %y, align 2 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %f = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - call void @foo(%foo* %f) + %f = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + call void @foo(ptr %f) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %FB_INIT = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__FB_INIT, void (%foo*)** %FB_INIT, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %FB_INIT = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__FB_INIT, ptr %FB_INIT, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %f = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %f) ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %f = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %f) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - call void @foo__FB_INIT(%foo* %deref) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + call void @foo__FB_INIT(ptr %deref) ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -3167,10 +3164,10 @@ fn user_fb_init_in_global_struct() { %prog = type { %bar } %bar = type { %foo } - %foo = type { i32*, i16, i16 } - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } + %foo = type { ptr, i16, i16 } + %__vtable_foo = type { ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__bar__init = unnamed_addr constant %bar zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @@ -3178,123 +3175,123 @@ fn user_fb_init_in_global_struct() { @str = global %bar zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } - define void @foo__FB_INIT(%foo* %0) { + define void @foo__FB_INIT(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - store i16 1, i16* %x, align 2 - store i16 2, i16* %y, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + store i16 1, ptr %x, align 2 + store i16 2, ptr %y, align 2 ret void } - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %str = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %f = getelementptr inbounds %bar, %bar* %str, i32 0, i32 0 - call void @foo(%foo* %f) + %str = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %f = getelementptr inbounds nuw %bar, ptr %str, i32 0, i32 0 + call void @foo(ptr %f) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %FB_INIT = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__FB_INIT, void (%foo*)** %FB_INIT, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %FB_INIT = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__FB_INIT, ptr %FB_INIT, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %f = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %f) ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %str = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__init_bar(%bar* %str) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %str = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__init_bar(ptr %str) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - call void @foo__FB_INIT(%foo* %deref) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + call void @foo__FB_INIT(ptr %deref) ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %f = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %f) ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %str = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_bar(%bar* %str) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %str = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_bar(ptr %str) ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init_bar(%bar* @str) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init_bar(%bar* @str) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init_bar(ptr @str) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init_bar(ptr @str) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -3334,78 +3331,78 @@ fn user_init_called_when_declared_as_external() { target triple = "[filtered]" %prog = type { %foo } - %foo = type { i32*, i16, i16 } - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } + %foo = type { ptr, i16, i16 } + %__vtable_foo = type { ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @prog_instance = global %prog zeroinitializer @__foo__init = external unnamed_addr constant %foo @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - declare void @foo(%foo*) + declare void @foo(ptr) - declare void @foo__FB_INIT(%foo*) + declare void @foo__FB_INIT(ptr) - define void @prog(%prog* %0) { + define void @prog(ptr %0) { entry: - %f = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - call void @foo(%foo* %f) + %f = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + call void @foo(ptr %f) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %FB_INIT = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__FB_INIT, void (%foo*)** %FB_INIT, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %FB_INIT = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__FB_INIT, ptr %FB_INIT, align 8 ret void } - define void @__init_prog(%prog* %0) { + define void @__init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_prog(%prog* %0) { + define void @__user_init_prog(ptr %0) { entry: - %self = alloca %prog*, align 8 - store %prog* %0, %prog** %self, align 8 - %deref = load %prog*, %prog** %self, align 8 - %f = getelementptr inbounds %prog, %prog* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %f) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %f = getelementptr inbounds nuw %prog, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %f) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - call void @foo__FB_INIT(%foo* %deref) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + call void @foo__FB_INIT(ptr %deref) ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_prog(%prog* @prog_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init_prog(%prog* @prog_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init_prog(ptr @prog_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init_prog(ptr @prog_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); diff --git a/src/codegen/tests/initialization_test/global_initializers.rs b/src/codegen/tests/initialization_test/global_initializers.rs index 7d938acf756..5c309648496 100644 --- a/src/codegen/tests/initialization_test/global_initializers.rs +++ b/src/codegen/tests/initialization_test/global_initializers.rs @@ -176,9 +176,9 @@ fn external_pous_get_external_initializers() { @__ext_fb__init = external unnamed_addr constant %ext_fb @ext_prog_instance = external global %ext_prog - declare void @ext_fb(%ext_fb*) + declare void @ext_fb(ptr) - declare void @ext_prog(%ext_prog*) + declare void @ext_prog(ptr) "#); } diff --git a/src/codegen/tests/initialization_test/pou_initializers.rs b/src/codegen/tests/initialization_test/pou_initializers.rs index f96d777cfab..7785eae3492 100644 --- a/src/codegen/tests/initialization_test/pou_initializers.rs +++ b/src/codegen/tests/initialization_test/pou_initializers.rs @@ -433,10 +433,10 @@ fn unary_plus_in_initializer() { @g1 = unnamed_addr constant i16 5 @exp_instance = global %exp { i16 5, float 0x40091EB860000000 } - define void @exp(%exp* %0) { + define void @exp(ptr %0) { entry: - %x = getelementptr inbounds %exp, %exp* %0, i32 0, i32 0 - %y = getelementptr inbounds %exp, %exp* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %exp, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %exp, ptr %0, i32 0, i32 1 ret void } "#); diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_declared_initializer.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_declared_initializer.snap index c04e311a11a..458431e0d1e 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_declared_initializer.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_declared_initializer.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/global_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -19,18 +18,16 @@ entry: %var1 = alloca i16, align 2 %cmd2 = alloca %commands, align 8 %var2 = alloca i16, align 2 - %0 = bitcast %commands* %cmd1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%commands, %commands* @__commands__init, i32 0, i32 0), i64 ptrtoint (%commands* getelementptr (%commands, %commands* null, i32 1) to i64), i1 false) - store i16 0, i16* %var1, align 2 - %1 = bitcast %commands* %cmd2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds (%commands, %commands* @__commands__init, i32 0, i32 0), i64 ptrtoint (%commands* getelementptr (%commands, %commands* null, i32 1) to i64), i1 false) - store i16 0, i16* %var2, align 2 - store i32 0, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %cmd1, ptr align 1 @__commands__init, i64 ptrtoint (ptr getelementptr (%commands, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %var1, align 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %cmd2, ptr align 1 @__commands__init, i64 ptrtoint (ptr getelementptr (%commands, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %var2, align 2 + store i32 0, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_default_initializer.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_default_initializer.snap index ce8d92f5d28..6e072b8b516 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_default_initializer.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__global_constant_without_initializer_gets_default_initializer.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/global_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -21,26 +20,21 @@ entry: %myArr1 = alloca [4 x i16], align 2 %cmd2 = alloca %commands, align 8 %myArr2 = alloca [4 x i16], align 2 - %0 = bitcast %commands* %cmd1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%commands, %commands* @__commands__init, i32 0, i32 0), i64 ptrtoint (%commands* getelementptr (%commands, %commands* null, i32 1) to i64), i1 false) - %1 = bitcast [81 x i8]* %myStr1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds ([81 x i8], [81 x i8]* @__main.myStr1__init, i32 0, i32 0), i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [4 x i16]* %myArr1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([4 x i16]* getelementptr ([4 x i16], [4 x i16]* null, i32 1) to i64), i1 false) - %3 = bitcast %commands* %cmd2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 getelementptr inbounds (%commands, %commands* @__commands__init, i32 0, i32 0), i64 ptrtoint (%commands* getelementptr (%commands, %commands* null, i32 1) to i64), i1 false) - %4 = bitcast [4 x i16]* %myArr2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %4, i8 0, i64 ptrtoint ([4 x i16]* getelementptr ([4 x i16], [4 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %cmd1, ptr align 1 @__commands__init, i64 ptrtoint (ptr getelementptr (%commands, ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %myStr1, ptr align 1 @__main.myStr1__init, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %myArr1, i8 0, i64 ptrtoint (ptr getelementptr ([4 x i16], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %cmd2, ptr align 1 @__commands__init, i64 ptrtoint (ptr getelementptr (%commands, ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %myArr2, i8 0, i64 ptrtoint (ptr getelementptr ([4 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__initial_values_in_global_variables_out_of_order.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__initial_values_in_global_variables_out_of_order.snap index 1acd99e16c7..ea2e5ad05e8 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__initial_values_in_global_variables_out_of_order.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__global_initializers__initial_values_in_global_variables_out_of_order.snap @@ -14,16 +14,16 @@ target triple = "[filtered]" @__MyFB__init = unnamed_addr constant %MyFB { i16 77 } @prg_instance = global %prg { %MyFB { i16 77 } } -define void @MyFB(%MyFB* %0) { +define void @MyFB(ptr %0) { entry: - %this = alloca %MyFB*, align 8 - store %MyFB* %0, %MyFB** %this, align 8 - %x = getelementptr inbounds %MyFB, %MyFB* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyFB, ptr %0, i32 0, i32 0 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__class_struct_initialized_in_function.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__class_struct_initialized_in_function.snap index d26abd951ed..b8034faca06 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__class_struct_initialized_in_function.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__class_struct_initialized_in_function.snap @@ -13,35 +13,32 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb { i16 9 } @main_instance = global %main { %fb { i16 9 } } -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %a = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } -define i32 @func(%fb* %0) { +define i32 @func(ptr %0) { entry: %func = alloca i32, align 4 %in = alloca %fb, align 8 - %1 = bitcast %fb* %in to i8* - %2 = bitcast %fb* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%fb* getelementptr (%fb, %fb* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %in, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%fb, ptr null, i32 1) to i64), i1 false) %x = alloca %fb, align 8 - %3 = bitcast %fb* %x to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 bitcast (%fb* @__fb__init to i8*), i64 ptrtoint (%fb* getelementptr (%fb, %fb* null, i32 1) to i64), i1 false) - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %x, ptr align 1 @__fb__init, i64 ptrtoint (ptr getelementptr (%fb, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fb0 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %call = call i32 @func(%fb* %fb0) + %fb0 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %call = call i32 @func(ptr %fb0) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__default_values_for_not_initialized_function_vars.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__default_values_for_not_initialized_function_vars.snap index 82110984c8a..06c7173c325 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__default_values_for_not_initialized_function_vars.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__default_values_for_not_initialized_function_vars.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,19 +12,18 @@ entry: %func = alloca i16, align 2 %int_var = alloca i16, align 2 %arr_var = alloca [4 x i32], align 4 - %ptr_var = alloca i32*, align 8 + %ptr_var = alloca ptr, align 8 %float_var = alloca float, align 4 - store i16 0, i16* %int_var, align 2 - %0 = bitcast [4 x i32]* %arr_var to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) - store i32* null, i32** %ptr_var, align 8 - store float 0.000000e+00, float* %float_var, align 4 - store i16 0, i16* %func, align 2 - %func_ret = load i16, i16* %func, align 2 + store i16 0, ptr %int_var, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %arr_var, i8 0, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) + store ptr null, ptr %ptr_var, align 8 + store float 0.000000e+00, ptr %float_var, align 4 + store i16 0, ptr %func, align 2 + %func_ret = load i16, ptr %func, align 2 ret i16 %func_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__enum_variants_have_precedence_over_global_variables_in_inline_assignment.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__enum_variants_have_precedence_over_global_variables_in_inline_assignment.snap index 3295e130530..0eb4980d8f4 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__enum_variants_have_precedence_over_global_variables_in_inline_assignment.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__enum_variants_have_precedence_over_global_variables_in_inline_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,9 +17,9 @@ define i32 @foo() { entry: %foo = alloca i32, align 4 %position = alloca i32, align 4 - store i32 1, i32* %position, align 4 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 1, ptr %position, align 4 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } @@ -28,8 +27,8 @@ define i32 @bar() { entry: %bar = alloca i32, align 4 %position = alloca i32, align 4 - store i32 3, i32* %position, align 4 - store i32 0, i32* %bar, align 4 - %bar_ret = load i32, i32* %bar, align 4 + store i32 3, ptr %position, align 4 + store i32 0, ptr %bar, align 4 + %bar_ret = load i32, ptr %bar, align 4 ret i32 %bar_ret } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_block_struct_initialized_in_function.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_block_struct_initialized_in_function.snap index 800ab0b5993..46e3780e48f 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_block_struct_initialized_in_function.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_block_struct_initialized_in_function.snap @@ -13,36 +13,33 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb zeroinitializer @main_instance = global %main zeroinitializer -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } -define i32 @func(%fb* %0) { +define i32 @func(ptr %0) { entry: %func = alloca i32, align 4 %in = alloca %fb, align 8 - %1 = bitcast %fb* %in to i8* - %2 = bitcast %fb* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%fb* getelementptr (%fb, %fb* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %in, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%fb, ptr null, i32 1) to i64), i1 false) %x = alloca %fb, align 8 - %3 = bitcast %fb* %x to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 bitcast (%fb* @__fb__init to i8*), i64 ptrtoint (%fb* getelementptr (%fb, %fb* null, i32 1) to i64), i1 false) - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %x, ptr align 1 @__fb__init, i64 ptrtoint (ptr getelementptr (%fb, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fb0 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %call = call i32 @func(%fb* %fb0) + %fb0 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %call = call i32 @func(ptr %fb0) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized.snap index 8c76c815776..f06d3556b08 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,28 +14,28 @@ target triple = "[filtered]" define i16 @foo_int() { entry: %foo_int = alloca i16, align 2 - store i16 0, i16* %foo_int, align 2 - %foo_int_ret = load i16, i16* %foo_int, align 2 + store i16 0, ptr %foo_int, align 2 + %foo_int_ret = load i16, ptr %foo_int, align 2 ret i16 %foo_int_ret } -define void @foo_str(i8* %0) { +define void @foo_str(ptr %0) { entry: - %foo_str = alloca i8*, align 8 - store i8* %0, i8** %foo_str, align 8 + %foo_str = alloca ptr, align 8 + store ptr %0, ptr %foo_str, align 8 ret void } -define void @foo_arr(float* %0) { +define void @foo_arr(ptr %0) { entry: - %foo_arr = alloca float*, align 8 - store float* %0, float** %foo_arr, align 8 + %foo_arr = alloca ptr, align 8 + store ptr %0, ptr %foo_arr, align 8 ret void } -define void @foo_struct(%MyStruct* %0) { +define void @foo_struct(ptr %0) { entry: - %foo_struct = alloca %MyStruct*, align 8 - store %MyStruct* %0, %MyStruct** %foo_struct, align 8 + %foo_struct = alloca ptr, align 8 + store ptr %0, ptr %foo_struct, align 8 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized_with_type_initializer.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized_with_type_initializer.snap index 5db2a0fb45a..12a7f2792dd 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized_with_type_initializer.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_is_initialized_with_type_initializer.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,35 +12,29 @@ target triple = "[filtered]" @__myArray__init = unnamed_addr constant [4 x i32] [i32 1, i32 2, i32 3, i32 4] @main_instance = global %main zeroinitializer -define void @target(i32* %0) { +define void @target(ptr %0) { entry: - %target = alloca i32*, align 8 - store i32* %0, i32** %target, align 8 - %deref = load i32*, i32** %target, align 8 - %tmpVar = getelementptr inbounds i32, i32* %deref, i32 2 - store i32 7, i32* %tmpVar, align 4 + %target = alloca ptr, align 8 + store ptr %0, ptr %target, align 8 + %deref = load ptr, ptr %target, align 8 + %tmpVar = getelementptr inbounds [4 x i32], ptr %deref, i32 0, i32 2 + store i32 7, ptr %tmpVar, align 4 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 %__target0 = alloca [4 x i32], align 4 - %1 = bitcast [4 x i32]* %__target0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast ([4 x i32]* @__myArray__init to i8*), i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) - %2 = bitcast [4 x i32]* %__target0 to i32* - call void @target(i32* %2) - %3 = bitcast [4 x i32]* %x to i8* - %4 = bitcast [4 x i32]* %__target0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 %4, i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) - %5 = bitcast [4 x i32]* %y to i8* - %6 = bitcast [4 x i32]* %x to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 %6, i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %__target0, ptr align 1 @__myArray__init, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) + call void @target(ptr %__target0) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %x, ptr align 1 %__target0, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %y, ptr align 1 %x, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_with_initializers_is_initialized.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_with_initializers_is_initialized.snap index 20e141eb873..01344c17707 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_with_initializers_is_initialized.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_with_initializers_is_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,28 +16,28 @@ target triple = "[filtered]" define i16 @foo_int() { entry: %foo_int = alloca i16, align 2 - store i16 7, i16* %foo_int, align 2 - %foo_int_ret = load i16, i16* %foo_int, align 2 + store i16 7, ptr %foo_int, align 2 + %foo_int_ret = load i16, ptr %foo_int, align 2 ret i16 %foo_int_ret } -define void @foo_str(i8* %0) { +define void @foo_str(ptr %0) { entry: - %foo_str = alloca i8*, align 8 - store i8* %0, i8** %foo_str, align 8 + %foo_str = alloca ptr, align 8 + store ptr %0, ptr %foo_str, align 8 ret void } -define void @foo_arr(float* %0) { +define void @foo_arr(ptr %0) { entry: - %foo_arr = alloca float*, align 8 - store float* %0, float** %foo_arr, align 8 + %foo_arr = alloca ptr, align 8 + store ptr %0, ptr %foo_arr, align 8 ret void } -define void @foo_strct(%MyStrct* %0) { +define void @foo_strct(ptr %0) { entry: - %foo_strct = alloca %MyStrct*, align 8 - store %MyStrct* %0, %MyStrct** %foo_strct, align 8 + %foo_strct = alloca ptr, align 8 + store ptr %0, ptr %foo_strct, align 8 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_without_initializers_is_initialized.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_without_initializers_is_initialized.snap index 40e78b4b550..f84a888974d 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_without_initializers_is_initialized.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__function_return_value_without_initializers_is_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,28 +14,28 @@ target triple = "[filtered]" define i16 @foo_int() { entry: %foo_int = alloca i16, align 2 - store i16 0, i16* %foo_int, align 2 - %foo_int_ret = load i16, i16* %foo_int, align 2 + store i16 0, ptr %foo_int, align 2 + %foo_int_ret = load i16, ptr %foo_int, align 2 ret i16 %foo_int_ret } -define void @foo_str(i8* %0) { +define void @foo_str(ptr %0) { entry: - %foo_str = alloca i8*, align 8 - store i8* %0, i8** %foo_str, align 8 + %foo_str = alloca ptr, align 8 + store ptr %0, ptr %foo_str, align 8 ret void } -define void @foo_arr(float* %0) { +define void @foo_arr(ptr %0) { entry: - %foo_arr = alloca float*, align 8 - store float* %0, float** %foo_arr, align 8 + %foo_arr = alloca ptr, align 8 + store ptr %0, ptr %foo_arr, align 8 ret void } -define void @foo_strct(%MyStrct* %0) { +define void @foo_strct(ptr %0) { entry: - %foo_strct = alloca %MyStrct*, align 8 - store %MyStrct* %0, %MyStrct** %foo_strct, align 8 + %foo_strct = alloca ptr, align 8 + store ptr %0, ptr %foo_strct, align 8 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_constant_values_in_pou_variables.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_constant_values_in_pou_variables.snap index d2b524743d1..6fcd2f2cecb 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_constant_values_in_pou_variables.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_constant_values_in_pou_variables.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,9 +14,9 @@ target triple = "[filtered]" @LEN = unnamed_addr constant i16 20 @prg_instance = global %prg { i16 24, i16 89 } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %my_len = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %my_size = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 + %my_len = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %my_size = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_function_block_pou.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_function_block_pou.snap index c78e541faea..809dc160df2 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_function_block_pou.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_function_block_pou.snap @@ -13,21 +13,21 @@ target triple = "[filtered]" @__FB__init = unnamed_addr constant %FB { i16 7, i16 0, i8 1, i8 0, float 0x400921CAC0000000, float 0.000000e+00 } @main_instance = global %main { %FB { i16 7, i16 0, i8 1, i8 0, float 0x400921CAC0000000, float 0.000000e+00 } } -define void @FB(%FB* %0) { +define void @FB(ptr %0) { entry: - %this = alloca %FB*, align 8 - store %FB* %0, %FB** %this, align 8 - %x = getelementptr inbounds %FB, %FB* %0, i32 0, i32 0 - %xx = getelementptr inbounds %FB, %FB* %0, i32 0, i32 1 - %y = getelementptr inbounds %FB, %FB* %0, i32 0, i32 2 - %yy = getelementptr inbounds %FB, %FB* %0, i32 0, i32 3 - %z = getelementptr inbounds %FB, %FB* %0, i32 0, i32 4 - %zz = getelementptr inbounds %FB, %FB* %0, i32 0, i32 5 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 0 + %xx = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 2 + %yy = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 3 + %z = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 4 + %zz = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 5 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fb = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %fb = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_program_pou.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_program_pou.snap index 047dee80860..847baf408e1 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_program_pou.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initial_values_in_program_pou.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,13 +11,13 @@ target triple = "[filtered]" @Main_instance = global %Main { i16 7, i16 0, i8 1, i8 0, float 0x400921CAC0000000, float 0.000000e+00 } -define void @Main(%Main* %0) { +define void @Main(ptr %0) { entry: - %x = getelementptr inbounds %Main, %Main* %0, i32 0, i32 0 - %xx = getelementptr inbounds %Main, %Main* %0, i32 0, i32 1 - %y = getelementptr inbounds %Main, %Main* %0, i32 0, i32 2 - %yy = getelementptr inbounds %Main, %Main* %0, i32 0, i32 3 - %z = getelementptr inbounds %Main, %Main* %0, i32 0, i32 4 - %zz = getelementptr inbounds %Main, %Main* %0, i32 0, i32 5 + %x = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 0 + %xx = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 2 + %yy = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 3 + %z = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 4 + %zz = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 5 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_in_function.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_in_function.snap index 594fa0ff463..1d9ddabd3fa 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_in_function.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_in_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,14 +13,13 @@ define i16 @func() { entry: %func = alloca i16, align 2 %arr_var = alloca [4 x i32], align 4 - %0 = bitcast [4 x i32]* %arr_var to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast ([4 x i32]* @__func.arr_var__init to i8*), i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) - store i16 0, i16* %func, align 2 - %func_ret = load i16, i16* %func, align 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr_var, ptr align 1 @__func.arr_var__init, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %func, align 2 + %func_ret = load i16, ptr %func, align 2 ret i16 %func_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_type_in_function.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_type_in_function.snap index 306a8877cae..0bdf184a82f 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_type_in_function.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__initialized_array_type_in_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,14 +13,13 @@ define i16 @func() { entry: %func = alloca i16, align 2 %arr_var = alloca [4 x i32], align 4 - %0 = bitcast [4 x i32]* %arr_var to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast ([4 x i32]* @__arr__init to i8*), i64 ptrtoint ([4 x i32]* getelementptr ([4 x i32], [4 x i32]* null, i32 1) to i64), i1 false) - store i16 0, i16* %func, align 2 - %func_ret = load i16, i16* %func, align 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr_var, ptr align 1 @__arr__init, i64 ptrtoint (ptr getelementptr ([4 x i32], ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %func, align 2 + %func_ret = load i16, ptr %func, align 2 ret i16 %func_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__memcpy_for_struct_initialization_in_function.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__memcpy_for_struct_initialization_in_function.snap index 9c578cb06d5..86347566fde 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__memcpy_for_struct_initialization_in_function.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__memcpy_for_struct_initialization_in_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,14 +15,13 @@ define i16 @func() { entry: %func = alloca i16, align 2 %a = alloca %__func_a, align 8 - %0 = bitcast %__func_a* %a to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%__func_a* @____func_a__init to i8*), i64 ptrtoint (%__func_a* getelementptr (%__func_a, %__func_a* null, i32 1) to i64), i1 false) - store i16 0, i16* %func, align 2 - %func_ret = load i16, i16* %func, align 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %a, ptr align 1 @____func_a__init, i64 ptrtoint (ptr getelementptr (%__func_a, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %func, align 2 + %func_ret = load i16, ptr %func, align 2 ret i16 %func_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__no_memcpy_for_struct_initialization_in_program.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__no_memcpy_for_struct_initialization_in_program.snap index e2593cbb2b0..6b02f9b42af 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__no_memcpy_for_struct_initialization_in_program.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__no_memcpy_for_struct_initialization_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,8 +13,8 @@ target triple = "[filtered]" @prog_instance = global %prog zeroinitializer @____prog_a__init = unnamed_addr constant %__prog_a zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %a = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_are_referenced_correctly.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_are_referenced_correctly.snap index 9fc1942d953..ed9e9a4ab6e 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_are_referenced_correctly.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_are_referenced_correctly.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,9 +16,9 @@ define i32 @foo() { entry: %foo = alloca i32, align 4 %position = alloca i32, align 4 - store i32 1, i32* %position, align 4 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 1, ptr %position, align 4 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } @@ -27,8 +26,8 @@ define i32 @bar() { entry: %bar = alloca i32, align 4 %position = alloca i32, align 4 - store i32 3, i32* %position, align 4 - store i32 0, i32* %bar, align 4 - %bar_ret = load i32, i32* %bar, align 4 + store i32 3, ptr %position, align 4 + store i32 0, ptr %bar, align 4 + %bar_ret = load i32, ptr %bar, align 4 ret i32 %bar_ret } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_with_similar_names_are_referenced_correctly.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_with_similar_names_are_referenced_correctly.snap index 2f41a64a136..e66aa255816 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_with_similar_names_are_referenced_correctly.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__pou_initializers__two_identical_enums_in_different_functions_with_similar_names_are_referenced_correctly.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/pou_initializers.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -21,9 +20,9 @@ define i32 @a() { entry: %a = alloca i32, align 4 %position = alloca i32, align 4 - store i32 1, i32* %position, align 4 - store i32 0, i32* %a, align 4 - %a_ret = load i32, i32* %a, align 4 + store i32 1, ptr %position, align 4 + store i32 0, ptr %a, align 4 + %a_ret = load i32, ptr %a, align 4 ret i32 %a_ret } @@ -31,9 +30,9 @@ define i32 @aa() { entry: %aa = alloca i32, align 4 %position = alloca i32, align 4 - store i32 2, i32* %position, align 4 - store i32 0, i32* %aa, align 4 - %aa_ret = load i32, i32* %aa, align 4 + store i32 2, ptr %position, align 4 + store i32 0, ptr %aa, align 4 + %aa_ret = load i32, ptr %aa, align 4 ret i32 %aa_ret } @@ -41,9 +40,9 @@ define i32 @bb() { entry: %bb = alloca i32, align 4 %position = alloca i32, align 4 - store i32 3, i32* %position, align 4 - store i32 0, i32* %bb, align 4 - %bb_ret = load i32, i32* %bb, align 4 + store i32 3, ptr %position, align 4 + store i32 0, ptr %bb, align 4 + %bb_ret = load i32, ptr %bb, align 4 ret i32 %bb_ret } @@ -51,8 +50,8 @@ define i32 @b() { entry: %b = alloca i32, align 4 %position = alloca i32, align 4 - store i32 4, i32* %position, align 4 - store i32 0, i32* %b, align 4 - %b_ret = load i32, i32* %b, align 4 + store i32 4, ptr %position, align 4 + store i32 0, ptr %b, align 4 + %b_ret = load i32, ptr %b, align 4 ret i32 %b_ret } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__array_of_struct_initialization.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__array_of_struct_initialization.snap index a6d10041c8c..861239fc262 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__array_of_struct_initialization.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__array_of_struct_initialization.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/type_initializers.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -19,9 +18,9 @@ target triple = "[filtered]" @__main.arr__init = unnamed_addr constant [2 x %myStruct] [%myStruct { i32 10, i32 20, [2 x i32] [i32 30, i32 40] }, %myStruct { i32 50, i32 60, [2 x i32] [i32 70, i32 80] }] @__main.alias_arr__init = unnamed_addr constant [2 x %myStruct] [%myStruct { i32 10, i32 20, [2 x i32] [i32 30, i32 40] }, %myStruct { i32 50, i32 60, [2 x i32] [i32 70, i32 80] }] -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %arr = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %alias_arr = getelementptr inbounds %main, %main* %0, i32 0, i32 1 + %arr = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %alias_arr = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__enums_with_inline_initializer_are_initialized.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__enums_with_inline_initializer_are_initialized.snap index dc3bc47dfde..57db53c08ce 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__enums_with_inline_initializer_are_initialized.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__enums_with_inline_initializer_are_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/type_initializers.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -31,11 +30,11 @@ entry: %var1 = alloca i32, align 4 %var2 = alloca i32, align 4 %var3 = alloca i32, align 4 - store i32 2, i32* %y, align 4 - store i32 1, i32* %var1, align 4 - store i32 2, i32* %var2, align 4 - store i32 1, i32* %var3, align 4 - store i32 0, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 2, ptr %y, align 4 + store i32 1, ptr %var1, align 4 + store i32 2, ptr %var2, align 4 + store i32 1, ptr %var3, align 4 + store i32 0, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__initial_values_in_fb_variable.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__initial_values_in_fb_variable.snap index c809b92bf77..334f6cffebc 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__initial_values_in_fb_variable.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__initial_values_in_fb_variable.snap @@ -15,19 +15,19 @@ target triple = "[filtered]" @__main.struct1__init = unnamed_addr constant %TON { i16 10, i16 17 } @__main.struct2__init = unnamed_addr constant %TON { i16 17, i16 10 } -define void @TON(%TON* %0) { +define void @TON(ptr %0) { entry: - %this = alloca %TON*, align 8 - store %TON* %0, %TON** %this, align 8 - %a = getelementptr inbounds %TON, %TON* %0, i32 0, i32 0 - %b = getelementptr inbounds %TON, %TON* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %a = getelementptr inbounds nuw %TON, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %TON, ptr %0, i32 0, i32 1 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %TEN = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %struct1 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %struct2 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 + %TEN = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %struct1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %struct2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 ret void } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__skipped_field_members_for_array_of_structs_are_zero_initialized.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__skipped_field_members_for_array_of_structs_are_zero_initialized.snap index 5e0aa84b2f9..806082f779e 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__skipped_field_members_for_array_of_structs_are_zero_initialized.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__skipped_field_members_for_array_of_structs_are_zero_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/initialization_test/type_initializers.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,8 +16,8 @@ target triple = "[filtered]" @__STRUCT2__init = unnamed_addr constant %STRUCT2 zeroinitializer @__main.var_init1__init = unnamed_addr constant [3 x %STRUCT1] [%STRUCT1 { i32 0, [2 x %STRUCT2] [%STRUCT2 { i32 1, i32 0 }, %STRUCT2 zeroinitializer] }, %STRUCT1 { i32 2, [2 x %STRUCT2] [%STRUCT2 { i32 1, i32 1 }, %STRUCT2 zeroinitializer] }, %STRUCT1 { i32 1, [2 x %STRUCT2] [%STRUCT2 { i32 1, i32 0 }, %STRUCT2 { i32 0, i32 2 }] }] -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var_init1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %var_init1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/online_change_tests.rs b/src/codegen/tests/online_change_tests.rs deleted file mode 100644 index 9c2ee6064c3..00000000000 --- a/src/codegen/tests/online_change_tests.rs +++ /dev/null @@ -1,145 +0,0 @@ -use plc_util::filtered_assert_snapshot; - -use crate::test_utils::tests::codegen_with_online_change as codegen; - -#[test] -#[cfg_attr(target_os = "macos", ignore)] -fn generate_function_with_online_change() { - let src = codegen( - " - FUNCTION foo : DINT - VAR - x : DINT; - END_VAR - END_FUNCTION - ", - ); - filtered_assert_snapshot!(src, @r#" - ; ModuleID = '' - source_filename = "" - target datalayout = "[filtered]" - target triple = "[filtered]" - - @__custom_got = weak_odr global [2 x i8*] zeroinitializer - - define i32 @foo() section "$RUSTY$fn-foo:i32[]" { - entry: - %foo = alloca i32, align 4 - %x = alloca i32, align 4 - store i32 0, i32* %x, align 4 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 - ret i32 %foo_ret - } - "#) -} - -#[test] -#[cfg_attr(target_os = "macos", ignore)] -fn generate_program_with_online_change() { - let src = codegen( - " - PROGRAM prg - VAR - x : DINT; - END_VAR - END_PROGRAM - ", - ); - filtered_assert_snapshot!(src, @r#" - ; ModuleID = '' - source_filename = "" - target datalayout = "[filtered]" - target triple = "[filtered]" - - %prg = type { i32 } - - @prg_instance = global %prg zeroinitializer, section "$RUSTY$var-prg_instance:r1i32" - @__custom_got = weak_odr global [6 x i8*] zeroinitializer - - define void @prg(%prg* %0) section "$RUSTY$fn-prg:v[]" { - entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - ret void - } - "#) -} - -#[test] -#[cfg_attr(target_os = "macos", ignore)] -fn generate_program_and_var_with_online_change() { - let src = codegen( - " - PROGRAM prg - VAR - x : DINT; - END_VAR - gV := x; - END_PROGRAM - VAR_GLOBAL - gV : DINT; - END_VAR - ", - ); - filtered_assert_snapshot!(src, @r#" - ; ModuleID = '' - source_filename = "" - target datalayout = "[filtered]" - target triple = "[filtered]" - - %prg = type { i32 } - - @gV = global i32 0, section "$RUSTY$var-gv:i32" - @prg_instance = global %prg zeroinitializer, section "$RUSTY$var-prg_instance:r1i32" - @__custom_got = weak_odr global [8 x i8*] zeroinitializer - - define void @prg(%prg* %0) section "$RUSTY$fn-prg:v[]" { - entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %1 = load i32*, i32** getelementptr inbounds (i32*, i32** inttoptr (i64 -2401053092612145152 to i32**), i32 1), align 8 - %load_x = load i32, i32* %x, align 4 - store i32 %load_x, i32* %1, align 4 - ret void - } - "#) -} - -#[test] -#[cfg_attr(target_os = "macos", ignore)] -fn generate_function_and_var_with_online_change() { - let src = codegen( - " - FUNCTION foo : DINT - VAR - x : DINT; - END_VAR - gV := x; - END_FUNCTION - VAR_GLOBAL - gV : DINT; - END_VAR - ", - ); - filtered_assert_snapshot!(src, @r#" - ; ModuleID = '' - source_filename = "" - target datalayout = "[filtered]" - target triple = "[filtered]" - - @gV = global i32 0, section "$RUSTY$var-gv:i32" - @__custom_got = weak_odr global [4 x i8*] zeroinitializer - - define i32 @foo() section "$RUSTY$fn-foo:i32[]" { - entry: - %foo = alloca i32, align 4 - %x = alloca i32, align 4 - store i32 0, i32* %x, align 4 - store i32 0, i32* %foo, align 4 - %0 = load i32*, i32** getelementptr inbounds (i32*, i32** inttoptr (i64 -2401053092612145152 to i32**), i32 1), align 8 - %load_x = load i32, i32* %x, align 4 - store i32 %load_x, i32* %0, align 4 - %foo_ret = load i32, i32* %foo, align 4 - ret i32 %foo_ret - } - "#) -} diff --git a/src/codegen/tests/oop_tests.rs b/src/codegen/tests/oop_tests.rs index f8e84dc9a47..a226e6d3af2 100644 --- a/src/codegen/tests/oop_tests.rs +++ b/src/codegen/tests/oop_tests.rs @@ -25,12 +25,12 @@ fn members_from_base_class_are_available_in_subclasses() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, i16, [81 x i8], [11 x [81 x i8]] } - %__vtable_bar = type { void (%bar*)* } + %__vtable_foo = type { ptr } + %foo = type { ptr, i16, [81 x i8], [11 x [81 x i8]] } + %__vtable_bar = type { ptr } %bar = type { %foo } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -38,106 +38,106 @@ fn members_from_base_class_are_available_in_subclasses() { @__bar__init = unnamed_addr constant %bar zeroinitializer @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %a = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %b = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - %c = getelementptr inbounds %foo, %foo* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + %c = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 3 ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__foo = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %bar*, %bar** %self, align 8 - %__foo2 = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } "#); @@ -172,14 +172,14 @@ fn write_to_parent_variable_qualified_access() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_fb = type { void (%fb*)* } - %fb = type { i32*, i16, i16 } - %__vtable_fb2 = type { void (%fb2*)* } + %__vtable_fb = type { ptr } + %fb = type { ptr, i16, i16 } + %__vtable_fb2 = type { ptr } %fb2 = type { %fb } - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, %fb2 } + %__vtable_foo = type { ptr } + %foo = type { ptr, %fb2 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_fb__init = unnamed_addr constant %__vtable_fb zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer @__vtable_fb_instance = global %__vtable_fb zeroinitializer @@ -190,159 +190,159 @@ fn write_to_parent_variable_qualified_access() { @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @fb(%fb* %0) { + define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 1 - %y = getelementptr inbounds %fb, %fb* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 2 ret void } - define void @fb2(%fb2* %0) { + define void @fb2(ptr %0) { entry: - %this = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %this, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %0, i32 0, i32 0 ret void } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %myFb = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %__fb = getelementptr inbounds %fb2, %fb2* %myFb, i32 0, i32 0 - %x = getelementptr inbounds %fb, %fb* %__fb, i32 0, i32 1 - store i16 1, i16* %x, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %myFb = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %__fb = getelementptr inbounds nuw %fb2, ptr %myFb, i32 0, i32 0 + %x = getelementptr inbounds nuw %fb, ptr %__fb, i32 0, i32 1 + store i16 1, ptr %x, align 2 ret void } - define void @__init___vtable_fb(%__vtable_fb* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 - %deref = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref, i32 0, i32 0 - store void (%fb*)* @fb, void (%fb*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb, ptr %__body, align 8 ret void } - define void @__init___vtable_fb2(%__vtable_fb2* %0) { + define void @__init___vtable_fb2(ptr %0) { entry: - %self = alloca %__vtable_fb2*, align 8 - store %__vtable_fb2* %0, %__vtable_fb2** %self, align 8 - %deref = load %__vtable_fb2*, %__vtable_fb2** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb2, %__vtable_fb2* %deref, i32 0, i32 0 - store void (%fb2*)* @fb2, void (%fb2*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb2, ptr %__body, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_fb2(%fb2* %0) { + define void @__init_fb2(ptr %0) { entry: - %self = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %self, align 8 - %deref = load %fb2*, %fb2** %self, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %deref, i32 0, i32 0 - call void @__init_fb(%fb* %__fb) - %deref1 = load %fb2*, %fb2** %self, align 8 - %__fb2 = getelementptr inbounds %fb2, %fb2* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %fb, %fb* %__fb2, i32 0, i32 0 - store i32* bitcast (%__vtable_fb2* @__vtable_fb2_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %deref, i32 0, i32 0 + call void @__init_fb(ptr %__fb) + %deref1 = load ptr, ptr %self, align 8 + %__fb2 = getelementptr inbounds nuw %fb2, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %fb, ptr %__fb2, i32 0, i32 0 + store ptr @__vtable_fb2_instance, ptr %__vtable, align 8 ret void } - define void @__init_fb(%fb* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 - %deref = load %fb*, %fb** %self, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_fb* @__vtable_fb_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %deref, i32 0, i32 0 + store ptr @__vtable_fb_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %myFb = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 1 - call void @__init_fb2(%fb2* %myFb) - %deref1 = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %myFb = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 1 + call void @__init_fb2(ptr %myFb) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_fb(%fb* %0) { + define void @__user_init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_fb2(%fb2* %0) { + define void @__user_init_fb2(ptr %0) { entry: - %self = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %self, align 8 - %deref = load %fb2*, %fb2** %self, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %deref, i32 0, i32 0 - call void @__user_init_fb(%fb* %__fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %deref, i32 0, i32 0 + call void @__user_init_fb(ptr %__fb) ret void } - define void @__user_init___vtable_fb(%__vtable_fb* %0) { + define void @__user_init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_fb2(%__vtable_fb2* %0) { + define void @__user_init___vtable_fb2(ptr %0) { entry: - %self = alloca %__vtable_fb2*, align 8 - store %__vtable_fb2* %0, %__vtable_fb2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %myFb = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 1 - call void @__user_init_fb2(%fb2* %myFb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %myFb = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 1 + call void @__user_init_fb2(ptr %myFb) ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__init___vtable_fb2(%__vtable_fb2* @__vtable_fb2_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__user_init___vtable_fb2(%__vtable_fb2* @__vtable_fb2_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_fb(ptr @__vtable_fb_instance) + call void @__init___vtable_fb2(ptr @__vtable_fb2_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_fb(ptr @__vtable_fb_instance) + call void @__user_init___vtable_fb2(ptr @__vtable_fb2_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -381,14 +381,14 @@ fn write_to_parent_variable_in_instance() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32*, [81 x i8] } - %__vtable_bar = type { void (%bar*)*, void (%foo*)* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr, [81 x i8] } + %__vtable_bar = type { ptr, ptr } %bar = type { %foo } @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"world\00" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -396,34 +396,32 @@ fn write_to_parent_variable_in_instance() { @__bar__init = unnamed_addr constant %bar zeroinitializer @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @foo__baz(%foo* %0) { + define void @foo__baz(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__foo = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %__foo, i32 0, i32 1 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %__foo, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_1, i32 6, i1 false) ret void } @@ -431,119 +429,117 @@ fn write_to_parent_variable_in_instance() { entry: %s = alloca [81 x i8], align 1 %fb = alloca %bar, align 8 - %0 = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast %bar* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%bar* @__bar__init to i8*), i64 ptrtoint (%bar* getelementptr (%bar, %bar* null, i32 1) to i64), i1 false) - call void @__init_bar(%bar* %fb) - call void @__user_init_bar(%bar* %fb) - %__foo = getelementptr inbounds %bar, %bar* %fb, i32 0, i32 0 - call void @foo__baz(%foo* %__foo) - call void @bar(%bar* %fb) + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__bar__init, i64 ptrtoint (ptr getelementptr (%bar, ptr null, i32 1) to i64), i1 false) + call void @__init_bar(ptr %fb) + call void @__user_init_bar(ptr %fb) + %__foo = getelementptr inbounds nuw %bar, ptr %fb, i32 0, i32 0 + call void @foo__baz(ptr %__foo) + call void @bar(ptr %fb) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %baz = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 - %deref1 = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %baz = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %bar*, %bar** %self, align 8 - %__foo2 = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -589,14 +585,14 @@ fn array_in_parent_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)* } - %grandparent = type { i32*, [6 x i16], i16 } - %__vtable_parent = type { void (%parent*)* } + %__vtable_grandparent = type { ptr } + %grandparent = type { ptr, [6 x i16], i16 } + %__vtable_parent = type { ptr } %parent = type { %grandparent, [11 x i16], i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_child = type { ptr } %child = type { %parent, [11 x i16] } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer @__grandparent__init = unnamed_addr constant %grandparent zeroinitializer @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @@ -607,199 +603,198 @@ fn array_in_parent_generated() { @__child__init = unnamed_addr constant %child zeroinitializer @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) { + define void @grandparent(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 - %a = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 + %a = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 2 ret void } - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %z = getelementptr inbounds %child, %child* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 ret void } define void @main() { entry: %arr = alloca [11 x %child], align 8 - %0 = bitcast [11 x %child]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([11 x %child]* getelementptr ([11 x %child], [11 x %child]* null, i32 1) to i64), i1 false) - %tmpVar = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 0 - %__parent = getelementptr inbounds %child, %child* %tmpVar, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0 - %a = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 2 - store i16 10, i16* %a, align 2 - %tmpVar1 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 0 - %__parent2 = getelementptr inbounds %child, %child* %tmpVar1, i32 0, i32 0 - %__grandparent3 = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %__grandparent3, i32 0, i32 1 - %tmpVar4 = getelementptr inbounds [6 x i16], [6 x i16]* %y, i32 0, i32 0 - store i16 20, i16* %tmpVar4, align 2 - %tmpVar5 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 1 - %__parent6 = getelementptr inbounds %child, %child* %tmpVar5, i32 0, i32 0 - %b = getelementptr inbounds %parent, %parent* %__parent6, i32 0, i32 2 - store i16 30, i16* %b, align 2 - %tmpVar7 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 1 - %__parent8 = getelementptr inbounds %child, %child* %tmpVar7, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %__parent8, i32 0, i32 1 - %tmpVar9 = getelementptr inbounds [11 x i16], [11 x i16]* %x, i32 0, i32 1 - store i16 40, i16* %tmpVar9, align 2 - %tmpVar10 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 2 - %z = getelementptr inbounds %child, %child* %tmpVar10, i32 0, i32 1 - %tmpVar11 = getelementptr inbounds [11 x i16], [11 x i16]* %z, i32 0, i32 2 - store i16 50, i16* %tmpVar11, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([11 x %child], ptr null, i32 1) to i64), i1 false) + %tmpVar = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 0 + %__parent = getelementptr inbounds nuw %child, ptr %tmpVar, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0 + %a = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 2 + store i16 10, ptr %a, align 2 + %tmpVar1 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 0 + %__parent2 = getelementptr inbounds nuw %child, ptr %tmpVar1, i32 0, i32 0 + %__grandparent3 = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %__grandparent3, i32 0, i32 1 + %tmpVar4 = getelementptr inbounds [6 x i16], ptr %y, i32 0, i32 0 + store i16 20, ptr %tmpVar4, align 2 + %tmpVar5 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 1 + %__parent6 = getelementptr inbounds nuw %child, ptr %tmpVar5, i32 0, i32 0 + %b = getelementptr inbounds nuw %parent, ptr %__parent6, i32 0, i32 2 + store i16 30, ptr %b, align 2 + %tmpVar7 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 1 + %__parent8 = getelementptr inbounds nuw %child, ptr %tmpVar7, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %__parent8, i32 0, i32 1 + %tmpVar9 = getelementptr inbounds [11 x i16], ptr %x, i32 0, i32 1 + store i16 40, ptr %tmpVar9, align 2 + %tmpVar10 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 2 + %z = getelementptr inbounds nuw %child, ptr %tmpVar10, i32 0, i32 1 + %tmpVar11 = getelementptr inbounds [11 x i16], ptr %z, i32 0, i32 2 + store i16 50, ptr %tmpVar11, align 2 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -836,14 +831,14 @@ fn complex_array_access_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)* } - %grandparent = type { i32*, [6 x i16], i16 } - %__vtable_parent = type { void (%parent*)* } + %__vtable_grandparent = type { ptr } + %grandparent = type { ptr, [6 x i16], i16 } + %__vtable_parent = type { ptr } %parent = type { %grandparent, [11 x i16], i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_child = type { ptr } %child = type { %parent, [11 x i16] } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer @__grandparent__init = unnamed_addr constant %grandparent zeroinitializer @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @@ -854,184 +849,184 @@ fn complex_array_access_generated() { @__child__init = unnamed_addr constant %child zeroinitializer @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) { + define void @grandparent(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 - %a = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 + %a = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 2 ret void } - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %z = getelementptr inbounds %child, %child* %0, i32 0, i32 1 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_b = load i16, i16* %b, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_b = load i16, ptr %b, align 2 %1 = sext i16 %load_b to i32 - %b1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_b2 = load i16, i16* %b1, align 2 + %b1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_b2 = load i16, ptr %b1, align 2 %2 = sext i16 %load_b2 to i32 %tmpVar = mul i32 %2, 2 %tmpVar3 = mul i32 1, %tmpVar %tmpVar4 = add i32 %tmpVar3, 0 - %tmpVar5 = getelementptr inbounds [11 x i16], [11 x i16]* %z, i32 0, i32 %tmpVar4 - %load_tmpVar = load i16, i16* %tmpVar5, align 2 + %tmpVar5 = getelementptr inbounds [11 x i16], ptr %z, i32 0, i32 %tmpVar4 + %load_tmpVar = load i16, ptr %tmpVar5, align 2 %3 = sext i16 %load_tmpVar to i32 %tmpVar6 = add i32 %1, %3 - %__grandparent7 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0 - %a = getelementptr inbounds %grandparent, %grandparent* %__grandparent7, i32 0, i32 2 - %load_a = load i16, i16* %a, align 2 + %__grandparent7 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0 + %a = getelementptr inbounds nuw %grandparent, ptr %__grandparent7, i32 0, i32 2 + %load_a = load i16, ptr %a, align 2 %4 = sext i16 %load_a to i32 %tmpVar8 = sub i32 %tmpVar6, %4 %tmpVar9 = mul i32 1, %tmpVar8 %tmpVar10 = add i32 %tmpVar9, 0 - %tmpVar11 = getelementptr inbounds [6 x i16], [6 x i16]* %y, i32 0, i32 %tmpVar10 - store i16 20, i16* %tmpVar11, align 2 + %tmpVar11 = getelementptr inbounds [6 x i16], ptr %y, i32 0, i32 %tmpVar10 + store i16 20, ptr %tmpVar11, align 2 ret void } - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -1108,84 +1103,84 @@ fn this_in_method_call_chain() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, void (%FB_Test*)*, void (%FB_Test*)* } - %FB_Test = type { i32* } + %__vtable_FB_Test = type { ptr, ptr, ptr } + %FB_Test = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer @__FB_Test__init = unnamed_addr constant %FB_Test zeroinitializer @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 ret void } - define void @FB_Test__Step(%FB_Test* %0) { + define void @FB_Test__Step(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - call void @FB_Test__Increment(%FB_Test* %deref) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + call void @FB_Test__Increment(ptr %deref) ret void } - define void @FB_Test__Increment(%FB_Test* %0) { + define void @FB_Test__Increment(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 ret void } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %Step = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store void (%FB_Test*)* @FB_Test__Step, void (%FB_Test*)** %Step, align 8 - %deref2 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %Increment = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref2, i32 0, i32 2 - store void (%FB_Test*)* @FB_Test__Increment, void (%FB_Test*)** %Increment, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %Step = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__Step, ptr %Step, align 8 + %deref2 = load ptr, ptr %self, align 8 + %Increment = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref2, i32 0, i32 2 + store ptr @FB_Test__Increment, ptr %Increment, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1214,88 +1209,88 @@ fn this_in_method_and_body_in_function_block() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, i16 (%FB_Test*)* } - %FB_Test = type { i32*, i16 } + %__vtable_FB_Test = type { ptr, ptr } + %FB_Test = type { ptr, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer - @__FB_Test__init = unnamed_addr constant %FB_Test { i32* null, i16 5 } + @__FB_Test__init = unnamed_addr constant %FB_Test { ptr null, i16 5 } @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %val = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %val1 = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_val = load i16, i16* %val1, align 2 - store i16 %load_val, i16* %val, align 2 - %deref2 = load %FB_Test*, %FB_Test** %this, align 8 - %val3 = getelementptr inbounds %FB_Test, %FB_Test* %deref2, i32 0, i32 1 - %load_val4 = load i16, i16* %val, align 2 - store i16 %load_val4, i16* %val3, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 + %deref = load ptr, ptr %this, align 8 + %val1 = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_val = load i16, ptr %val1, align 2 + store i16 %load_val, ptr %val, align 2 + %deref2 = load ptr, ptr %this, align 8 + %val3 = getelementptr inbounds nuw %FB_Test, ptr %deref2, i32 0, i32 1 + %load_val4 = load i16, ptr %val, align 2 + store i16 %load_val4, ptr %val3, align 2 ret void } - define i16 @FB_Test__GetVal(%FB_Test* %0) { + define i16 @FB_Test__GetVal(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %val = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %FB_Test.GetVal = alloca i16, align 2 - store i16 0, i16* %FB_Test.GetVal, align 2 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %val1 = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_val = load i16, i16* %val1, align 2 - store i16 %load_val, i16* %FB_Test.GetVal, align 2 - %FB_Test__GetVal_ret = load i16, i16* %FB_Test.GetVal, align 2 + store i16 0, ptr %FB_Test.GetVal, align 2 + %deref = load ptr, ptr %this, align 8 + %val1 = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_val = load i16, ptr %val1, align 2 + store i16 %load_val, ptr %FB_Test.GetVal, align 2 + %FB_Test__GetVal_ret = load i16, ptr %FB_Test.GetVal, align 2 ret i16 %FB_Test__GetVal_ret } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %GetVal = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store i16 (%FB_Test*)* @FB_Test__GetVal, i16 (%FB_Test*)** %GetVal, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %GetVal = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__GetVal, ptr %GetVal, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1335,158 +1330,157 @@ fn pass_this_to_method() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, void (%FB_Test*)* } - %FB_Test = type { i32*, i16 } - %FB_Test2 = type { i32* } - %__vtable_FB_Test2 = type { void (%FB_Test2*)*, i16 (%FB_Test2*, %FB_Test*)* } + %__vtable_FB_Test = type { ptr, ptr } + %FB_Test = type { ptr, i16 } + %FB_Test2 = type { ptr } + %__vtable_FB_Test2 = type { ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer - @__FB_Test__init = unnamed_addr constant %FB_Test { i32* null, i16 5 } + @__FB_Test__init = unnamed_addr constant %FB_Test { ptr null, i16 5 } @__FB_Test2__init = unnamed_addr constant %FB_Test2 zeroinitializer @____vtable_FB_Test2__init = unnamed_addr constant %__vtable_FB_Test2 zeroinitializer @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer @__vtable_FB_Test2_instance = global %__vtable_FB_Test2 zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 ret void } - define void @FB_Test__foo(%FB_Test* %0) { + define void @FB_Test__foo(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %test = alloca %FB_Test2, align 8 %x1 = alloca i16, align 2 - %1 = bitcast %FB_Test2* %test to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%FB_Test2* @__FB_Test2__init to i8*), i64 ptrtoint (%FB_Test2* getelementptr (%FB_Test2, %FB_Test2* null, i32 1) to i64), i1 false) - store i16 0, i16* %x1, align 2 - call void @__init_fb_test2(%FB_Test2* %test) - call void @__user_init_FB_Test2(%FB_Test2* %test) - %2 = load %FB_Test*, %FB_Test** %this, align 8 - %call = call i16 @FB_Test2__bar(%FB_Test2* %test, %FB_Test* %2) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %test, ptr align 1 @__FB_Test2__init, i64 ptrtoint (ptr getelementptr (%FB_Test2, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %x1, align 2 + call void @__init_fb_test2(ptr %test) + call void @__user_init_FB_Test2(ptr %test) + %1 = load ptr, ptr %this, align 8 + %call = call i16 @FB_Test2__bar(ptr %test, ptr %1) ret void } - define void @FB_Test2(%FB_Test2* %0) { + define void @FB_Test2(ptr %0) { entry: - %this = alloca %FB_Test2*, align 8 - store %FB_Test2* %0, %FB_Test2** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test2, %FB_Test2* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test2, ptr %0, i32 0, i32 0 ret void } - define i16 @FB_Test2__bar(%FB_Test2* %0, %FB_Test* %1) { + define i16 @FB_Test2__bar(ptr %0, ptr %1) { entry: - %this = alloca %FB_Test2*, align 8 - store %FB_Test2* %0, %FB_Test2** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test2, %FB_Test2* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test2, ptr %0, i32 0, i32 0 %FB_Test2.bar = alloca i16, align 2 - %test = alloca %FB_Test*, align 8 - store %FB_Test* %1, %FB_Test** %test, align 8 - store i16 0, i16* %FB_Test2.bar, align 2 - %deref = load %FB_Test*, %FB_Test** %test, align 8 - %x = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %FB_Test2.bar, align 2 - %FB_Test2__bar_ret = load i16, i16* %FB_Test2.bar, align 2 + %test = alloca ptr, align 8 + store ptr %1, ptr %test, align 8 + store i16 0, ptr %FB_Test2.bar, align 2 + %deref = load ptr, ptr %test, align 8 + %x = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %FB_Test2.bar, align 2 + %FB_Test2__bar_ret = load i16, ptr %FB_Test2.bar, align 2 ret i16 %FB_Test2__bar_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %foo = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store void (%FB_Test*)* @FB_Test__foo, void (%FB_Test*)** %foo, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__foo, ptr %foo, align 8 ret void } - define void @__init___vtable_fb_test2(%__vtable_FB_Test2* %0) { + define void @__init___vtable_fb_test2(ptr %0) { entry: - %self = alloca %__vtable_FB_Test2*, align 8 - store %__vtable_FB_Test2* %0, %__vtable_FB_Test2** %self, align 8 - %deref = load %__vtable_FB_Test2*, %__vtable_FB_Test2** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test2, %__vtable_FB_Test2* %deref, i32 0, i32 0 - store void (%FB_Test2*)* @FB_Test2, void (%FB_Test2*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test2*, %__vtable_FB_Test2** %self, align 8 - %bar = getelementptr inbounds %__vtable_FB_Test2, %__vtable_FB_Test2* %deref1, i32 0, i32 1 - store i16 (%FB_Test2*, %FB_Test*)* @FB_Test2__bar, i16 (%FB_Test2*, %FB_Test*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test2, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test2__bar, ptr %bar, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__init_fb_test2(%FB_Test2* %0) { + define void @__init_fb_test2(ptr %0) { entry: - %self = alloca %FB_Test2*, align 8 - store %FB_Test2* %0, %FB_Test2** %self, align 8 - %deref = load %FB_Test2*, %FB_Test2** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test2, %FB_Test2* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test2* @__vtable_FB_Test2_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test2, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test2_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_FB_Test2(%__vtable_FB_Test2* %0) { + define void @__user_init___vtable_FB_Test2(ptr %0) { entry: - %self = alloca %__vtable_FB_Test2*, align 8 - store %__vtable_FB_Test2* %0, %__vtable_FB_Test2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_FB_Test2(%FB_Test2* %0) { + define void @__user_init_FB_Test2(ptr %0) { entry: - %self = alloca %FB_Test2*, align 8 - store %FB_Test2* %0, %FB_Test2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__init___vtable_fb_test2(%__vtable_FB_Test2* @__vtable_FB_Test2_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test2(%__vtable_FB_Test2* @__vtable_FB_Test2_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test2(ptr @__vtable_FB_Test2_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test2(ptr @__vtable_FB_Test2_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1516,85 +1510,85 @@ fn this_with_shadowed_variable() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, void (%FB_Test*)* } - %FB_Test = type { i32*, i16 } + %__vtable_FB_Test = type { ptr, ptr } + %FB_Test = type { ptr, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer - @__FB_Test__init = unnamed_addr constant %FB_Test { i32* null, i16 5 } + @__FB_Test__init = unnamed_addr constant %FB_Test { ptr null, i16 5 } @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %val = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 ret void } - define void @FB_Test__shadow_val(%FB_Test* %0) { + define void @FB_Test__shadow_val(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %val = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %val1 = alloca i16, align 2 %local_val = alloca i16, align 2 %shadow_val = alloca i16, align 2 - store i16 10, i16* %val1, align 2 - store i16 0, i16* %local_val, align 2 - store i16 0, i16* %shadow_val, align 2 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %val2 = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_val = load i16, i16* %val2, align 2 - store i16 %load_val, i16* %local_val, align 2 - %load_val3 = load i16, i16* %val1, align 2 - store i16 %load_val3, i16* %shadow_val, align 2 + store i16 10, ptr %val1, align 2 + store i16 0, ptr %local_val, align 2 + store i16 0, ptr %shadow_val, align 2 + %deref = load ptr, ptr %this, align 8 + %val2 = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_val = load i16, ptr %val2, align 2 + store i16 %load_val, ptr %local_val, align 2 + %load_val3 = load i16, ptr %val1, align 2 + store i16 %load_val3, ptr %shadow_val, align 2 ret void } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %shadow_val = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store void (%FB_Test*)* @FB_Test__shadow_val, void (%FB_Test*)** %shadow_val, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %shadow_val = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__shadow_val, ptr %shadow_val, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1624,77 +1618,77 @@ fn this_calling_function_and_passing_this() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)* } - %FB_Test = type { i32*, i16 } + %__vtable_FB_Test = type { ptr } + %FB_Test = type { ptr, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer @__FB_Test__init = unnamed_addr constant %FB_Test zeroinitializer @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 - %1 = load %FB_Test*, %FB_Test** %this, align 8 - %call = call i16 @foo(%FB_Test* %1) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 + %1 = load ptr, ptr %this, align 8 + %call = call i16 @foo(ptr %1) ret void } - define i16 @foo(%FB_Test* %0) { + define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 - %pfb = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %pfb, align 8 - store i16 0, i16* %foo, align 2 - %deref = load %FB_Test*, %FB_Test** %pfb, align 8 - %x = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %pfb = alloca ptr, align 8 + store ptr %0, ptr %pfb, align 8 + store i16 0, ptr %foo, align 2 + %deref = load ptr, ptr %pfb, align 8 + %x = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1730,123 +1724,123 @@ fn this_in_property_and_calling_method() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, i16 (%FB_Test*)*, i16 (%FB_Test*)*, void (%FB_Test*, i16)* } - %FB_Test = type { i32*, i16 } + %__vtable_FB_Test = type { ptr, ptr, ptr, ptr } + %FB_Test = type { ptr, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer @__FB_Test__init = unnamed_addr constant %FB_Test zeroinitializer @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 ret void } - define i16 @FB_Test__DoubleX(%FB_Test* %0) { + define i16 @FB_Test__DoubleX(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %FB_Test.DoubleX = alloca i16, align 2 - store i16 0, i16* %FB_Test.DoubleX, align 2 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %x1 = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_x = load i16, i16* %x1, align 2 + store i16 0, ptr %FB_Test.DoubleX, align 2 + %deref = load ptr, ptr %this, align 8 + %x1 = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_x = load i16, ptr %x1, align 2 %1 = sext i16 %load_x to i32 %tmpVar = mul i32 2, %1 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %FB_Test.DoubleX, align 2 - %FB_Test__DoubleX_ret = load i16, i16* %FB_Test.DoubleX, align 2 + store i16 %2, ptr %FB_Test.DoubleX, align 2 + %FB_Test__DoubleX_ret = load i16, ptr %FB_Test.DoubleX, align 2 ret i16 %FB_Test__DoubleX_ret } - define i16 @FB_Test____get_Value(%FB_Test* %0) { + define i16 @FB_Test____get_Value(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %FB_Test.__get_Value = alloca i16, align 2 %Value = alloca i16, align 2 - store i16 0, i16* %Value, align 2 - store i16 0, i16* %FB_Test.__get_Value, align 2 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %call = call i16 @FB_Test__DoubleX(%FB_Test* %deref) - store i16 %call, i16* %Value, align 2 - %load_Value = load i16, i16* %Value, align 2 - store i16 %load_Value, i16* %FB_Test.__get_Value, align 2 - %FB_Test____get_Value_ret = load i16, i16* %FB_Test.__get_Value, align 2 + store i16 0, ptr %Value, align 2 + store i16 0, ptr %FB_Test.__get_Value, align 2 + %deref = load ptr, ptr %this, align 8 + %call = call i16 @FB_Test__DoubleX(ptr %deref) + store i16 %call, ptr %Value, align 2 + %load_Value = load i16, ptr %Value, align 2 + store i16 %load_Value, ptr %FB_Test.__get_Value, align 2 + %FB_Test____get_Value_ret = load i16, ptr %FB_Test.__get_Value, align 2 ret i16 %FB_Test____get_Value_ret } - define void @FB_Test____set_Value(%FB_Test* %0, i16 %1) { + define void @FB_Test____set_Value(ptr %0, i16 %1) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 %Value = alloca i16, align 2 - store i16 %1, i16* %Value, align 2 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - %x1 = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 1 - %load_Value = load i16, i16* %Value, align 2 - store i16 %load_Value, i16* %x1, align 2 + store i16 %1, ptr %Value, align 2 + %deref = load ptr, ptr %this, align 8 + %x1 = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 1 + %load_Value = load i16, ptr %Value, align 2 + store i16 %load_Value, ptr %x1, align 2 ret void } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %DoubleX = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store i16 (%FB_Test*)* @FB_Test__DoubleX, i16 (%FB_Test*)** %DoubleX, align 8 - %deref2 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__get_Value = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref2, i32 0, i32 2 - store i16 (%FB_Test*)* @FB_Test____get_Value, i16 (%FB_Test*)** %__get_Value, align 8 - %deref3 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__set_Value = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref3, i32 0, i32 3 - store void (%FB_Test*, i16)* @FB_Test____set_Value, void (%FB_Test*, i16)** %__set_Value, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %DoubleX = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__DoubleX, ptr %DoubleX, align 8 + %deref2 = load ptr, ptr %self, align 8 + %__get_Value = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref2, i32 0, i32 2 + store ptr @FB_Test____get_Value, ptr %__get_Value, align 8 + %deref3 = load ptr, ptr %self, align 8 + %__set_Value = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref3, i32 0, i32 3 + store ptr @FB_Test____set_Value, ptr %__set_Value, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1875,79 +1869,79 @@ fn this_with_self_pointer() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB_Test = type { void (%FB_Test*)*, void (%FB_Test*)* } - %FB_Test = type { i32*, %FB_Test* } + %__vtable_FB_Test = type { ptr, ptr } + %FB_Test = type { ptr, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB_Test__init = unnamed_addr constant %__vtable_FB_Test zeroinitializer @__FB_Test__init = unnamed_addr constant %FB_Test zeroinitializer @__vtable_FB_Test_instance = global %__vtable_FB_Test zeroinitializer - define void @FB_Test(%FB_Test* %0) { + define void @FB_Test(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %refToSelf = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %refToSelf = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 ret void } - define void @FB_Test__InitRef(%FB_Test* %0) { + define void @FB_Test__InitRef(ptr %0) { entry: - %this = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %this, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 0 - %refToSelf = getelementptr inbounds %FB_Test, %FB_Test* %0, i32 0, i32 1 - %deref = load %FB_Test*, %FB_Test** %this, align 8 - store %FB_Test* %deref, %FB_Test** %refToSelf, align 8 - %deref1 = load %FB_Test*, %FB_Test** %this, align 8 - store %FB_Test* %deref1, %FB_Test** %refToSelf, align 8 - %1 = load %FB_Test*, %FB_Test** %this, align 8 - store %FB_Test* %1, %FB_Test** %refToSelf, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 0 + %refToSelf = getelementptr inbounds nuw %FB_Test, ptr %0, i32 0, i32 1 + %deref = load ptr, ptr %this, align 8 + store ptr %deref, ptr %refToSelf, align 8 + %deref1 = load ptr, ptr %this, align 8 + store ptr %deref1, ptr %refToSelf, align 8 + %1 = load ptr, ptr %this, align 8 + store ptr %1, ptr %refToSelf, align 8 ret void } - define void @__init___vtable_fb_test(%__vtable_FB_Test* %0) { + define void @__init___vtable_fb_test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 - %deref = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref, i32 0, i32 0 - store void (%FB_Test*)* @FB_Test, void (%FB_Test*)** %__body, align 8 - %deref1 = load %__vtable_FB_Test*, %__vtable_FB_Test** %self, align 8 - %InitRef = getelementptr inbounds %__vtable_FB_Test, %__vtable_FB_Test* %deref1, i32 0, i32 1 - store void (%FB_Test*)* @FB_Test__InitRef, void (%FB_Test*)** %InitRef, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @FB_Test, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %InitRef = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref1, i32 0, i32 1 + store ptr @FB_Test__InitRef, ptr %InitRef, align 8 ret void } - define void @__init_fb_test(%FB_Test* %0) { + define void @__init_fb_test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 - %deref = load %FB_Test*, %FB_Test** %self, align 8 - %__vtable = getelementptr inbounds %FB_Test, %FB_Test* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB_Test* @__vtable_FB_Test_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %__vtable_FB_Test, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_Test_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB_Test(%FB_Test* %0) { + define void @__user_init_FB_Test(ptr %0) { entry: - %self = alloca %FB_Test*, align 8 - store %FB_Test* %0, %FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB_Test(%__vtable_FB_Test* %0) { + define void @__user_init___vtable_FB_Test(ptr %0) { entry: - %self = alloca %__vtable_FB_Test*, align 8 - store %__vtable_FB_Test* %0, %__vtable_FB_Test** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb_test(%__vtable_FB_Test* @__vtable_FB_Test_instance) - call void @__user_init___vtable_FB_Test(%__vtable_FB_Test* @__vtable_FB_Test_instance) + call void @__init___vtable_fb_test(ptr @__vtable_FB_Test_instance) + call void @__user_init___vtable_FB_Test(ptr @__vtable_FB_Test_instance) ret void } "#); @@ -1974,63 +1968,63 @@ fn this_in_variable_initialization() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_FB = type { void (%FB*)* } - %FB = type { i32*, i16, %FB*, i16 } + %__vtable_FB = type { ptr } + %FB = type { ptr, i16, ptr, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_FB__init = unnamed_addr constant %__vtable_FB zeroinitializer - @__FB__init = unnamed_addr constant %FB { i32* null, i16 5, %FB* null, i16 5 } + @__FB__init = unnamed_addr constant %FB { ptr null, i16 5, ptr null, i16 5 } @__vtable_FB_instance = global %__vtable_FB zeroinitializer - define void @FB(%FB* %0) { + define void @FB(ptr %0) { entry: - %this = alloca %FB*, align 8 - store %FB* %0, %FB** %this, align 8 - %__vtable = getelementptr inbounds %FB, %FB* %0, i32 0, i32 0 - %x = getelementptr inbounds %FB, %FB* %0, i32 0, i32 1 - %self = getelementptr inbounds %FB, %FB* %0, i32 0, i32 2 - %y = getelementptr inbounds %FB, %FB* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 1 + %self = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 2 + %y = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 3 ret void } - define void @__init___vtable_fb(%__vtable_FB* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_FB*, align 8 - store %__vtable_FB* %0, %__vtable_FB** %self, align 8 - %deref = load %__vtable_FB*, %__vtable_FB** %self, align 8 - %__body = getelementptr inbounds %__vtable_FB, %__vtable_FB* %deref, i32 0, i32 0 - store void (%FB*)* @FB, void (%FB*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_FB, ptr %deref, i32 0, i32 0 + store ptr @FB, ptr %__body, align 8 ret void } - define void @__init_fb(%FB* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %FB*, align 8 - store %FB* %0, %FB** %self, align 8 - %deref = load %FB*, %FB** %self, align 8 - %__vtable = getelementptr inbounds %FB, %FB* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_FB* @__vtable_FB_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %FB, ptr %deref, i32 0, i32 0 + store ptr @__vtable_FB_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_FB(%FB* %0) { + define void @__user_init_FB(ptr %0) { entry: - %self = alloca %FB*, align 8 - store %FB* %0, %FB** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_FB(%__vtable_FB* %0) { + define void @__user_init___vtable_FB(ptr %0) { entry: - %self = alloca %__vtable_FB*, align 8 - store %__vtable_FB* %0, %__vtable_FB** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_FB* @__vtable_FB_instance) - call void @__user_init___vtable_FB(%__vtable_FB* @__vtable_FB_instance) + call void @__init___vtable_fb(ptr @__vtable_FB_instance) + call void @__user_init___vtable_FB(ptr @__vtable_FB_instance) ret void } "#); @@ -2054,70 +2048,70 @@ fn this_in_action_in_functionblock() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_fb = type { void (%fb*)* } - %fb = type { i32* } + %__vtable_fb = type { ptr } + %fb = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_fb__init = unnamed_addr constant %__vtable_fb zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer @__vtable_fb_instance = global %__vtable_fb zeroinitializer - define void @fb(%fb* %0) { + define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } - define void @fb__foo(%fb* %0) { + define void @fb__foo(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 - %deref = load %fb*, %fb** %this, align 8 - call void @fb(%fb* %deref) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + call void @fb(ptr %deref) ret void } - define void @__init___vtable_fb(%__vtable_fb* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 - %deref = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref, i32 0, i32 0 - store void (%fb*)* @fb, void (%fb*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb, ptr %__body, align 8 ret void } - define void @__init_fb(%fb* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 - %deref = load %fb*, %fb** %self, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_fb* @__vtable_fb_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @__vtable_fb_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_fb(%fb* %0) { + define void @__user_init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_fb(%__vtable_fb* %0) { + define void @__user_init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__user_init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) + call void @__init___vtable_fb(ptr @__vtable_fb_instance) + call void @__user_init___vtable_fb(ptr @__vtable_fb_instance) ret void } "#); @@ -2140,76 +2134,76 @@ fn this_calling_functionblock_body_from_method() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_fb = type { void (%fb*)*, i16 (%fb*)* } - %fb = type { i32* } + %__vtable_fb = type { ptr, ptr } + %fb = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_fb__init = unnamed_addr constant %__vtable_fb zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer @__vtable_fb_instance = global %__vtable_fb zeroinitializer - define void @fb(%fb* %0) { + define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } - define i16 @fb__foo(%fb* %0) { + define i16 @fb__foo(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 %fb.foo = alloca i16, align 2 - store i16 0, i16* %fb.foo, align 2 - %deref = load %fb*, %fb** %this, align 8 - call void @fb(%fb* %deref) - %fb__foo_ret = load i16, i16* %fb.foo, align 2 + store i16 0, ptr %fb.foo, align 2 + %deref = load ptr, ptr %this, align 8 + call void @fb(ptr %deref) + %fb__foo_ret = load i16, ptr %fb.foo, align 2 ret i16 %fb__foo_ret } - define void @__init___vtable_fb(%__vtable_fb* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 - %deref = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref, i32 0, i32 0 - store void (%fb*)* @fb, void (%fb*)** %__body, align 8 - %deref1 = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %foo = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref1, i32 0, i32 1 - store i16 (%fb*)* @fb__foo, i16 (%fb*)** %foo, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_fb, ptr %deref1, i32 0, i32 1 + store ptr @fb__foo, ptr %foo, align 8 ret void } - define void @__init_fb(%fb* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 - %deref = load %fb*, %fb** %self, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_fb* @__vtable_fb_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %deref, i32 0, i32 0 + store ptr @__vtable_fb_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_fb(%fb* %0) { + define void @__user_init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_fb(%__vtable_fb* %0) { + define void @__user_init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__user_init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) + call void @__init___vtable_fb(ptr @__vtable_fb_instance) + call void @__user_init___vtable_fb(ptr @__vtable_fb_instance) ret void } "#); @@ -2244,12 +2238,12 @@ fn fb_extension_with_output() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, i16 (%foo*, i16, i16, i16*)* } - %foo = type { i32* } - %__vtable_foo2 = type { void (%foo2*)*, i16 (%foo*, i16, i16, i16*)* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } + %__vtable_foo2 = type { ptr, ptr } %foo2 = type { %foo } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -2257,137 +2251,135 @@ fn fb_extension_with_output() { @__foo2__init = unnamed_addr constant %foo2 zeroinitializer @__vtable_foo2_instance = global %__vtable_foo2 zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define i16 @foo__met1(%foo* %0, i16 %1, i16 %2, i16* %3) { + define i16 @foo__met1(ptr %0, i16 %1, i16 %2, ptr %3) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.met1 = alloca i16, align 2 %mandatoryInput = alloca i16, align 2 - store i16 %1, i16* %mandatoryInput, align 2 + store i16 %1, ptr %mandatoryInput, align 2 %optionalInput = alloca i16, align 2 - store i16 %2, i16* %optionalInput, align 2 - %outputValue = alloca i16*, align 8 - store i16* %3, i16** %outputValue, align 8 - store i16 0, i16* %foo.met1, align 2 - %foo__met1_ret = load i16, i16* %foo.met1, align 2 + store i16 %2, ptr %optionalInput, align 2 + %outputValue = alloca ptr, align 8 + store ptr %3, ptr %outputValue, align 8 + store i16 0, ptr %foo.met1, align 2 + %foo__met1_ret = load i16, ptr %foo.met1, align 2 ret i16 %foo__met1_ret } - define void @foo2(%foo2* %0) { - entry: - %this = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %this, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %0, i32 0, i32 0 - %deref = load %foo2*, %foo2** %this, align 8 - %__foo1 = getelementptr inbounds %foo2, %foo2* %deref, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo1, i32 0, i32 0 - %deref2 = load i32*, i32** %__vtable, align 8 - %cast = bitcast i32* %deref2 to %__vtable_foo2* - %met1 = getelementptr inbounds %__vtable_foo2, %__vtable_foo2* %cast, i32 0, i32 1 - %1 = load i16 (%foo*, i16, i16, i16*)*, i16 (%foo*, i16, i16, i16*)** %met1, align 8 - %deref3 = load %foo2*, %foo2** %this, align 8 - %cast4 = bitcast %foo2* %deref3 to %foo* + define void @foo2(ptr %0) { + entry: + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + %__foo1 = getelementptr inbounds nuw %foo2, ptr %deref, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo1, i32 0, i32 0 + %deref2 = load ptr, ptr %__vtable, align 8 + %met1 = getelementptr inbounds nuw %__vtable_foo2, ptr %deref2, i32 0, i32 1 + %1 = load ptr, ptr %met1, align 8 + %deref3 = load ptr, ptr %this, align 8 %2 = alloca i16, align 2 - %fnptr_call = call i16 %1(%foo* %cast4, i16 0, i16 0, i16* %2) + %fnptr_call = call i16 %1(ptr %deref3, i16 0, i16 0, ptr %2) ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %met1 = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store i16 (%foo*, i16, i16, i16*)* @foo__met1, i16 (%foo*, i16, i16, i16*)** %met1, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %met1 = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__met1, ptr %met1, align 8 ret void } - define void @__init___vtable_foo2(%__vtable_foo2* %0) { + define void @__init___vtable_foo2(ptr %0) { entry: - %self = alloca %__vtable_foo2*, align 8 - store %__vtable_foo2* %0, %__vtable_foo2** %self, align 8 - %deref = load %__vtable_foo2*, %__vtable_foo2** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo2, %__vtable_foo2* %deref, i32 0, i32 0 - store void (%foo2*)* @foo2, void (%foo2*)** %__body, align 8 - %deref1 = load %__vtable_foo2*, %__vtable_foo2** %self, align 8 - %met1 = getelementptr inbounds %__vtable_foo2, %__vtable_foo2* %deref1, i32 0, i32 1 - store i16 (%foo*, i16, i16, i16*)* @foo__met1, i16 (%foo*, i16, i16, i16*)** %met1, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo2, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %met1 = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__met1, ptr %met1, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo2(%foo2* %0) { + define void @__init_foo2(ptr %0) { entry: - %self = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %self, align 8 - %deref = load %foo2*, %foo2** %self, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %foo2*, %foo2** %self, align 8 - %__foo2 = getelementptr inbounds %foo2, %foo2* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_foo2* @__vtable_foo2_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %foo2, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_foo2_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_foo2(%foo2* %0) { + define void @__user_init_foo2(ptr %0) { entry: - %self = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %self, align 8 - %deref = load %foo2*, %foo2** %self, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo2(%__vtable_foo2* %0) { + define void @__user_init___vtable_foo2(ptr %0) { entry: - %self = alloca %__vtable_foo2*, align 8 - store %__vtable_foo2* %0, %__vtable_foo2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_foo2(%__vtable_foo2* @__vtable_foo2_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo2(%__vtable_foo2* @__vtable_foo2_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_foo2(ptr @__vtable_foo2_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo2(ptr @__vtable_foo2_instance) ret void } "#); @@ -2435,12 +2427,12 @@ fn function_with_output_used_in_main_by_extension() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, i16 (%foo*, i16, i16, i16*)* } - %foo = type { i32* } - %__vtable_foo2 = type { void (%foo2*)*, i16 (%foo*, i16, i16, i16*)* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } + %__vtable_foo2 = type { ptr, ptr } %foo2 = type { %foo, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -2448,45 +2440,45 @@ fn function_with_output_used_in_main_by_extension() { @__foo2__init = unnamed_addr constant %foo2 zeroinitializer @__vtable_foo2_instance = global %__vtable_foo2 zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define i16 @foo__met1(%foo* %0, i16 %1, i16 %2, i16* %3) { + define i16 @foo__met1(ptr %0, i16 %1, i16 %2, ptr %3) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %foo.met1 = alloca i16, align 2 %mandatoryInput = alloca i16, align 2 - store i16 %1, i16* %mandatoryInput, align 2 + store i16 %1, ptr %mandatoryInput, align 2 %optionalInput = alloca i16, align 2 - store i16 %2, i16* %optionalInput, align 2 - %outputValue = alloca i16*, align 8 - store i16* %3, i16** %outputValue, align 8 - store i16 0, i16* %foo.met1, align 2 - %deref = load i16*, i16** %outputValue, align 8 - %load_mandatoryInput = load i16, i16* %mandatoryInput, align 2 + store i16 %2, ptr %optionalInput, align 2 + %outputValue = alloca ptr, align 8 + store ptr %3, ptr %outputValue, align 8 + store i16 0, ptr %foo.met1, align 2 + %deref = load ptr, ptr %outputValue, align 8 + %load_mandatoryInput = load i16, ptr %mandatoryInput, align 2 %4 = sext i16 %load_mandatoryInput to i32 - %load_optionalInput = load i16, i16* %optionalInput, align 2 + %load_optionalInput = load i16, ptr %optionalInput, align 2 %5 = sext i16 %load_optionalInput to i32 %tmpVar = add i32 %4, %5 %6 = trunc i32 %tmpVar to i16 - store i16 %6, i16* %deref, align 2 - %foo__met1_ret = load i16, i16* %foo.met1, align 2 + store i16 %6, ptr %deref, align 2 + %foo__met1_ret = load i16, ptr %foo.met1, align 2 ret i16 %foo__met1_ret } - define void @foo2(%foo2* %0) { + define void @foo2(ptr %0) { entry: - %this = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %this, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo2, %foo2* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo2, ptr %0, i32 0, i32 1 ret void } @@ -2496,116 +2488,114 @@ fn function_with_output_used_in_main_by_extension() { %foo_inst = alloca %foo, align 8 %foo2_inst = alloca %foo2, align 8 %out = alloca i16, align 2 - %0 = bitcast %foo* %foo_inst to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - %1 = bitcast %foo2* %foo2_inst to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%foo2* @__foo2__init to i8*), i64 ptrtoint (%foo2* getelementptr (%foo2, %foo2* null, i32 1) to i64), i1 false) - store i16 0, i16* %out, align 2 - store i32 0, i32* %main, align 4 - call void @__init_foo(%foo* %foo_inst) - call void @__init_foo2(%foo2* %foo2_inst) - call void @__user_init_foo(%foo* %foo_inst) - call void @__user_init_foo2(%foo2* %foo2_inst) - %call = call i16 @foo__met1(%foo* %foo_inst, i16 1, i16 5, i16* %out) - %__foo = getelementptr inbounds %foo2, %foo2* %foo2_inst, i32 0, i32 0 - %call1 = call i16 @foo__met1(%foo* %__foo, i16 2, i16 5, i16* %out) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %foo_inst, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %foo2_inst, ptr align 1 @__foo2__init, i64 ptrtoint (ptr getelementptr (%foo2, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %out, align 2 + store i32 0, ptr %main, align 4 + call void @__init_foo(ptr %foo_inst) + call void @__init_foo2(ptr %foo2_inst) + call void @__user_init_foo(ptr %foo_inst) + call void @__user_init_foo2(ptr %foo2_inst) + %call = call i16 @foo__met1(ptr %foo_inst, i16 1, i16 5, ptr %out) + %__foo = getelementptr inbounds nuw %foo2, ptr %foo2_inst, i32 0, i32 0 + %call1 = call i16 @foo__met1(ptr %__foo, i16 2, i16 5, ptr %out) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %met1 = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store i16 (%foo*, i16, i16, i16*)* @foo__met1, i16 (%foo*, i16, i16, i16*)** %met1, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %met1 = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__met1, ptr %met1, align 8 ret void } - define void @__init___vtable_foo2(%__vtable_foo2* %0) { + define void @__init___vtable_foo2(ptr %0) { entry: - %self = alloca %__vtable_foo2*, align 8 - store %__vtable_foo2* %0, %__vtable_foo2** %self, align 8 - %deref = load %__vtable_foo2*, %__vtable_foo2** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo2, %__vtable_foo2* %deref, i32 0, i32 0 - store void (%foo2*)* @foo2, void (%foo2*)** %__body, align 8 - %deref1 = load %__vtable_foo2*, %__vtable_foo2** %self, align 8 - %met1 = getelementptr inbounds %__vtable_foo2, %__vtable_foo2* %deref1, i32 0, i32 1 - store i16 (%foo*, i16, i16, i16*)* @foo__met1, i16 (%foo*, i16, i16, i16*)** %met1, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo2, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %met1 = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__met1, ptr %met1, align 8 ret void } - define void @__init_foo2(%foo2* %0) { + define void @__init_foo2(ptr %0) { entry: - %self = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %self, align 8 - %deref = load %foo2*, %foo2** %self, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %foo2*, %foo2** %self, align 8 - %__foo2 = getelementptr inbounds %foo2, %foo2* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_foo2* @__vtable_foo2_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %foo2, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_foo2_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_foo2(%foo2* %0) { + define void @__user_init_foo2(ptr %0) { entry: - %self = alloca %foo2*, align 8 - store %foo2* %0, %foo2** %self, align 8 - %deref = load %foo2*, %foo2** %self, align 8 - %__foo = getelementptr inbounds %foo2, %foo2* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %foo2, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo2(%__vtable_foo2* %0) { + define void @__user_init___vtable_foo2(ptr %0) { entry: - %self = alloca %__vtable_foo2*, align 8 - store %__vtable_foo2* %0, %__vtable_foo2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_foo2(%__vtable_foo2* @__vtable_foo2_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo2(%__vtable_foo2* @__vtable_foo2_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_foo2(ptr @__vtable_foo2_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo2(ptr @__vtable_foo2_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } diff --git a/src/codegen/tests/oop_tests/debug_tests.rs b/src/codegen/tests/oop_tests/debug_tests.rs index 71235a31b43..0b5a75acf09 100644 --- a/src/codegen/tests/oop_tests/debug_tests.rs +++ b/src/codegen/tests/oop_tests/debug_tests.rs @@ -23,12 +23,12 @@ fn members_from_base_class_are_available_in_subclasses() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, i16, [81 x i8], [11 x [81 x i8]] } - %__vtable_bar = type { void (%bar*)* } + %__vtable_foo = type { ptr } + %foo = type { ptr, i16, [81 x i8], [11 x [81 x i8]] } + %__vtable_bar = type { ptr } %bar = type { %foo } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer, !dbg !0 @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -36,116 +36,111 @@ fn members_from_base_class_are_available_in_subclasses() { @__bar__init = unnamed_addr constant %bar zeroinitializer, !dbg !22 @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) !dbg !32 { + define void @foo(ptr %0) !dbg !32 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !36, metadata !DIExpression()), !dbg !37 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %a = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %b = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - %c = getelementptr inbounds %foo, %foo* %0, i32 0, i32 3 + #dbg_declare(ptr %0, !36, !DIExpression(), !37) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + %c = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 3 ret void, !dbg !37 } - define void @bar(%bar* %0) !dbg !38 { + define void @bar(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %bar* %0, metadata !41, metadata !DIExpression()), !dbg !42 - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__foo = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !41, !DIExpression(), !42) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 ret void, !dbg !42 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %bar*, %bar** %self, align 8 - %__foo2 = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!28, !29} !llvm.dbg.cu = !{!30} @@ -224,14 +219,14 @@ fn write_to_parent_variable_qualified_access() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_fb = type { void (%fb*)* } - %fb = type { i32*, i16, i16 } - %__vtable_fb2 = type { void (%fb2*)* } + %__vtable_fb = type { ptr } + %fb = type { ptr, i16, i16 } + %__vtable_fb2 = type { ptr } %fb2 = type { %fb } - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, %fb2 } + %__vtable_foo = type { ptr } + %foo = type { ptr, %fb2 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_fb__init = unnamed_addr constant %__vtable_fb zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer, !dbg !0 @__vtable_fb_instance = global %__vtable_fb zeroinitializer @@ -242,170 +237,165 @@ fn write_to_parent_variable_qualified_access() { @__foo__init = unnamed_addr constant %foo zeroinitializer, !dbg !19 @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @fb(%fb* %0) !dbg !32 { + define void @fb(ptr %0) !dbg !32 { entry: - call void @llvm.dbg.declare(metadata %fb* %0, metadata !36, metadata !DIExpression()), !dbg !37 - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 1 - %y = getelementptr inbounds %fb, %fb* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !36, !DIExpression(), !37) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 2 ret void, !dbg !37 } - define void @fb2(%fb2* %0) !dbg !38 { + define void @fb2(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %fb2* %0, metadata !41, metadata !DIExpression()), !dbg !42 - %this = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %this, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !41, !DIExpression(), !42) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %0, i32 0, i32 0 ret void, !dbg !42 } - define void @foo(%foo* %0) !dbg !43 { + define void @foo(ptr %0) !dbg !43 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !46, metadata !DIExpression()), !dbg !47 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %myFb = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %__fb = getelementptr inbounds %fb2, %fb2* %myFb, i32 0, i32 0, !dbg !47 - %x = getelementptr inbounds %fb, %fb* %__fb, i32 0, i32 1, !dbg !47 - store i16 1, i16* %x, align 2, !dbg !47 + #dbg_declare(ptr %0, !46, !DIExpression(), !47) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %myFb = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %__fb = getelementptr inbounds nuw %fb2, ptr %myFb, i32 0, i32 0, !dbg !47 + %x = getelementptr inbounds nuw %fb, ptr %__fb, i32 0, i32 1, !dbg !47 + store i16 1, ptr %x, align 2, !dbg !47 ret void, !dbg !48 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init___vtable_fb(%__vtable_fb* %0) { + define void @__init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 - %deref = load %__vtable_fb*, %__vtable_fb** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb, %__vtable_fb* %deref, i32 0, i32 0 - store void (%fb*)* @fb, void (%fb*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb, ptr %__body, align 8 ret void } - define void @__init___vtable_fb2(%__vtable_fb2* %0) { + define void @__init___vtable_fb2(ptr %0) { entry: - %self = alloca %__vtable_fb2*, align 8 - store %__vtable_fb2* %0, %__vtable_fb2** %self, align 8 - %deref = load %__vtable_fb2*, %__vtable_fb2** %self, align 8 - %__body = getelementptr inbounds %__vtable_fb2, %__vtable_fb2* %deref, i32 0, i32 0 - store void (%fb2*)* @fb2, void (%fb2*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @fb2, ptr %__body, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_fb, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_fb2(%fb2* %0) { + define void @__init_fb2(ptr %0) { entry: - %self = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %self, align 8 - %deref = load %fb2*, %fb2** %self, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %deref, i32 0, i32 0 - call void @__init_fb(%fb* %__fb) - %deref1 = load %fb2*, %fb2** %self, align 8 - %__fb2 = getelementptr inbounds %fb2, %fb2* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %fb, %fb* %__fb2, i32 0, i32 0 - store i32* bitcast (%__vtable_fb2* @__vtable_fb2_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %deref, i32 0, i32 0 + call void @__init_fb(ptr %__fb) + %deref1 = load ptr, ptr %self, align 8 + %__fb2 = getelementptr inbounds nuw %fb2, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %fb, ptr %__fb2, i32 0, i32 0 + store ptr @__vtable_fb2_instance, ptr %__vtable, align 8 ret void } - define void @__init_fb(%fb* %0) { + define void @__init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 - %deref = load %fb*, %fb** %self, align 8 - %__vtable = getelementptr inbounds %fb, %fb* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_fb* @__vtable_fb_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %fb, ptr %deref, i32 0, i32 0 + store ptr @__vtable_fb_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %myFb = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 1 - call void @__init_fb2(%fb2* %myFb) - %deref1 = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %myFb = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 1 + call void @__init_fb2(ptr %myFb) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_fb(%fb* %0) { + define void @__user_init_fb(ptr %0) { entry: - %self = alloca %fb*, align 8 - store %fb* %0, %fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_fb2(%fb2* %0) { + define void @__user_init_fb2(ptr %0) { entry: - %self = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %self, align 8 - %deref = load %fb2*, %fb2** %self, align 8 - %__fb = getelementptr inbounds %fb2, %fb2* %deref, i32 0, i32 0 - call void @__user_init_fb(%fb* %__fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__fb = getelementptr inbounds nuw %fb2, ptr %deref, i32 0, i32 0 + call void @__user_init_fb(ptr %__fb) ret void } - define void @__user_init___vtable_fb(%__vtable_fb* %0) { + define void @__user_init___vtable_fb(ptr %0) { entry: - %self = alloca %__vtable_fb*, align 8 - store %__vtable_fb* %0, %__vtable_fb** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_fb2(%__vtable_fb2* %0) { + define void @__user_init___vtable_fb2(ptr %0) { entry: - %self = alloca %__vtable_fb2*, align 8 - store %__vtable_fb2* %0, %__vtable_fb2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %myFb = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 1 - call void @__user_init_fb2(%fb2* %myFb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %myFb = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 1 + call void @__user_init_fb2(ptr %myFb) ret void } define void @__init___Test() { entry: - call void @__init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__init___vtable_fb2(%__vtable_fb2* @__vtable_fb2_instance) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_fb(%__vtable_fb* @__vtable_fb_instance) - call void @__user_init___vtable_fb2(%__vtable_fb2* @__vtable_fb2_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_fb(ptr @__vtable_fb_instance) + call void @__init___vtable_fb2(ptr @__vtable_fb2_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_fb(ptr @__vtable_fb_instance) + call void @__user_init___vtable_fb2(ptr @__vtable_fb2_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!28, !29} !llvm.dbg.cu = !{!30} @@ -494,14 +484,14 @@ fn write_to_parent_variable_in_instance() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32*, [81 x i8] } - %__vtable_bar = type { void (%bar*)*, void (%foo*)* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr, [81 x i8] } + %__vtable_bar = type { ptr, ptr } %bar = type { %foo } @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"world\00" - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer, !dbg !0 @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -509,37 +499,35 @@ fn write_to_parent_variable_in_instance() { @__bar__init = unnamed_addr constant %bar zeroinitializer, !dbg !16 @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) !dbg !26 { + define void @foo(ptr %0) !dbg !26 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !30, metadata !DIExpression()), !dbg !31 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !30, !DIExpression(), !31) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void, !dbg !31 } - define void @foo__baz(%foo* %0) !dbg !32 { + define void @foo__baz(ptr %0) !dbg !32 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !33, metadata !DIExpression()), !dbg !34 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %s to i8*, !dbg !34 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false), !dbg !34 + #dbg_declare(ptr %0, !33, !DIExpression(), !34) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_0, i32 6, i1 false), !dbg !34 ret void, !dbg !35 } - define void @bar(%bar* %0) !dbg !36 { + define void @bar(ptr %0) !dbg !36 { entry: - call void @llvm.dbg.declare(metadata %bar* %0, metadata !39, metadata !DIExpression()), !dbg !40 - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__foo = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %__foo, i32 0, i32 1, !dbg !40 - %1 = bitcast [81 x i8]* %s to i8*, !dbg !40 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false), !dbg !40 + #dbg_declare(ptr %0, !39, !DIExpression(), !40) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %__foo, i32 0, i32 1, !dbg !40 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 @utf08_literal_1, i32 6, i1 false), !dbg !40 ret void, !dbg !41 } @@ -547,125 +535,119 @@ fn write_to_parent_variable_in_instance() { entry: %s = alloca [81 x i8], align 1 %fb = alloca %bar, align 8 - call void @llvm.dbg.declare(metadata [81 x i8]* %s, metadata !45, metadata !DIExpression()), !dbg !46 - %0 = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata %bar* %fb, metadata !47, metadata !DIExpression()), !dbg !48 - %1 = bitcast %bar* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%bar* @__bar__init to i8*), i64 ptrtoint (%bar* getelementptr (%bar, %bar* null, i32 1) to i64), i1 false) - call void @__init_bar(%bar* %fb), !dbg !49 - call void @__user_init_bar(%bar* %fb), !dbg !49 - %__foo = getelementptr inbounds %bar, %bar* %fb, i32 0, i32 0, !dbg !49 - call void @foo__baz(%foo* %__foo), !dbg !50 - call void @bar(%bar* %fb), !dbg !51 + #dbg_declare(ptr %s, !45, !DIExpression(), !46) + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %fb, !47, !DIExpression(), !48) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__bar__init, i64 ptrtoint (ptr getelementptr (%bar, ptr null, i32 1) to i64), i1 false) + call void @__init_bar(ptr %fb), !dbg !49 + call void @__user_init_bar(ptr %fb), !dbg !49 + %__foo = getelementptr inbounds nuw %bar, ptr %fb, i32 0, i32 0, !dbg !49 + call void @foo__baz(ptr %__foo), !dbg !50 + call void @bar(ptr %fb), !dbg !51 ret void, !dbg !52 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %baz = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 - %deref1 = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %baz = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %bar*, %bar** %self, align 8 - %__foo2 = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn } - attributes #2 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } !llvm.module.flags = !{!22, !23} !llvm.dbg.cu = !{!24} @@ -768,14 +750,14 @@ fn array_in_parent_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)* } - %grandparent = type { i32*, [6 x i16], i16 } - %__vtable_parent = type { void (%parent*)* } + %__vtable_grandparent = type { ptr } + %grandparent = type { ptr, [6 x i16], i16 } + %__vtable_parent = type { ptr } %parent = type { %grandparent, [11 x i16], i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_child = type { ptr } %child = type { %parent, [11 x i16] } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer @__grandparent__init = unnamed_addr constant %grandparent zeroinitializer, !dbg !0 @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @@ -786,207 +768,202 @@ fn array_in_parent_generated() { @__child__init = unnamed_addr constant %child zeroinitializer, !dbg !27 @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) !dbg !38 { + define void @grandparent(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %grandparent* %0, metadata !42, metadata !DIExpression()), !dbg !43 - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 - %a = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !42, !DIExpression(), !43) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 + %a = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 2 ret void, !dbg !43 } - define void @parent(%parent* %0) !dbg !44 { + define void @parent(ptr %0) !dbg !44 { entry: - call void @llvm.dbg.declare(metadata %parent* %0, metadata !47, metadata !DIExpression()), !dbg !48 - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !47, !DIExpression(), !48) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void, !dbg !48 } - define void @child(%child* %0) !dbg !49 { + define void @child(ptr %0) !dbg !49 { entry: - call void @llvm.dbg.declare(metadata %child* %0, metadata !52, metadata !DIExpression()), !dbg !53 - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %z = getelementptr inbounds %child, %child* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !52, !DIExpression(), !53) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 ret void, !dbg !53 } define void @main() !dbg !54 { entry: %arr = alloca [11 x %child], align 8 - call void @llvm.dbg.declare(metadata [11 x %child]* %arr, metadata !57, metadata !DIExpression()), !dbg !59 - %0 = bitcast [11 x %child]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([11 x %child]* getelementptr ([11 x %child], [11 x %child]* null, i32 1) to i64), i1 false) - %tmpVar = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 0, !dbg !60 - %__parent = getelementptr inbounds %child, %child* %tmpVar, i32 0, i32 0, !dbg !60 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0, !dbg !60 - %a = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 2, !dbg !60 - store i16 10, i16* %a, align 2, !dbg !60 - %tmpVar1 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 0, !dbg !61 - %__parent2 = getelementptr inbounds %child, %child* %tmpVar1, i32 0, i32 0, !dbg !61 - %__grandparent3 = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0, !dbg !61 - %y = getelementptr inbounds %grandparent, %grandparent* %__grandparent3, i32 0, i32 1, !dbg !61 - %tmpVar4 = getelementptr inbounds [6 x i16], [6 x i16]* %y, i32 0, i32 0, !dbg !61 - store i16 20, i16* %tmpVar4, align 2, !dbg !61 - %tmpVar5 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 1, !dbg !62 - %__parent6 = getelementptr inbounds %child, %child* %tmpVar5, i32 0, i32 0, !dbg !62 - %b = getelementptr inbounds %parent, %parent* %__parent6, i32 0, i32 2, !dbg !62 - store i16 30, i16* %b, align 2, !dbg !62 - %tmpVar7 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 1, !dbg !63 - %__parent8 = getelementptr inbounds %child, %child* %tmpVar7, i32 0, i32 0, !dbg !63 - %x = getelementptr inbounds %parent, %parent* %__parent8, i32 0, i32 1, !dbg !63 - %tmpVar9 = getelementptr inbounds [11 x i16], [11 x i16]* %x, i32 0, i32 1, !dbg !63 - store i16 40, i16* %tmpVar9, align 2, !dbg !63 - %tmpVar10 = getelementptr inbounds [11 x %child], [11 x %child]* %arr, i32 0, i32 2, !dbg !64 - %z = getelementptr inbounds %child, %child* %tmpVar10, i32 0, i32 1, !dbg !64 - %tmpVar11 = getelementptr inbounds [11 x i16], [11 x i16]* %z, i32 0, i32 2, !dbg !64 - store i16 50, i16* %tmpVar11, align 2, !dbg !64 + #dbg_declare(ptr %arr, !57, !DIExpression(), !59) + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([11 x %child], ptr null, i32 1) to i64), i1 false) + %tmpVar = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 0, !dbg !60 + %__parent = getelementptr inbounds nuw %child, ptr %tmpVar, i32 0, i32 0, !dbg !60 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0, !dbg !60 + %a = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 2, !dbg !60 + store i16 10, ptr %a, align 2, !dbg !60 + %tmpVar1 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 0, !dbg !61 + %__parent2 = getelementptr inbounds nuw %child, ptr %tmpVar1, i32 0, i32 0, !dbg !61 + %__grandparent3 = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0, !dbg !61 + %y = getelementptr inbounds nuw %grandparent, ptr %__grandparent3, i32 0, i32 1, !dbg !61 + %tmpVar4 = getelementptr inbounds [6 x i16], ptr %y, i32 0, i32 0, !dbg !61 + store i16 20, ptr %tmpVar4, align 2, !dbg !61 + %tmpVar5 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 1, !dbg !62 + %__parent6 = getelementptr inbounds nuw %child, ptr %tmpVar5, i32 0, i32 0, !dbg !62 + %b = getelementptr inbounds nuw %parent, ptr %__parent6, i32 0, i32 2, !dbg !62 + store i16 30, ptr %b, align 2, !dbg !62 + %tmpVar7 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 1, !dbg !63 + %__parent8 = getelementptr inbounds nuw %child, ptr %tmpVar7, i32 0, i32 0, !dbg !63 + %x = getelementptr inbounds nuw %parent, ptr %__parent8, i32 0, i32 1, !dbg !63 + %tmpVar9 = getelementptr inbounds [11 x i16], ptr %x, i32 0, i32 1, !dbg !63 + store i16 40, ptr %tmpVar9, align 2, !dbg !63 + %tmpVar10 = getelementptr inbounds [11 x %child], ptr %arr, i32 0, i32 2, !dbg !64 + %z = getelementptr inbounds nuw %child, ptr %tmpVar10, i32 0, i32 1, !dbg !64 + %tmpVar11 = getelementptr inbounds [11 x i16], ptr %z, i32 0, i32 2, !dbg !64 + store i16 50, ptr %tmpVar11, align 2, !dbg !64 ret void, !dbg !65 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } !llvm.module.flags = !{!34, !35} !llvm.dbg.cu = !{!36} @@ -1093,14 +1070,14 @@ fn complex_array_access_generated() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)* } - %grandparent = type { i32*, [6 x i16], i16 } - %__vtable_parent = type { void (%parent*)* } + %__vtable_grandparent = type { ptr } + %grandparent = type { ptr, [6 x i16], i16 } + %__vtable_parent = type { ptr } %parent = type { %grandparent, [11 x i16], i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_child = type { ptr } %child = type { %parent, [11 x i16] } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer @__grandparent__init = unnamed_addr constant %grandparent zeroinitializer, !dbg !0 @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @@ -1111,195 +1088,190 @@ fn complex_array_access_generated() { @__child__init = unnamed_addr constant %child zeroinitializer, !dbg !27 @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) !dbg !38 { + define void @grandparent(ptr %0) !dbg !38 { entry: - call void @llvm.dbg.declare(metadata %grandparent* %0, metadata !42, metadata !DIExpression()), !dbg !43 - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %y = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 - %a = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !42, !DIExpression(), !43) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 + %a = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 2 ret void, !dbg !43 } - define void @parent(%parent* %0) !dbg !44 { + define void @parent(ptr %0) !dbg !44 { entry: - call void @llvm.dbg.declare(metadata %parent* %0, metadata !47, metadata !DIExpression()), !dbg !48 - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + #dbg_declare(ptr %0, !47, !DIExpression(), !48) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void, !dbg !48 } - define void @child(%child* %0) !dbg !49 { + define void @child(ptr %0) !dbg !49 { entry: - call void @llvm.dbg.declare(metadata %child* %0, metadata !52, metadata !DIExpression()), !dbg !53 - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %z = getelementptr inbounds %child, %child* %0, i32 0, i32 1 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0, !dbg !53 - %y = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 1, !dbg !53 - %b = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2, !dbg !53 - %load_b = load i16, i16* %b, align 2, !dbg !53 + #dbg_declare(ptr %0, !52, !DIExpression(), !53) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0, !dbg !53 + %y = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 1, !dbg !53 + %b = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2, !dbg !53 + %load_b = load i16, ptr %b, align 2, !dbg !53 %1 = sext i16 %load_b to i32, !dbg !53 - %b1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2, !dbg !53 - %load_b2 = load i16, i16* %b1, align 2, !dbg !53 + %b1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2, !dbg !53 + %load_b2 = load i16, ptr %b1, align 2, !dbg !53 %2 = sext i16 %load_b2 to i32, !dbg !53 %tmpVar = mul i32 %2, 2, !dbg !53 %tmpVar3 = mul i32 1, %tmpVar, !dbg !53 %tmpVar4 = add i32 %tmpVar3, 0, !dbg !53 - %tmpVar5 = getelementptr inbounds [11 x i16], [11 x i16]* %z, i32 0, i32 %tmpVar4, !dbg !53 - %load_tmpVar = load i16, i16* %tmpVar5, align 2, !dbg !53 + %tmpVar5 = getelementptr inbounds [11 x i16], ptr %z, i32 0, i32 %tmpVar4, !dbg !53 + %load_tmpVar = load i16, ptr %tmpVar5, align 2, !dbg !53 %3 = sext i16 %load_tmpVar to i32, !dbg !53 %tmpVar6 = add i32 %1, %3, !dbg !53 - %__grandparent7 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0, !dbg !53 - %a = getelementptr inbounds %grandparent, %grandparent* %__grandparent7, i32 0, i32 2, !dbg !53 - %load_a = load i16, i16* %a, align 2, !dbg !53 + %__grandparent7 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0, !dbg !53 + %a = getelementptr inbounds nuw %grandparent, ptr %__grandparent7, i32 0, i32 2, !dbg !53 + %load_a = load i16, ptr %a, align 2, !dbg !53 %4 = sext i16 %load_a to i32, !dbg !53 %tmpVar8 = sub i32 %tmpVar6, %4, !dbg !53 %tmpVar9 = mul i32 1, %tmpVar8, !dbg !53 %tmpVar10 = add i32 %tmpVar9, 0, !dbg !53 - %tmpVar11 = getelementptr inbounds [6 x i16], [6 x i16]* %y, i32 0, i32 %tmpVar10, !dbg !53 - store i16 20, i16* %tmpVar11, align 2, !dbg !53 + %tmpVar11 = getelementptr inbounds [6 x i16], ptr %y, i32 0, i32 %tmpVar10, !dbg !53 + store i16 20, ptr %tmpVar11, align 2, !dbg !53 ret void, !dbg !54 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!34, !35} !llvm.dbg.cu = !{!36} @@ -1380,12 +1352,12 @@ fn function_block_method_debug_info() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } - %__vtable_bar = type { void (%bar*)*, void (%foo*)* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } + %__vtable_bar = type { ptr, ptr } %bar = type { %foo } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer, !dbg !0 @__vtable_foo_instance = global %__vtable_foo zeroinitializer @@ -1393,128 +1365,123 @@ fn function_block_method_debug_info() { @__bar__init = unnamed_addr constant %bar zeroinitializer, !dbg !10 @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) !dbg !20 { + define void @foo(ptr %0) !dbg !20 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !24, metadata !DIExpression()), !dbg !25 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !24, !DIExpression(), !25) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void, !dbg !25 } - define void @foo__baz(%foo* %0) !dbg !26 { + define void @foo__baz(ptr %0) !dbg !26 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !27, metadata !DIExpression()), !dbg !28 - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !27, !DIExpression(), !28) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void, !dbg !28 } - define void @bar(%bar* %0) !dbg !29 { + define void @bar(ptr %0) !dbg !29 { entry: - call void @llvm.dbg.declare(metadata %bar* %0, metadata !32, metadata !DIExpression()), !dbg !33 - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__foo = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !32, !DIExpression(), !33) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 ret void, !dbg !33 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %baz = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 - %deref1 = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %baz = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__init_foo(%foo* %__foo) - %deref1 = load %bar*, %bar** %self, align 8 - %__foo2 = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %foo, %foo* %__foo2, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__init_foo(ptr %__foo) + %deref1 = load ptr, ptr %self, align 8 + %__foo2 = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %foo, ptr %__foo2, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %__foo = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 0 - call void @__user_init_foo(%foo* %__foo) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__foo = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 0 + call void @__user_init_foo(ptr %__foo) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!16, !17} !llvm.dbg.cu = !{!18} @@ -1623,14 +1590,14 @@ END_FUNCTION target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i32 } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i32 } + %__vtable_child = type { ptr } %child = type { %parent, i32 } - %__vtable_grandchild = type { void (%grandchild*)* } + %__vtable_grandchild = type { ptr } %grandchild = type { %child, i32 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer @__parent__init = unnamed_addr constant %parent zeroinitializer, !dbg !0 @__vtable_parent_instance = global %__vtable_parent zeroinitializer @@ -1641,33 +1608,33 @@ END_FUNCTION @__grandchild__init = unnamed_addr constant %grandchild zeroinitializer, !dbg !19 @__vtable_grandchild_instance = global %__vtable_grandchild zeroinitializer - define void @parent(%parent* %0) !dbg !30 { + define void @parent(ptr %0) !dbg !30 { entry: - call void @llvm.dbg.declare(metadata %parent* %0, metadata !34, metadata !DIExpression()), !dbg !35 - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %a = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !34, !DIExpression(), !35) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void, !dbg !35 } - define void @child(%child* %0) !dbg !36 { + define void @child(ptr %0) !dbg !36 { entry: - call void @llvm.dbg.declare(metadata %child* %0, metadata !39, metadata !DIExpression()), !dbg !40 - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %b = getelementptr inbounds %child, %child* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !39, !DIExpression(), !40) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 ret void, !dbg !40 } - define void @grandchild(%grandchild* %0) !dbg !41 { + define void @grandchild(ptr %0) !dbg !41 { entry: - call void @llvm.dbg.declare(metadata %grandchild* %0, metadata !44, metadata !DIExpression()), !dbg !45 - %this = alloca %grandchild*, align 8 - store %grandchild* %0, %grandchild** %this, align 8 - %__child = getelementptr inbounds %grandchild, %grandchild* %0, i32 0, i32 0 - %c = getelementptr inbounds %grandchild, %grandchild* %0, i32 0, i32 1 + #dbg_declare(ptr %0, !44, !DIExpression(), !45) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__child = getelementptr inbounds nuw %grandchild, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %grandchild, ptr %0, i32 0, i32 1 ret void, !dbg !45 } @@ -1680,258 +1647,248 @@ END_FUNCTION %parent1 = alloca %parent, align 8 %child1 = alloca %child, align 8 %grandchild1 = alloca %grandchild, align 8 - call void @llvm.dbg.declare(metadata [3 x %parent]* %array_of_parent, metadata !49, metadata !DIExpression()), !dbg !53 - %0 = bitcast [3 x %parent]* %array_of_parent to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([3 x %parent]* getelementptr ([3 x %parent], [3 x %parent]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata [3 x %child]* %array_of_child, metadata !54, metadata !DIExpression()), !dbg !56 - %1 = bitcast [3 x %child]* %array_of_child to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([3 x %child]* getelementptr ([3 x %child], [3 x %child]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata [3 x %grandchild]* %array_of_grandchild, metadata !57, metadata !DIExpression()), !dbg !59 - %2 = bitcast [3 x %grandchild]* %array_of_grandchild to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([3 x %grandchild]* getelementptr ([3 x %grandchild], [3 x %grandchild]* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata %parent* %parent1, metadata !60, metadata !DIExpression()), !dbg !61 - %3 = bitcast %parent* %parent1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 bitcast (%parent* @__parent__init to i8*), i64 ptrtoint (%parent* getelementptr (%parent, %parent* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata %child* %child1, metadata !62, metadata !DIExpression()), !dbg !63 - %4 = bitcast %child* %child1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %4, i8* align 1 bitcast (%child* @__child__init to i8*), i64 ptrtoint (%child* getelementptr (%child, %child* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata %grandchild* %grandchild1, metadata !64, metadata !DIExpression()), !dbg !65 - %5 = bitcast %grandchild* %grandchild1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 bitcast (%grandchild* @__grandchild__init to i8*), i64 ptrtoint (%grandchild* getelementptr (%grandchild, %grandchild* null, i32 1) to i64), i1 false) - call void @llvm.dbg.declare(metadata i32* %main, metadata !66, metadata !DIExpression()), !dbg !67 - store i32 0, i32* %main, align 4 - call void @__init_parent(%parent* %parent1), !dbg !68 - call void @__init_child(%child* %child1), !dbg !68 - call void @__init_grandchild(%grandchild* %grandchild1), !dbg !68 - call void @__user_init_parent(%parent* %parent1), !dbg !68 - call void @__user_init_child(%child* %child1), !dbg !68 - call void @__user_init_grandchild(%grandchild* %grandchild1), !dbg !68 - %a = getelementptr inbounds %parent, %parent* %parent1, i32 0, i32 1, !dbg !69 - store i32 1, i32* %a, align 4, !dbg !69 - %__parent = getelementptr inbounds %child, %child* %child1, i32 0, i32 0, !dbg !70 - %a1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1, !dbg !70 - store i32 2, i32* %a1, align 4, !dbg !70 - %b = getelementptr inbounds %child, %child* %child1, i32 0, i32 1, !dbg !71 - store i32 3, i32* %b, align 4, !dbg !71 - %__child = getelementptr inbounds %grandchild, %grandchild* %grandchild1, i32 0, i32 0, !dbg !72 - %__parent2 = getelementptr inbounds %child, %child* %__child, i32 0, i32 0, !dbg !72 - %a3 = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 1, !dbg !72 - store i32 4, i32* %a3, align 4, !dbg !72 - %__child4 = getelementptr inbounds %grandchild, %grandchild* %grandchild1, i32 0, i32 0, !dbg !73 - %b5 = getelementptr inbounds %child, %child* %__child4, i32 0, i32 1, !dbg !73 - store i32 5, i32* %b5, align 4, !dbg !73 - %c = getelementptr inbounds %grandchild, %grandchild* %grandchild1, i32 0, i32 1, !dbg !74 - store i32 6, i32* %c, align 4, !dbg !74 - %tmpVar = getelementptr inbounds [3 x %parent], [3 x %parent]* %array_of_parent, i32 0, i32 0, !dbg !75 - %a6 = getelementptr inbounds %parent, %parent* %tmpVar, i32 0, i32 1, !dbg !75 - store i32 7, i32* %a6, align 4, !dbg !75 - %tmpVar7 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 0, !dbg !76 - %__parent8 = getelementptr inbounds %child, %child* %tmpVar7, i32 0, i32 0, !dbg !76 - %a9 = getelementptr inbounds %parent, %parent* %__parent8, i32 0, i32 1, !dbg !76 - store i32 8, i32* %a9, align 4, !dbg !76 - %tmpVar10 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 0, !dbg !77 - %b11 = getelementptr inbounds %child, %child* %tmpVar10, i32 0, i32 1, !dbg !77 - store i32 9, i32* %b11, align 4, !dbg !77 - %tmpVar12 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 0, !dbg !78 - %__child13 = getelementptr inbounds %grandchild, %grandchild* %tmpVar12, i32 0, i32 0, !dbg !78 - %__parent14 = getelementptr inbounds %child, %child* %__child13, i32 0, i32 0, !dbg !78 - %a15 = getelementptr inbounds %parent, %parent* %__parent14, i32 0, i32 1, !dbg !78 - store i32 10, i32* %a15, align 4, !dbg !78 - %tmpVar16 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 0, !dbg !79 - %__child17 = getelementptr inbounds %grandchild, %grandchild* %tmpVar16, i32 0, i32 0, !dbg !79 - %b18 = getelementptr inbounds %child, %child* %__child17, i32 0, i32 1, !dbg !79 - store i32 11, i32* %b18, align 4, !dbg !79 - %tmpVar19 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 0, !dbg !80 - %c20 = getelementptr inbounds %grandchild, %grandchild* %tmpVar19, i32 0, i32 1, !dbg !80 - store i32 12, i32* %c20, align 4, !dbg !80 - %tmpVar21 = getelementptr inbounds [3 x %parent], [3 x %parent]* %array_of_parent, i32 0, i32 1, !dbg !81 - %a22 = getelementptr inbounds %parent, %parent* %tmpVar21, i32 0, i32 1, !dbg !81 - store i32 13, i32* %a22, align 4, !dbg !81 - %tmpVar23 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 1, !dbg !82 - %__parent24 = getelementptr inbounds %child, %child* %tmpVar23, i32 0, i32 0, !dbg !82 - %a25 = getelementptr inbounds %parent, %parent* %__parent24, i32 0, i32 1, !dbg !82 - store i32 14, i32* %a25, align 4, !dbg !82 - %tmpVar26 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 1, !dbg !83 - %b27 = getelementptr inbounds %child, %child* %tmpVar26, i32 0, i32 1, !dbg !83 - store i32 15, i32* %b27, align 4, !dbg !83 - %tmpVar28 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 1, !dbg !84 - %__child29 = getelementptr inbounds %grandchild, %grandchild* %tmpVar28, i32 0, i32 0, !dbg !84 - %__parent30 = getelementptr inbounds %child, %child* %__child29, i32 0, i32 0, !dbg !84 - %a31 = getelementptr inbounds %parent, %parent* %__parent30, i32 0, i32 1, !dbg !84 - store i32 16, i32* %a31, align 4, !dbg !84 - %tmpVar32 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 1, !dbg !85 - %__child33 = getelementptr inbounds %grandchild, %grandchild* %tmpVar32, i32 0, i32 0, !dbg !85 - %b34 = getelementptr inbounds %child, %child* %__child33, i32 0, i32 1, !dbg !85 - store i32 17, i32* %b34, align 4, !dbg !85 - %tmpVar35 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 1, !dbg !86 - %c36 = getelementptr inbounds %grandchild, %grandchild* %tmpVar35, i32 0, i32 1, !dbg !86 - store i32 18, i32* %c36, align 4, !dbg !86 - %tmpVar37 = getelementptr inbounds [3 x %parent], [3 x %parent]* %array_of_parent, i32 0, i32 2, !dbg !87 - %a38 = getelementptr inbounds %parent, %parent* %tmpVar37, i32 0, i32 1, !dbg !87 - store i32 19, i32* %a38, align 4, !dbg !87 - %tmpVar39 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 2, !dbg !88 - %__parent40 = getelementptr inbounds %child, %child* %tmpVar39, i32 0, i32 0, !dbg !88 - %a41 = getelementptr inbounds %parent, %parent* %__parent40, i32 0, i32 1, !dbg !88 - store i32 20, i32* %a41, align 4, !dbg !88 - %tmpVar42 = getelementptr inbounds [3 x %child], [3 x %child]* %array_of_child, i32 0, i32 2, !dbg !89 - %b43 = getelementptr inbounds %child, %child* %tmpVar42, i32 0, i32 1, !dbg !89 - store i32 21, i32* %b43, align 4, !dbg !89 - %tmpVar44 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 2, !dbg !90 - %__child45 = getelementptr inbounds %grandchild, %grandchild* %tmpVar44, i32 0, i32 0, !dbg !90 - %__parent46 = getelementptr inbounds %child, %child* %__child45, i32 0, i32 0, !dbg !90 - %a47 = getelementptr inbounds %parent, %parent* %__parent46, i32 0, i32 1, !dbg !90 - store i32 22, i32* %a47, align 4, !dbg !90 - %tmpVar48 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 2, !dbg !91 - %__child49 = getelementptr inbounds %grandchild, %grandchild* %tmpVar48, i32 0, i32 0, !dbg !91 - %b50 = getelementptr inbounds %child, %child* %__child49, i32 0, i32 1, !dbg !91 - store i32 23, i32* %b50, align 4, !dbg !91 - %tmpVar51 = getelementptr inbounds [3 x %grandchild], [3 x %grandchild]* %array_of_grandchild, i32 0, i32 2, !dbg !92 - %c52 = getelementptr inbounds %grandchild, %grandchild* %tmpVar51, i32 0, i32 1, !dbg !92 - store i32 24, i32* %c52, align 4, !dbg !92 - %main_ret = load i32, i32* %main, align 4, !dbg !93 + #dbg_declare(ptr %array_of_parent, !49, !DIExpression(), !53) + call void @llvm.memset.p0.i64(ptr align 1 %array_of_parent, i8 0, i64 ptrtoint (ptr getelementptr ([3 x %parent], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %array_of_child, !54, !DIExpression(), !56) + call void @llvm.memset.p0.i64(ptr align 1 %array_of_child, i8 0, i64 ptrtoint (ptr getelementptr ([3 x %child], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %array_of_grandchild, !57, !DIExpression(), !59) + call void @llvm.memset.p0.i64(ptr align 1 %array_of_grandchild, i8 0, i64 ptrtoint (ptr getelementptr ([3 x %grandchild], ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %parent1, !60, !DIExpression(), !61) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %parent1, ptr align 1 @__parent__init, i64 ptrtoint (ptr getelementptr (%parent, ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %child1, !62, !DIExpression(), !63) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %child1, ptr align 1 @__child__init, i64 ptrtoint (ptr getelementptr (%child, ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %grandchild1, !64, !DIExpression(), !65) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %grandchild1, ptr align 1 @__grandchild__init, i64 ptrtoint (ptr getelementptr (%grandchild, ptr null, i32 1) to i64), i1 false) + #dbg_declare(ptr %main, !66, !DIExpression(), !67) + store i32 0, ptr %main, align 4 + call void @__init_parent(ptr %parent1), !dbg !68 + call void @__init_child(ptr %child1), !dbg !68 + call void @__init_grandchild(ptr %grandchild1), !dbg !68 + call void @__user_init_parent(ptr %parent1), !dbg !68 + call void @__user_init_child(ptr %child1), !dbg !68 + call void @__user_init_grandchild(ptr %grandchild1), !dbg !68 + %a = getelementptr inbounds nuw %parent, ptr %parent1, i32 0, i32 1, !dbg !69 + store i32 1, ptr %a, align 4, !dbg !69 + %__parent = getelementptr inbounds nuw %child, ptr %child1, i32 0, i32 0, !dbg !70 + %a1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1, !dbg !70 + store i32 2, ptr %a1, align 4, !dbg !70 + %b = getelementptr inbounds nuw %child, ptr %child1, i32 0, i32 1, !dbg !71 + store i32 3, ptr %b, align 4, !dbg !71 + %__child = getelementptr inbounds nuw %grandchild, ptr %grandchild1, i32 0, i32 0, !dbg !72 + %__parent2 = getelementptr inbounds nuw %child, ptr %__child, i32 0, i32 0, !dbg !72 + %a3 = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 1, !dbg !72 + store i32 4, ptr %a3, align 4, !dbg !72 + %__child4 = getelementptr inbounds nuw %grandchild, ptr %grandchild1, i32 0, i32 0, !dbg !73 + %b5 = getelementptr inbounds nuw %child, ptr %__child4, i32 0, i32 1, !dbg !73 + store i32 5, ptr %b5, align 4, !dbg !73 + %c = getelementptr inbounds nuw %grandchild, ptr %grandchild1, i32 0, i32 1, !dbg !74 + store i32 6, ptr %c, align 4, !dbg !74 + %tmpVar = getelementptr inbounds [3 x %parent], ptr %array_of_parent, i32 0, i32 0, !dbg !75 + %a6 = getelementptr inbounds nuw %parent, ptr %tmpVar, i32 0, i32 1, !dbg !75 + store i32 7, ptr %a6, align 4, !dbg !75 + %tmpVar7 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 0, !dbg !76 + %__parent8 = getelementptr inbounds nuw %child, ptr %tmpVar7, i32 0, i32 0, !dbg !76 + %a9 = getelementptr inbounds nuw %parent, ptr %__parent8, i32 0, i32 1, !dbg !76 + store i32 8, ptr %a9, align 4, !dbg !76 + %tmpVar10 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 0, !dbg !77 + %b11 = getelementptr inbounds nuw %child, ptr %tmpVar10, i32 0, i32 1, !dbg !77 + store i32 9, ptr %b11, align 4, !dbg !77 + %tmpVar12 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 0, !dbg !78 + %__child13 = getelementptr inbounds nuw %grandchild, ptr %tmpVar12, i32 0, i32 0, !dbg !78 + %__parent14 = getelementptr inbounds nuw %child, ptr %__child13, i32 0, i32 0, !dbg !78 + %a15 = getelementptr inbounds nuw %parent, ptr %__parent14, i32 0, i32 1, !dbg !78 + store i32 10, ptr %a15, align 4, !dbg !78 + %tmpVar16 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 0, !dbg !79 + %__child17 = getelementptr inbounds nuw %grandchild, ptr %tmpVar16, i32 0, i32 0, !dbg !79 + %b18 = getelementptr inbounds nuw %child, ptr %__child17, i32 0, i32 1, !dbg !79 + store i32 11, ptr %b18, align 4, !dbg !79 + %tmpVar19 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 0, !dbg !80 + %c20 = getelementptr inbounds nuw %grandchild, ptr %tmpVar19, i32 0, i32 1, !dbg !80 + store i32 12, ptr %c20, align 4, !dbg !80 + %tmpVar21 = getelementptr inbounds [3 x %parent], ptr %array_of_parent, i32 0, i32 1, !dbg !81 + %a22 = getelementptr inbounds nuw %parent, ptr %tmpVar21, i32 0, i32 1, !dbg !81 + store i32 13, ptr %a22, align 4, !dbg !81 + %tmpVar23 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 1, !dbg !82 + %__parent24 = getelementptr inbounds nuw %child, ptr %tmpVar23, i32 0, i32 0, !dbg !82 + %a25 = getelementptr inbounds nuw %parent, ptr %__parent24, i32 0, i32 1, !dbg !82 + store i32 14, ptr %a25, align 4, !dbg !82 + %tmpVar26 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 1, !dbg !83 + %b27 = getelementptr inbounds nuw %child, ptr %tmpVar26, i32 0, i32 1, !dbg !83 + store i32 15, ptr %b27, align 4, !dbg !83 + %tmpVar28 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 1, !dbg !84 + %__child29 = getelementptr inbounds nuw %grandchild, ptr %tmpVar28, i32 0, i32 0, !dbg !84 + %__parent30 = getelementptr inbounds nuw %child, ptr %__child29, i32 0, i32 0, !dbg !84 + %a31 = getelementptr inbounds nuw %parent, ptr %__parent30, i32 0, i32 1, !dbg !84 + store i32 16, ptr %a31, align 4, !dbg !84 + %tmpVar32 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 1, !dbg !85 + %__child33 = getelementptr inbounds nuw %grandchild, ptr %tmpVar32, i32 0, i32 0, !dbg !85 + %b34 = getelementptr inbounds nuw %child, ptr %__child33, i32 0, i32 1, !dbg !85 + store i32 17, ptr %b34, align 4, !dbg !85 + %tmpVar35 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 1, !dbg !86 + %c36 = getelementptr inbounds nuw %grandchild, ptr %tmpVar35, i32 0, i32 1, !dbg !86 + store i32 18, ptr %c36, align 4, !dbg !86 + %tmpVar37 = getelementptr inbounds [3 x %parent], ptr %array_of_parent, i32 0, i32 2, !dbg !87 + %a38 = getelementptr inbounds nuw %parent, ptr %tmpVar37, i32 0, i32 1, !dbg !87 + store i32 19, ptr %a38, align 4, !dbg !87 + %tmpVar39 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 2, !dbg !88 + %__parent40 = getelementptr inbounds nuw %child, ptr %tmpVar39, i32 0, i32 0, !dbg !88 + %a41 = getelementptr inbounds nuw %parent, ptr %__parent40, i32 0, i32 1, !dbg !88 + store i32 20, ptr %a41, align 4, !dbg !88 + %tmpVar42 = getelementptr inbounds [3 x %child], ptr %array_of_child, i32 0, i32 2, !dbg !89 + %b43 = getelementptr inbounds nuw %child, ptr %tmpVar42, i32 0, i32 1, !dbg !89 + store i32 21, ptr %b43, align 4, !dbg !89 + %tmpVar44 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 2, !dbg !90 + %__child45 = getelementptr inbounds nuw %grandchild, ptr %tmpVar44, i32 0, i32 0, !dbg !90 + %__parent46 = getelementptr inbounds nuw %child, ptr %__child45, i32 0, i32 0, !dbg !90 + %a47 = getelementptr inbounds nuw %parent, ptr %__parent46, i32 0, i32 1, !dbg !90 + store i32 22, ptr %a47, align 4, !dbg !90 + %tmpVar48 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 2, !dbg !91 + %__child49 = getelementptr inbounds nuw %grandchild, ptr %tmpVar48, i32 0, i32 0, !dbg !91 + %b50 = getelementptr inbounds nuw %child, ptr %__child49, i32 0, i32 1, !dbg !91 + store i32 23, ptr %b50, align 4, !dbg !91 + %tmpVar51 = getelementptr inbounds [3 x %grandchild], ptr %array_of_grandchild, i32 0, i32 2, !dbg !92 + %c52 = getelementptr inbounds nuw %grandchild, ptr %tmpVar51, i32 0, i32 1, !dbg !92 + store i32 24, ptr %c52, align 4, !dbg !92 + %main_ret = load i32, ptr %main, align 4, !dbg !93 ret i32 %main_ret, !dbg !93 } - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #2 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init___vtable_grandchild(%__vtable_grandchild* %0) { + define void @__init___vtable_grandchild(ptr %0) { entry: - %self = alloca %__vtable_grandchild*, align 8 - store %__vtable_grandchild* %0, %__vtable_grandchild** %self, align 8 - %deref = load %__vtable_grandchild*, %__vtable_grandchild** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandchild, %__vtable_grandchild* %deref, i32 0, i32 0 - store void (%grandchild*)* @grandchild, void (%grandchild*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @grandchild, ptr %__body, align 8 ret void } - define void @__init_grandchild(%grandchild* %0) { + define void @__init_grandchild(ptr %0) { entry: - %self = alloca %grandchild*, align 8 - store %grandchild* %0, %grandchild** %self, align 8 - %deref = load %grandchild*, %grandchild** %self, align 8 - %__child = getelementptr inbounds %grandchild, %grandchild* %deref, i32 0, i32 0 - call void @__init_child(%child* %__child) - %deref1 = load %grandchild*, %grandchild** %self, align 8 - %__child2 = getelementptr inbounds %grandchild, %grandchild* %deref1, i32 0, i32 0 - %__parent = getelementptr inbounds %child, %child* %__child2, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 0 - store i32* bitcast (%__vtable_grandchild* @__vtable_grandchild_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__child = getelementptr inbounds nuw %grandchild, ptr %deref, i32 0, i32 0 + call void @__init_child(ptr %__child) + %deref1 = load ptr, ptr %self, align 8 + %__child2 = getelementptr inbounds nuw %grandchild, ptr %deref1, i32 0, i32 0 + %__parent = getelementptr inbounds nuw %child, ptr %__child2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 0 + store ptr @__vtable_grandchild_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandchild(%__vtable_grandchild* %0) { + define void @__user_init___vtable_grandchild(ptr %0) { entry: - %self = alloca %__vtable_grandchild*, align 8 - store %__vtable_grandchild* %0, %__vtable_grandchild** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_grandchild(%grandchild* %0) { + define void @__user_init_grandchild(ptr %0) { entry: - %self = alloca %grandchild*, align 8 - store %grandchild* %0, %grandchild** %self, align 8 - %deref = load %grandchild*, %grandchild** %self, align 8 - %__child = getelementptr inbounds %grandchild, %grandchild* %deref, i32 0, i32 0 - call void @__user_init_child(%child* %__child) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__child = getelementptr inbounds nuw %grandchild, ptr %deref, i32 0, i32 0 + call void @__user_init_child(ptr %__child) ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__init___vtable_grandchild(%__vtable_grandchild* @__vtable_grandchild_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandchild(%__vtable_grandchild* @__vtable_grandchild_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__init___vtable_grandchild(ptr @__vtable_grandchild_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandchild(ptr @__vtable_grandchild_instance) ret void } - attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } - attributes #2 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } !llvm.module.flags = !{!26, !27} !llvm.dbg.cu = !{!28} diff --git a/src/codegen/tests/oop_tests/super_tests.rs b/src/codegen/tests/oop_tests/super_tests.rs index 7ad6926fa82..3296c8a0d11 100644 --- a/src/codegen/tests/oop_tests/super_tests.rs +++ b/src/codegen/tests/oop_tests/super_tests.rs @@ -23,119 +23,119 @@ fn super_keyword_basic_access() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16 } + %__vtable_child = type { ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - store i16 20, i16* %x, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + store i16 20, ptr %x, align 2 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -166,119 +166,119 @@ fn super_without_deref() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16 } - %__vtable_child = type { void (%child*)* } - %child = type { %parent, %parent* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16 } + %__vtable_child = type { ptr } + %child = type { %parent, ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10 }, %parent* null } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10 }, ptr null } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %p = getelementptr inbounds %child, %child* %0, i32 0, i32 1 - store %parent* %__parent, %parent** %p, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %p = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 + store ptr %__parent, ptr %p, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -316,173 +316,173 @@ fn super_in_method_calls() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)*, i16 (%parent*)* } - %parent = type { i32*, i16 } - %__vtable_child = type { void (%child*)*, i16 (%child*)*, i16 (%child*)* } + %__vtable_parent = type { ptr, ptr } + %parent = type { ptr, i16 } + %__vtable_child = type { ptr, ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define i16 @parent__process(%parent* %0) { + define i16 @parent__process(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 %parent.process = alloca i16, align 2 - store i16 0, i16* %parent.process, align 2 - %load_value = load i16, i16* %value, align 2 + store i16 0, ptr %parent.process, align 2 + %load_value = load i16, ptr %value, align 2 %1 = sext i16 %load_value to i32 %tmpVar = mul i32 %1, 2 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %parent.process, align 2 - %parent__process_ret = load i16, i16* %parent.process, align 2 + store i16 %2, ptr %parent.process, align 2 + %parent__process_ret = load i16, ptr %parent.process, align 2 ret i16 %parent__process_ret } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define i16 @child__process(%child* %0) { + define i16 @child__process(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %child.process = alloca i16, align 2 - store i16 0, i16* %child.process, align 2 - %value = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_value = load i16, i16* %value, align 2 + store i16 0, ptr %child.process, align 2 + %value = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_value = load i16, ptr %value, align 2 %1 = sext i16 %load_value to i32 %tmpVar = add i32 %1, 5 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %child.process, align 2 - %child__process_ret = load i16, i16* %child.process, align 2 + store i16 %2, ptr %child.process, align 2 + %child__process_ret = load i16, ptr %child.process, align 2 ret i16 %child__process_ret } - define i16 @child__test(%child* %0) { + define i16 @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %child.test = alloca i16, align 2 - store i16 0, i16* %child.test, align 2 - %call = call i16 @parent__process(%parent* %__parent) - store i16 %call, i16* %child.test, align 2 - %child__test_ret = load i16, i16* %child.test, align 2 + store i16 0, ptr %child.test, align 2 + %call = call i16 @parent__process(ptr %__parent) + store i16 %call, ptr %child.test, align 2 + %child__test_ret = load i16, ptr %child.test, align 2 ret i16 %child__test_ret } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %process = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store i16 (%parent*)* @parent__process, i16 (%parent*)** %process, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %process = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @parent__process, ptr %process, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %process = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store i16 (%child*)* @child__process, i16 (%child*)** %process, align 8 - %deref2 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref2, i32 0, i32 2 - store i16 (%child*)* @child__test, i16 (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %process = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @child__process, ptr %process, align 8 + %deref2 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref2, i32 0, i32 2 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -514,129 +514,129 @@ fn super_in_complex_expressions() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16, i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16, i16 } + %__vtable_child = type { ptr } %child = type { %parent, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10, i16 20 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10, i16 20 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10, i16 20 }, i16 30 } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10, i16 20 }, i16 30 } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %x = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %y = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %z = getelementptr inbounds %child, %child* %0, i32 0, i32 1 - %x = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = sext i16 %load_x to i32 - %y = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_y = load i16, i16* %y, align 2 + %y = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_y = load i16, ptr %y, align 2 %2 = sext i16 %load_y to i32 %tmpVar = mul i32 %2, 2 %tmpVar1 = add i32 %1, %tmpVar %3 = trunc i32 %tmpVar1 to i16 - store i16 %3, i16* %z, align 2 + store i16 %3, ptr %z, align 2 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -667,126 +667,126 @@ fn super_with_array_access() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, [6 x i16] } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, [6 x i16] } + %__vtable_child = type { ptr } %child = type { %parent, i16 } @__parent.arr__init = unnamed_addr constant [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } + @__parent__init = unnamed_addr constant %parent { ptr null, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] }, i16 3 } + @__child__init = unnamed_addr constant %child { %parent { ptr null, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] }, i16 3 } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %arr = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %arr = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %index = getelementptr inbounds %child, %child* %0, i32 0, i32 1 - %arr = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_index = load i16, i16* %index, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %index = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 + %arr = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_index = load i16, ptr %index, align 2 %1 = sext i16 %load_index to i32 %tmpVar = mul i32 1, %1 %tmpVar1 = add i32 %tmpVar, 0 - %tmpVar2 = getelementptr inbounds [6 x i16], [6 x i16]* %arr, i32 0, i32 %tmpVar1 - store i16 42, i16* %tmpVar2, align 2 + %tmpVar2 = getelementptr inbounds [6 x i16], ptr %arr, i32 0, i32 %tmpVar1 + store i16 42, ptr %tmpVar2, align 2 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -834,241 +834,241 @@ fn super_in_multi_level_inheritance() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)*, i16 (%grandparent*)* } - %grandparent = type { i32*, i16 } - %__vtable_parent = type { void (%parent*)*, i16 (%grandparent*)*, i16 (%parent*)* } + %__vtable_grandparent = type { ptr, ptr } + %grandparent = type { ptr, i16 } + %__vtable_parent = type { ptr, ptr, ptr } %parent = type { %grandparent, i16 } - %__vtable_child = type { void (%child*)*, i16 (%grandparent*)*, i16 (%parent*)*, i16 (%child*)* } + %__vtable_child = type { ptr, ptr, ptr, ptr } %child = type { %parent, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer - @__grandparent__init = unnamed_addr constant %grandparent { i32* null, i16 10 } + @__grandparent__init = unnamed_addr constant %grandparent { ptr null, i16 10 } @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { %grandparent { i32* null, i16 10 }, i16 20 } + @__parent__init = unnamed_addr constant %parent { %grandparent { ptr null, i16 10 }, i16 20 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { %grandparent { i32* null, i16 10 }, i16 20 }, i16 30 } + @__child__init = unnamed_addr constant %child { %parent { %grandparent { ptr null, i16 10 }, i16 20 }, i16 30 } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) { + define void @grandparent(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %g_val = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %g_val = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 ret void } - define i16 @grandparent__gp_method(%grandparent* %0) { + define i16 @grandparent__gp_method(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 - %g_val = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 + %g_val = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 1 %grandparent.gp_method = alloca i16, align 2 - store i16 0, i16* %grandparent.gp_method, align 2 - %load_g_val = load i16, i16* %g_val, align 2 - store i16 %load_g_val, i16* %grandparent.gp_method, align 2 - %grandparent__gp_method_ret = load i16, i16* %grandparent.gp_method, align 2 + store i16 0, ptr %grandparent.gp_method, align 2 + %load_g_val = load i16, ptr %g_val, align 2 + store i16 %load_g_val, ptr %grandparent.gp_method, align 2 + %grandparent__gp_method_ret = load i16, ptr %grandparent.gp_method, align 2 ret i16 %grandparent__gp_method_ret } - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %p_val = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %p_val = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define i16 @parent__p_method(%parent* %0) { + define i16 @parent__p_method(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %p_val = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %p_val = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 %parent.p_method = alloca i16, align 2 - store i16 0, i16* %parent.p_method, align 2 - %load_p_val = load i16, i16* %p_val, align 2 + store i16 0, ptr %parent.p_method, align 2 + %load_p_val = load i16, ptr %p_val, align 2 %1 = sext i16 %load_p_val to i32 - %call = call i16 @grandparent__gp_method(%grandparent* %__grandparent) + %call = call i16 @grandparent__gp_method(ptr %__grandparent) %2 = sext i16 %call to i32 %tmpVar = add i32 %1, %2 %3 = trunc i32 %tmpVar to i16 - store i16 %3, i16* %parent.p_method, align 2 - %parent__p_method_ret = load i16, i16* %parent.p_method, align 2 + store i16 %3, ptr %parent.p_method, align 2 + %parent__p_method_ret = load i16, ptr %parent.p_method, align 2 ret i16 %parent__p_method_ret } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %c_val = getelementptr inbounds %child, %child* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %c_val = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 ret void } - define i16 @child__test(%child* %0) { + define i16 @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %c_val = getelementptr inbounds %child, %child* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %c_val = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 1 %child.test = alloca i16, align 2 - store i16 0, i16* %child.test, align 2 - %call = call i16 @parent__p_method(%parent* %__parent) - store i16 %call, i16* %child.test, align 2 - %child__test_ret = load i16, i16* %child.test, align 2 + store i16 0, ptr %child.test, align 2 + %call = call i16 @parent__p_method(ptr %__parent) + store i16 %call, ptr %child.test, align 2 + %child__test_ret = load i16, ptr %child.test, align 2 ret i16 %child__test_ret } - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 - %deref1 = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %gp_method = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref1, i32 0, i32 1 - store i16 (%grandparent*)* @grandparent__gp_method, i16 (%grandparent*)** %gp_method, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %gp_method = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref1, i32 0, i32 1 + store ptr @grandparent__gp_method, ptr %gp_method, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %gp_method = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store i16 (%grandparent*)* @grandparent__gp_method, i16 (%grandparent*)** %gp_method, align 8 - %deref2 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %p_method = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref2, i32 0, i32 2 - store i16 (%parent*)* @parent__p_method, i16 (%parent*)** %p_method, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %gp_method = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @grandparent__gp_method, ptr %gp_method, align 8 + %deref2 = load ptr, ptr %self, align 8 + %p_method = getelementptr inbounds nuw %__vtable_parent, ptr %deref2, i32 0, i32 2 + store ptr @parent__p_method, ptr %p_method, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %gp_method = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store i16 (%grandparent*)* @grandparent__gp_method, i16 (%grandparent*)** %gp_method, align 8 - %deref2 = load %__vtable_child*, %__vtable_child** %self, align 8 - %p_method = getelementptr inbounds %__vtable_child, %__vtable_child* %deref2, i32 0, i32 2 - store i16 (%parent*)* @parent__p_method, i16 (%parent*)** %p_method, align 8 - %deref3 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref3, i32 0, i32 3 - store i16 (%child*)* @child__test, i16 (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %gp_method = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @grandparent__gp_method, ptr %gp_method, align 8 + %deref2 = load ptr, ptr %self, align 8 + %p_method = getelementptr inbounds nuw %__vtable_child, ptr %deref2, i32 0, i32 2 + store ptr @parent__p_method, ptr %p_method, align 8 + %deref3 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref3, i32 0, i32 3 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -1099,129 +1099,129 @@ fn super_with_pointer_operations() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16, i16* } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16, ptr } + %__vtable_child = type { ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10, i16* null } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10, ptr null } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10, i16* null } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10, ptr null } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %val = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %ptr = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %ptr = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %ptr = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %val = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - store i16* %val, i16** %ptr, align 8 - %val1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %ptr2 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %deref = load i16*, i16** %ptr2, align 8 - %load_tmpVar = load i16, i16* %deref, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %ptr = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %val = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + store ptr %val, ptr %ptr, align 8 + %val1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %ptr2 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %deref = load ptr, ptr %ptr2, align 8 + %load_tmpVar = load i16, ptr %deref, align 2 %1 = sext i16 %load_tmpVar to i32 %tmpVar = add i32 %1, 5 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %val1, align 2 + store i16 %2, ptr %val1, align 2 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -1262,47 +1262,47 @@ fn super_in_conditionals() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16, i16 } - %__vtable_child = type { void (%child*)*, void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16, i16 } + %__vtable_child = type { ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 50, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 50, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 50, i16 10 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 50, i16 10 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %threshold = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %value = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %threshold = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %value = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define void @child__test(%child* %0) { + define void @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_value = load i16, i16* %value, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_value = load i16, ptr %value, align 2 %1 = sext i16 %load_value to i32 - %threshold = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_threshold = load i16, i16* %threshold, align 2 + %threshold = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_threshold = load i16, ptr %threshold, align 2 %2 = sext i16 %load_threshold to i32 %tmpVar = icmp sgt i32 %1, %2 %3 = zext i1 %tmpVar to i8 @@ -1310,31 +1310,31 @@ fn super_in_conditionals() { br i1 %4, label %condition_body, label %else condition_body: ; preds = %entry - %value1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - store i16 0, i16* %value1, align 2 + %value1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + store i16 0, ptr %value1, align 2 br label %continue else: ; preds = %entry - %value2 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - store i16 100, i16* %value2, align 2 + %value2 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + store i16 100, ptr %value2, align 2 br label %continue continue: ; preds = %else, %condition_body - %value4 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_value5 = load i16, i16* %value4, align 2 + %value4 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_value5 = load i16, ptr %value4, align 2 switch i16 %load_value5, label %else6 [ i16 10, label %case i16 20, label %case8 ] case: ; preds = %continue - %threshold7 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - store i16 40, i16* %threshold7, align 2 + %threshold7 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + store i16 40, ptr %threshold7, align 2 br label %continue3 case8: ; preds = %continue - %threshold9 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - store i16 60, i16* %threshold9, align 2 + %threshold9 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + store i16 60, ptr %threshold9, align 2 br label %continue3 else6: ; preds = %continue @@ -1344,90 +1344,90 @@ fn super_in_conditionals() { ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store void (%child*)* @child__test, void (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -1458,120 +1458,120 @@ fn super_with_const_variables() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16, i16 } - %__vtable_child = type { void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16, i16 } + %__vtable_child = type { ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 100, i16 50 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 100, i16 50 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 100, i16 50 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 100, i16 50 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %MAX_VALUE = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %current = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %MAX_VALUE = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %current = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %current = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - store i16 50, i16* %current, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %current = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + store i16 50, ptr %current, align 2 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -1616,164 +1616,162 @@ fn super_as_function_parameter() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, i16 } - %__vtable_child = type { void (%child*)*, void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, i16 } + %__vtable_child = type { ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %val = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define void @child__test(%child* %0) { + define void @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %call = call i16 @process_ref(%parent* %__parent) - %call1 = call i16 @process_val(%parent* %__parent) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %call = call i16 @process_ref(ptr %__parent) + %call1 = call i16 @process_val(ptr %__parent) ret void } - define i16 @process_ref(%parent* %0) { + define i16 @process_ref(ptr %0) { entry: %process_ref = alloca i16, align 2 - %ref = alloca %parent*, align 8 - store %parent* %0, %parent** %ref, align 8 - store i16 0, i16* %process_ref, align 2 - %deref = load %parent*, %parent** %ref, align 8 - %val = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 1 - store i16 20, i16* %val, align 2 - %process_ref_ret = load i16, i16* %process_ref, align 2 + %ref = alloca ptr, align 8 + store ptr %0, ptr %ref, align 8 + store i16 0, ptr %process_ref, align 2 + %deref = load ptr, ptr %ref, align 8 + %val = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 1 + store i16 20, ptr %val, align 2 + %process_ref_ret = load i16, ptr %process_ref, align 2 ret i16 %process_ref_ret } - define i16 @process_val(%parent* %0) { + define i16 @process_val(ptr %0) { entry: %process_val = alloca i16, align 2 %val = alloca %parent, align 8 - %1 = bitcast %parent* %val to i8* - %2 = bitcast %parent* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%parent* getelementptr (%parent, %parent* null, i32 1) to i64), i1 false) - store i16 0, i16* %process_val, align 2 - %val1 = getelementptr inbounds %parent, %parent* %val, i32 0, i32 1 - store i16 30, i16* %val1, align 2 - %process_val_ret = load i16, i16* %process_val, align 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%parent, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %process_val, align 2 + %val1 = getelementptr inbounds nuw %parent, ptr %val, i32 0, i32 1 + store i16 30, ptr %val1, align 2 + %process_val_ret = load i16, ptr %process_val, align 2 ret i16 %process_val_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store void (%child*)* @child__test, void (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1807,184 +1805,184 @@ fn super_with_deeply_nested_expressions() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)*, i16 (%parent*)* } - %parent = type { i32*, i16, i16, i16 } - %__vtable_child = type { void (%child*)*, i16 (%parent*)*, i16 (%child*)* } + %__vtable_parent = type { ptr, ptr } + %parent = type { ptr, i16, i16, i16 } + %__vtable_child = type { ptr, ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 1, i16 2, i16 3 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 1, i16 2, i16 3 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 1, i16 2, i16 3 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 1, i16 2, i16 3 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %a = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 - %c = getelementptr inbounds %parent, %parent* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 + %c = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 3 ret void } - define i16 @parent__calc(%parent* %0) { + define i16 @parent__calc(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %a = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %b = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 - %c = getelementptr inbounds %parent, %parent* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 + %c = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 3 %parent.calc = alloca i16, align 2 - store i16 0, i16* %parent.calc, align 2 - %load_a = load i16, i16* %a, align 2 + store i16 0, ptr %parent.calc, align 2 + %load_a = load i16, ptr %a, align 2 %1 = sext i16 %load_a to i32 - %load_b = load i16, i16* %b, align 2 + %load_b = load i16, ptr %b, align 2 %2 = sext i16 %load_b to i32 - %load_c = load i16, i16* %c, align 2 + %load_c = load i16, ptr %c, align 2 %3 = sext i16 %load_c to i32 %tmpVar = mul i32 %2, %3 %tmpVar1 = add i32 %1, %tmpVar %4 = trunc i32 %tmpVar1 to i16 - store i16 %4, i16* %parent.calc, align 2 - %parent__calc_ret = load i16, i16* %parent.calc, align 2 + store i16 %4, ptr %parent.calc, align 2 + %parent__calc_ret = load i16, ptr %parent.calc, align 2 ret i16 %parent__calc_ret } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define i16 @child__test(%child* %0) { + define i16 @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %child.test = alloca i16, align 2 - store i16 0, i16* %child.test, align 2 - %a = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_a = load i16, i16* %a, align 2 + store i16 0, ptr %child.test, align 2 + %a = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_a = load i16, ptr %a, align 2 %1 = sext i16 %load_a to i32 - %b = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_b = load i16, i16* %b, align 2 + %b = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_b = load i16, ptr %b, align 2 %2 = sext i16 %load_b to i32 %tmpVar = add i32 %1, %2 - %c = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 3 - %load_c = load i16, i16* %c, align 2 + %c = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 3 + %load_c = load i16, ptr %c, align 2 %3 = sext i16 %load_c to i32 %tmpVar1 = mul i32 %tmpVar, %3 - %call = call i16 @parent__calc(%parent* %__parent) + %call = call i16 @parent__calc(ptr %__parent) %4 = sext i16 %call to i32 %tmpVar2 = add i32 %tmpVar1, %4 - %a3 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_a4 = load i16, i16* %a3, align 2 + %a3 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_a4 = load i16, ptr %a3, align 2 %5 = sext i16 %load_a4 to i32 %tmpVar5 = add i32 %5, 1 %tmpVar6 = sdiv i32 %tmpVar2, %tmpVar5 %6 = trunc i32 %tmpVar6 to i16 - store i16 %6, i16* %child.test, align 2 - %child__test_ret = load i16, i16* %child.test, align 2 + store i16 %6, ptr %child.test, align 2 + %child__test_ret = load i16, ptr %child.test, align 2 ret i16 %child__test_ret } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %calc = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store i16 (%parent*)* @parent__calc, i16 (%parent*)** %calc, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %calc = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @parent__calc, ptr %calc, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %calc = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store i16 (%parent*)* @parent__calc, i16 (%parent*)** %calc, align 8 - %deref2 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref2, i32 0, i32 2 - store i16 (%child*)* @child__test, i16 (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %calc = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @parent__calc, ptr %calc, align 8 + %deref2 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref2, i32 0, i32 2 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -2038,100 +2036,100 @@ fn super_in_loop_constructs() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)*, void (%parent*)* } - %parent = type { i32*, i16, [6 x i16] } - %__vtable_child = type { void (%child*)*, void (%parent*)*, void (%child*)* } + %__vtable_parent = type { ptr, ptr } + %parent = type { ptr, i16, [6 x i16] } + %__vtable_child = type { ptr, ptr, ptr } %child = type { %parent } @__parent.arr__init = unnamed_addr constant [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 0, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 0, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 0, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 0, [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %counter = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %arr = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %counter = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %arr = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @parent__increment(%parent* %0) { + define void @parent__increment(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %counter = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %arr = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 - %load_counter = load i16, i16* %counter, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %counter = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %arr = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 + %load_counter = load i16, ptr %counter, align 2 %1 = sext i16 %load_counter to i32 %tmpVar = add i32 %1, 1 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %counter, align 2 + store i16 %2, ptr %counter, align 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define void @child__process(%child* %0) { + define void @child__process(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %i = alloca i16, align 2 %sum = alloca i16, align 2 - store i16 0, i16* %i, align 2 - store i16 0, i16* %sum, align 2 - store i16 0, i16* %i, align 2 + store i16 0, ptr %i, align 2 + store i16 0, ptr %sum, align 2 + store i16 0, ptr %i, align 2 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i16, i16* %i, align 2 + %1 = load i16, ptr %i, align 2 %2 = sext i16 %1 to i32 %condition = icmp sle i32 %2, 5 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %3 = load i16, i16* %i, align 2 + %3 = load i16, ptr %i, align 2 %4 = sext i16 %3 to i32 %condition1 = icmp sge i32 %4, 5 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_sum = load i16, i16* %sum, align 2 + %load_sum = load i16, ptr %sum, align 2 %5 = sext i16 %load_sum to i32 - %arr = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %load_i = load i16, i16* %i, align 2 + %arr = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %load_i = load i16, ptr %i, align 2 %6 = sext i16 %load_i to i32 %tmpVar = mul i32 1, %6 %tmpVar2 = add i32 %tmpVar, 0 - %tmpVar3 = getelementptr inbounds [6 x i16], [6 x i16]* %arr, i32 0, i32 %tmpVar2 - %load_tmpVar = load i16, i16* %tmpVar3, align 2 + %tmpVar3 = getelementptr inbounds [6 x i16], ptr %arr, i32 0, i32 %tmpVar2 + %load_tmpVar = load i16, ptr %tmpVar3, align 2 %7 = sext i16 %load_tmpVar to i32 %tmpVar4 = add i32 %5, %7 %8 = trunc i32 %tmpVar4 to i16 - store i16 %8, i16* %sum, align 2 - call void @parent__increment(%parent* %__parent) + store i16 %8, ptr %sum, align 2 + call void @parent__increment(ptr %__parent) br label %increment increment: ; preds = %loop - %9 = load i16, i16* %i, align 2 + %9 = load i16, ptr %i, align 2 %10 = sext i16 %9 to i32 %next = add i32 1, %10 %11 = trunc i32 %next to i16 - store i16 %11, i16* %i, align 2 + store i16 %11, ptr %i, align 2 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle @@ -2141,8 +2139,8 @@ fn super_in_loop_constructs() { br i1 true, label %while_body, label %continue5 while_body: ; preds = %condition_check - %counter = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_counter = load i16, i16* %counter, align 2 + %counter = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_counter = load i16, ptr %counter, align 2 %12 = sext i16 %load_counter to i32 %tmpVar7 = icmp slt i32 %12, 10 %13 = zext i1 %tmpVar7 to i8 @@ -2160,22 +2158,22 @@ fn super_in_loop_constructs() { br label %continue6 continue6: ; preds = %buffer_block, %while_body - call void @parent__increment(%parent* %__parent) + call void @parent__increment(ptr %__parent) br label %condition_check condition_check9: ; preds = %continue16, %continue5 br i1 true, label %while_body10, label %continue11 while_body10: ; preds = %condition_check9 - %counter12 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %counter13 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_counter14 = load i16, i16* %counter13, align 2 + %counter12 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %counter13 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_counter14 = load i16, ptr %counter13, align 2 %15 = sext i16 %load_counter14 to i32 %tmpVar15 = sub i32 %15, 1 %16 = trunc i32 %tmpVar15 to i16 - store i16 %16, i16* %counter12, align 2 - %counter17 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_counter18 = load i16, i16* %counter17, align 2 + store i16 %16, ptr %counter12, align 2 + %counter17 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_counter18 = load i16, ptr %counter17, align 2 %17 = sext i16 %load_counter18 to i32 %tmpVar19 = icmp sle i32 %17, 0 %18 = zext i1 %tmpVar19 to i8 @@ -2195,96 +2193,96 @@ fn super_in_loop_constructs() { br label %condition_check9 } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %increment = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store void (%parent*)* @parent__increment, void (%parent*)** %increment, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %increment = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @parent__increment, ptr %increment, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %increment = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store void (%parent*)* @parent__increment, void (%parent*)** %increment, align 8 - %deref2 = load %__vtable_child*, %__vtable_child** %self, align 8 - %process = getelementptr inbounds %__vtable_child, %__vtable_child* %deref2, i32 0, i32 2 - store void (%child*)* @child__process, void (%child*)** %process, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %increment = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @parent__increment, ptr %increment, align 8 + %deref2 = load ptr, ptr %self, align 8 + %process = getelementptr inbounds nuw %__vtable_child, ptr %deref2, i32 0, i32 2 + store ptr @child__process, ptr %process, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -2321,14 +2319,14 @@ fn super_with_method_overrides_in_three_levels() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_grandparent = type { void (%grandparent*)*, i16 (%grandparent*)* } - %grandparent = type { i32* } - %__vtable_parent = type { void (%parent*)*, i16 (%parent*)* } + %__vtable_grandparent = type { ptr, ptr } + %grandparent = type { ptr } + %__vtable_parent = type { ptr, ptr } %parent = type { %grandparent } - %__vtable_child = type { void (%child*)*, i16 (%child*)* } + %__vtable_child = type { ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_grandparent__init = unnamed_addr constant %__vtable_grandparent zeroinitializer @__grandparent__init = unnamed_addr constant %grandparent zeroinitializer @__vtable_grandparent_instance = global %__vtable_grandparent zeroinitializer @@ -2339,208 +2337,208 @@ fn super_with_method_overrides_in_three_levels() { @__child__init = unnamed_addr constant %child zeroinitializer @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @grandparent(%grandparent* %0) { + define void @grandparent(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 ret void } - define i16 @grandparent__calculate(%grandparent* %0) { + define i16 @grandparent__calculate(ptr %0) { entry: - %this = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %this, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %0, i32 0, i32 0 %grandparent.calculate = alloca i16, align 2 - store i16 0, i16* %grandparent.calculate, align 2 - store i16 100, i16* %grandparent.calculate, align 2 - %grandparent__calculate_ret = load i16, i16* %grandparent.calculate, align 2 + store i16 0, ptr %grandparent.calculate, align 2 + store i16 100, ptr %grandparent.calculate, align 2 + %grandparent__calculate_ret = load i16, ptr %grandparent.calculate, align 2 ret i16 %grandparent__calculate_ret } - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 ret void } - define i16 @parent__calculate(%parent* %0) { + define i16 @parent__calculate(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 %parent.calculate = alloca i16, align 2 - store i16 0, i16* %parent.calculate, align 2 - %call = call i16 @grandparent__calculate(%grandparent* %__grandparent) + store i16 0, ptr %parent.calculate, align 2 + %call = call i16 @grandparent__calculate(ptr %__grandparent) %1 = sext i16 %call to i32 %tmpVar = add i32 %1, 50 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %parent.calculate, align 2 - %parent__calculate_ret = load i16, i16* %parent.calculate, align 2 + store i16 %2, ptr %parent.calculate, align 2 + %parent__calculate_ret = load i16, ptr %parent.calculate, align 2 ret i16 %parent__calculate_ret } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define i16 @child__calculate(%child* %0) { + define i16 @child__calculate(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %child.calculate = alloca i16, align 2 - store i16 0, i16* %child.calculate, align 2 - %call = call i16 @parent__calculate(%parent* %__parent) + store i16 0, ptr %child.calculate, align 2 + %call = call i16 @parent__calculate(ptr %__parent) %1 = sext i16 %call to i32 %tmpVar = add i32 %1, 25 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %child.calculate, align 2 - %child__calculate_ret = load i16, i16* %child.calculate, align 2 + store i16 %2, ptr %child.calculate, align 2 + %child__calculate_ret = load i16, ptr %child.calculate, align 2 ret i16 %child__calculate_ret } - define void @__init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 - %deref = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %__body = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref, i32 0, i32 0 - store void (%grandparent*)* @grandparent, void (%grandparent*)** %__body, align 8 - %deref1 = load %__vtable_grandparent*, %__vtable_grandparent** %self, align 8 - %calculate = getelementptr inbounds %__vtable_grandparent, %__vtable_grandparent* %deref1, i32 0, i32 1 - store i16 (%grandparent*)* @grandparent__calculate, i16 (%grandparent*)** %calculate, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @grandparent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %calculate = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref1, i32 0, i32 1 + store ptr @grandparent__calculate, ptr %calculate, align 8 ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %calculate = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store i16 (%parent*)* @parent__calculate, i16 (%parent*)** %calculate, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %calculate = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref1, i32 0, i32 1 + store ptr @parent__calculate, ptr %calculate, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %calculate = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store i16 (%child*)* @child__calculate, i16 (%child*)** %calculate, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %calculate = getelementptr inbounds nuw %__vtable_grandparent, ptr %deref1, i32 0, i32 1 + store ptr @child__calculate, ptr %calculate, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__init_grandparent(%grandparent* %__grandparent) - %deref1 = load %parent*, %parent** %self, align 8 - %__grandparent2 = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent2, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__init_grandparent(ptr %__grandparent) + %deref1 = load ptr, ptr %self, align 8 + %__grandparent2 = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent2, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_grandparent(%grandparent* %0) { + define void @__init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 - %deref = load %grandparent*, %grandparent** %self, align 8 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_grandparent* @__vtable_grandparent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_grandparent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__grandparent = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - %__vtable = getelementptr inbounds %grandparent, %grandparent* %__grandparent, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__grandparent = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %grandparent, ptr %__grandparent, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_grandparent(%grandparent* %0) { + define void @__user_init_grandparent(ptr %0) { entry: - %self = alloca %grandparent*, align 8 - store %grandparent* %0, %grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_grandparent(%__vtable_grandparent* %0) { + define void @__user_init___vtable_grandparent(ptr %0) { entry: - %self = alloca %__vtable_grandparent*, align 8 - store %__vtable_grandparent* %0, %__vtable_grandparent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__grandparent = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - call void @__user_init_grandparent(%grandparent* %__grandparent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__grandparent = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + call void @__user_init_grandparent(ptr %__grandparent) ret void } define void @__init___Test() { entry: - call void @__init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_grandparent(%__vtable_grandparent* @__vtable_grandparent_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_grandparent(ptr @__vtable_grandparent_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); @@ -2632,194 +2630,193 @@ fn super_with_structured_types() { target triple = "[filtered]" %Complex_Type = type { i16, i16, float } - %__vtable_parent = type { void (%parent*)* } - %parent = type { i32*, %Complex_Type, [2 x %Complex_Type] } - %__vtable_child = type { void (%child*)*, void (%child*)* } + %__vtable_parent = type { ptr } + %parent = type { ptr, %Complex_Type, [2 x %Complex_Type] } + %__vtable_child = type { ptr, ptr } %child = type { %parent } @__parent.data__init = unnamed_addr constant %Complex_Type { i16 10, i16 20, float 3.050000e+01 } @__parent.arr_data__init = unnamed_addr constant [2 x %Complex_Type] [%Complex_Type { i16 1, i16 2, float 3.500000e+00 }, %Complex_Type { i16 4, i16 5, float 6.500000e+00 }] - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, %Complex_Type { i16 10, i16 20, float 3.050000e+01 }, [2 x %Complex_Type] [%Complex_Type { i16 1, i16 2, float 3.500000e+00 }, %Complex_Type { i16 4, i16 5, float 6.500000e+00 }] } + @__parent__init = unnamed_addr constant %parent { ptr null, %Complex_Type { i16 10, i16 20, float 3.050000e+01 }, [2 x %Complex_Type] [%Complex_Type { i16 1, i16 2, float 3.500000e+00 }, %Complex_Type { i16 4, i16 5, float 6.500000e+00 }] } @__Complex_Type__init = unnamed_addr constant %Complex_Type zeroinitializer @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, %Complex_Type { i16 10, i16 20, float 3.050000e+01 }, [2 x %Complex_Type] [%Complex_Type { i16 1, i16 2, float 3.500000e+00 }, %Complex_Type { i16 4, i16 5, float 6.500000e+00 }] } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, %Complex_Type { i16 10, i16 20, float 3.050000e+01 }, [2 x %Complex_Type] [%Complex_Type { i16 1, i16 2, float 3.500000e+00 }, %Complex_Type { i16 4, i16 5, float 6.500000e+00 }] } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %data = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %arr_data = getelementptr inbounds %parent, %parent* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %data = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %arr_data = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define void @child__test(%child* %0) { + define void @child__test(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 %local_data = alloca %Complex_Type, align 8 - %1 = bitcast %Complex_Type* %local_data to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%Complex_Type* @__Complex_Type__init to i8*), i64 ptrtoint (%Complex_Type* getelementptr (%Complex_Type, %Complex_Type* null, i32 1) to i64), i1 false) - call void @__init_complex_type(%Complex_Type* %local_data) - call void @__user_init_Complex_Type(%Complex_Type* %local_data) - %x = getelementptr inbounds %Complex_Type, %Complex_Type* %local_data, i32 0, i32 0 - %data = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %x1 = getelementptr inbounds %Complex_Type, %Complex_Type* %data, i32 0, i32 0 - %load_x = load i16, i16* %x1, align 2 - store i16 %load_x, i16* %x, align 2 - %y = getelementptr inbounds %Complex_Type, %Complex_Type* %local_data, i32 0, i32 1 - %data2 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %y3 = getelementptr inbounds %Complex_Type, %Complex_Type* %data2, i32 0, i32 1 - %load_y = load i16, i16* %y3, align 2 - store i16 %load_y, i16* %y, align 2 - %z = getelementptr inbounds %Complex_Type, %Complex_Type* %local_data, i32 0, i32 2 - %data4 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %z5 = getelementptr inbounds %Complex_Type, %Complex_Type* %data4, i32 0, i32 2 - %load_z = load float, float* %z5, align 4 - store float %load_z, float* %z, align 4 - %arr_data = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %tmpVar = getelementptr inbounds [2 x %Complex_Type], [2 x %Complex_Type]* %arr_data, i32 0, i32 0 - %x6 = getelementptr inbounds %Complex_Type, %Complex_Type* %tmpVar, i32 0, i32 0 - %arr_data7 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %tmpVar8 = getelementptr inbounds [2 x %Complex_Type], [2 x %Complex_Type]* %arr_data7, i32 0, i32 1 - %x9 = getelementptr inbounds %Complex_Type, %Complex_Type* %tmpVar8, i32 0, i32 0 - %load_x10 = load i16, i16* %x9, align 2 - store i16 %load_x10, i16* %x6, align 2 - %arr_data11 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 2 - %tmpVar12 = getelementptr inbounds [2 x %Complex_Type], [2 x %Complex_Type]* %arr_data11, i32 0, i32 0 - %z13 = getelementptr inbounds %Complex_Type, %Complex_Type* %tmpVar12, i32 0, i32 2 - %data14 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %z15 = getelementptr inbounds %Complex_Type, %Complex_Type* %data14, i32 0, i32 2 - %load_z16 = load float, float* %z15, align 4 - store float %load_z16, float* %z13, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %local_data, ptr align 1 @__Complex_Type__init, i64 ptrtoint (ptr getelementptr (%Complex_Type, ptr null, i32 1) to i64), i1 false) + call void @__init_complex_type(ptr %local_data) + call void @__user_init_Complex_Type(ptr %local_data) + %x = getelementptr inbounds nuw %Complex_Type, ptr %local_data, i32 0, i32 0 + %data = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %x1 = getelementptr inbounds nuw %Complex_Type, ptr %data, i32 0, i32 0 + %load_x = load i16, ptr %x1, align 2 + store i16 %load_x, ptr %x, align 2 + %y = getelementptr inbounds nuw %Complex_Type, ptr %local_data, i32 0, i32 1 + %data2 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %y3 = getelementptr inbounds nuw %Complex_Type, ptr %data2, i32 0, i32 1 + %load_y = load i16, ptr %y3, align 2 + store i16 %load_y, ptr %y, align 2 + %z = getelementptr inbounds nuw %Complex_Type, ptr %local_data, i32 0, i32 2 + %data4 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %z5 = getelementptr inbounds nuw %Complex_Type, ptr %data4, i32 0, i32 2 + %load_z = load float, ptr %z5, align 4 + store float %load_z, ptr %z, align 4 + %arr_data = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %tmpVar = getelementptr inbounds [2 x %Complex_Type], ptr %arr_data, i32 0, i32 0 + %x6 = getelementptr inbounds nuw %Complex_Type, ptr %tmpVar, i32 0, i32 0 + %arr_data7 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %tmpVar8 = getelementptr inbounds [2 x %Complex_Type], ptr %arr_data7, i32 0, i32 1 + %x9 = getelementptr inbounds nuw %Complex_Type, ptr %tmpVar8, i32 0, i32 0 + %load_x10 = load i16, ptr %x9, align 2 + store i16 %load_x10, ptr %x6, align 2 + %arr_data11 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 2 + %tmpVar12 = getelementptr inbounds [2 x %Complex_Type], ptr %arr_data11, i32 0, i32 0 + %z13 = getelementptr inbounds nuw %Complex_Type, ptr %tmpVar12, i32 0, i32 2 + %data14 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %z15 = getelementptr inbounds nuw %Complex_Type, ptr %data14, i32 0, i32 2 + %load_z16 = load float, ptr %z15, align 4 + store float %load_z16, ptr %z13, align 4 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %test = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store void (%child*)* @child__test, void (%child*)** %test, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_child, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %test = getelementptr inbounds nuw %__vtable_child, ptr %deref1, i32 0, i32 1 + store ptr @child__test, ptr %test, align 8 ret void } - define void @__init_complex_type(%Complex_Type* %0) { + define void @__init_complex_type(ptr %0) { entry: - %self = alloca %Complex_Type*, align 8 - store %Complex_Type* %0, %Complex_Type** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %data = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 1 - call void @__init_complex_type(%Complex_Type* %data) - %deref1 = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %data = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 1 + call void @__init_complex_type(ptr %data) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_Complex_Type(%Complex_Type* %0) { + define void @__user_init_Complex_Type(ptr %0) { entry: - %self = alloca %Complex_Type*, align 8 - store %Complex_Type* %0, %Complex_Type** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %data = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 1 - call void @__user_init_Complex_Type(%Complex_Type* %data) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %data = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 1 + call void @__user_init_Complex_Type(ptr %data) ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -2853,153 +2850,153 @@ fn super_in_action_blocks() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_parent = type { void (%parent*)*, void (%parent*)* } - %parent = type { i32*, i16 } - %__vtable_child = type { void (%child*)*, void (%parent*)* } + %__vtable_parent = type { ptr, ptr } + %parent = type { ptr, i16 } + %__vtable_child = type { ptr, ptr } %child = type { %parent } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_parent__init = unnamed_addr constant %__vtable_parent zeroinitializer - @__parent__init = unnamed_addr constant %parent { i32* null, i16 10 } + @__parent__init = unnamed_addr constant %parent { ptr null, i16 10 } @__vtable_parent_instance = global %__vtable_parent zeroinitializer @____vtable_child__init = unnamed_addr constant %__vtable_child zeroinitializer - @__child__init = unnamed_addr constant %child { %parent { i32* null, i16 10 } } + @__child__init = unnamed_addr constant %child { %parent { ptr null, i16 10 } } @__vtable_child_instance = global %__vtable_child zeroinitializer - define void @parent(%parent* %0) { + define void @parent(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 ret void } - define void @parent__increment(%parent* %0) { + define void @parent__increment(ptr %0) { entry: - %this = alloca %parent*, align 8 - store %parent* %0, %parent** %this, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %0, i32 0, i32 1 - %load_value = load i16, i16* %value, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %0, i32 0, i32 1 + %load_value = load i16, ptr %value, align 2 %1 = sext i16 %load_value to i32 %tmpVar = add i32 %1, 1 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %value, align 2 + store i16 %2, ptr %value, align 2 ret void } - define void @child(%child* %0) { + define void @child(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 ret void } - define void @child__increase(%child* %0) { + define void @child__increase(ptr %0) { entry: - %this = alloca %child*, align 8 - store %child* %0, %child** %this, align 8 - %__parent = getelementptr inbounds %child, %child* %0, i32 0, i32 0 - %value = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %value1 = getelementptr inbounds %parent, %parent* %__parent, i32 0, i32 1 - %load_value = load i16, i16* %value1, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %0, i32 0, i32 0 + %value = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %value1 = getelementptr inbounds nuw %parent, ptr %__parent, i32 0, i32 1 + %load_value = load i16, ptr %value1, align 2 %1 = sext i16 %load_value to i32 %tmpVar = add i32 %1, 5 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %value, align 2 - call void @parent__increment(%parent* %__parent) + store i16 %2, ptr %value, align 2 + call void @parent__increment(ptr %__parent) ret void } - define void @__init___vtable_parent(%__vtable_parent* %0) { + define void @__init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 - %deref = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %__body = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref, i32 0, i32 0 - store void (%parent*)* @parent, void (%parent*)** %__body, align 8 - %deref1 = load %__vtable_parent*, %__vtable_parent** %self, align 8 - %increment = getelementptr inbounds %__vtable_parent, %__vtable_parent* %deref1, i32 0, i32 1 - store void (%parent*)* @parent__increment, void (%parent*)** %increment, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @parent, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %increment = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @parent__increment, ptr %increment, align 8 ret void } - define void @__init___vtable_child(%__vtable_child* %0) { + define void @__init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 - %deref = load %__vtable_child*, %__vtable_child** %self, align 8 - %__body = getelementptr inbounds %__vtable_child, %__vtable_child* %deref, i32 0, i32 0 - store void (%child*)* @child, void (%child*)** %__body, align 8 - %deref1 = load %__vtable_child*, %__vtable_child** %self, align 8 - %increment = getelementptr inbounds %__vtable_child, %__vtable_child* %deref1, i32 0, i32 1 - store void (%parent*)* @parent__increment, void (%parent*)** %increment, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_parent, ptr %deref, i32 0, i32 0 + store ptr @child, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %increment = getelementptr inbounds nuw %__vtable_parent, ptr %deref1, i32 0, i32 1 + store ptr @parent__increment, ptr %increment, align 8 ret void } - define void @__init_parent(%parent* %0) { + define void @__init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 - %deref = load %parent*, %parent** %self, align 8 - %__vtable = getelementptr inbounds %parent, %parent* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_parent* @__vtable_parent_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %parent, ptr %deref, i32 0, i32 0 + store ptr @__vtable_parent_instance, ptr %__vtable, align 8 ret void } - define void @__init_child(%child* %0) { + define void @__init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__init_parent(%parent* %__parent) - %deref1 = load %child*, %child** %self, align 8 - %__parent2 = getelementptr inbounds %child, %child* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %parent, %parent* %__parent2, i32 0, i32 0 - store i32* bitcast (%__vtable_child* @__vtable_child_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__init_parent(ptr %__parent) + %deref1 = load ptr, ptr %self, align 8 + %__parent2 = getelementptr inbounds nuw %child, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %parent, ptr %__parent2, i32 0, i32 0 + store ptr @__vtable_child_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_parent(%parent* %0) { + define void @__user_init_parent(ptr %0) { entry: - %self = alloca %parent*, align 8 - store %parent* %0, %parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_child(%__vtable_child* %0) { + define void @__user_init___vtable_child(ptr %0) { entry: - %self = alloca %__vtable_child*, align 8 - store %__vtable_child* %0, %__vtable_child** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_child(%child* %0) { + define void @__user_init_child(ptr %0) { entry: - %self = alloca %child*, align 8 - store %child* %0, %child** %self, align 8 - %deref = load %child*, %child** %self, align 8 - %__parent = getelementptr inbounds %child, %child* %deref, i32 0, i32 0 - call void @__user_init_parent(%parent* %__parent) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__parent = getelementptr inbounds nuw %child, ptr %deref, i32 0, i32 0 + call void @__user_init_parent(ptr %__parent) ret void } - define void @__user_init___vtable_parent(%__vtable_parent* %0) { + define void @__user_init___vtable_parent(ptr %0) { entry: - %self = alloca %__vtable_parent*, align 8 - store %__vtable_parent* %0, %__vtable_parent** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__init___vtable_child(%__vtable_child* @__vtable_child_instance) - call void @__user_init___vtable_parent(%__vtable_parent* @__vtable_parent_instance) - call void @__user_init___vtable_child(%__vtable_child* @__vtable_child_instance) + call void @__init___vtable_parent(ptr @__vtable_parent_instance) + call void @__init___vtable_child(ptr @__vtable_child_instance) + call void @__user_init___vtable_parent(ptr @__vtable_parent_instance) + call void @__user_init___vtable_child(ptr @__vtable_child_instance) ret void } "#); diff --git a/src/codegen/tests/parameters_tests.rs b/src/codegen/tests/parameters_tests.rs index b2639216a09..66c75a6339d 100644 --- a/src/codegen/tests/parameters_tests.rs +++ b/src/codegen/tests/parameters_tests.rs @@ -717,35 +717,32 @@ fn by_value_function_arg_builtin_type_strings_are_memcopied() { entry: %main = alloca i32, align 4 %str = alloca [81 x i8], align 1 - %0 = bitcast [81 x i8]* %str to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %1 = bitcast [81 x i8]* %str to i8* - %call = call i32 @foo(i8* %1) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %str, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @foo(ptr %str) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - define i32 @foo(i8* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 %val = alloca [81 x i8], align 1 - %bitcast = bitcast [81 x i8]* %val to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 81, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 80, i1 false) - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %val, i8 0, i64 81, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 80, i1 false) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -778,35 +775,32 @@ fn by_value_function_arg_user_type_strings_are_memcopied() { entry: %main = alloca i32, align 4 %str = alloca [65537 x i8], align 1 - %0 = bitcast [65537 x i8]* %str to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([65537 x i8]* getelementptr ([65537 x i8], [65537 x i8]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %1 = bitcast [65537 x i8]* %str to i8* - %call = call i32 @foo(i8* %1) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %str, i8 0, i64 ptrtoint (ptr getelementptr ([65537 x i8], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @foo(ptr %str) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - define i32 @foo(i8* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 %val = alloca [65537 x i8], align 1 - %bitcast = bitcast [65537 x i8]* %val to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 65537, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 65536, i1 false) - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %val, i8 0, i64 65537, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 65536, i1 false) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -839,36 +833,31 @@ fn by_value_function_arg_arrays_are_memcopied() { entry: %main = alloca i32, align 4 %arr = alloca [65537 x i32], align 4 - %0 = bitcast [65537 x i32]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([65537 x i32]* getelementptr ([65537 x i32], [65537 x i32]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %1 = bitcast [65537 x i32]* %arr to i32* - %call = call i32 @foo(i32* %1) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([65537 x i32], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @foo(ptr %arr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - define i32 @foo(i32* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 %val = alloca [65537 x i32], align 4 - %bitcast = bitcast [65537 x i32]* %val to i32* - %1 = bitcast i32* %bitcast to i8* - %2 = bitcast i32* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint ([65537 x i32]* getelementptr ([65537 x i32], [65537 x i32]* null, i32 1) to i64), i1 false) - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 ptrtoint (ptr getelementptr ([65537 x i32], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -907,15 +896,13 @@ fn by_value_function_arg_structs_are_memcopied() { @__S_TY__init = unnamed_addr constant %S_TY zeroinitializer - define i32 @foo(%S_TY* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 %val = alloca %S_TY, align 8 - %1 = bitcast %S_TY* %val to i8* - %2 = bitcast %S_TY* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%S_TY* getelementptr (%S_TY, %S_TY* null, i32 1) to i64), i1 false) - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%S_TY, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } @@ -923,18 +910,17 @@ fn by_value_function_arg_structs_are_memcopied() { entry: %main = alloca i32, align 4 %s = alloca %S_TY, align 8 - %0 = bitcast %S_TY* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%S_TY, %S_TY* @__S_TY__init, i32 0, i32 0), i64 ptrtoint (%S_TY* getelementptr (%S_TY, %S_TY* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %call = call i32 @foo(%S_TY* %s) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %s, ptr align 1 @__S_TY__init, i64 ptrtoint (ptr getelementptr (%S_TY, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @foo(ptr %s) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -982,15 +968,13 @@ fn by_value_function_arg_structs_with_aggregate_members_are_memcopied() { @__AGGREGATE_COLLECTOR_TY__init = unnamed_addr constant %AGGREGATE_COLLECTOR_TY zeroinitializer @__S_TY__init = unnamed_addr constant %S_TY zeroinitializer - define i32 @foo(%AGGREGATE_COLLECTOR_TY* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 %val = alloca %AGGREGATE_COLLECTOR_TY, align 8 - %1 = bitcast %AGGREGATE_COLLECTOR_TY* %val to i8* - %2 = bitcast %AGGREGATE_COLLECTOR_TY* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%AGGREGATE_COLLECTOR_TY* getelementptr (%AGGREGATE_COLLECTOR_TY, %AGGREGATE_COLLECTOR_TY* null, i32 1) to i64), i1 false) - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %val, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%AGGREGATE_COLLECTOR_TY, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } @@ -998,18 +982,17 @@ fn by_value_function_arg_structs_with_aggregate_members_are_memcopied() { entry: %main = alloca i32, align 4 %s = alloca %AGGREGATE_COLLECTOR_TY, align 8 - %0 = bitcast %AGGREGATE_COLLECTOR_TY* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%AGGREGATE_COLLECTOR_TY* @__AGGREGATE_COLLECTOR_TY__init to i8*), i64 ptrtoint (%AGGREGATE_COLLECTOR_TY* getelementptr (%AGGREGATE_COLLECTOR_TY, %AGGREGATE_COLLECTOR_TY* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %call = call i32 @foo(%AGGREGATE_COLLECTOR_TY* %s) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %s, ptr align 1 @__AGGREGATE_COLLECTOR_TY__init, i64 ptrtoint (ptr getelementptr (%AGGREGATE_COLLECTOR_TY, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @foo(ptr %s) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1051,46 +1034,39 @@ fn by_value_fb_arg_aggregates_are_memcopied() { %str = alloca [65537 x i8], align 1 %arr = alloca [1024 x i32], align 4 %fb = alloca %FOO, align 8 - %0 = bitcast [65537 x i8]* %str to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([65537 x i8]* getelementptr ([65537 x i8], [65537 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [1024 x i32]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([1024 x i32]* getelementptr ([1024 x i32], [1024 x i32]* null, i32 1) to i64), i1 false) - %2 = bitcast %FOO* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 getelementptr inbounds (%FOO, %FOO* @__FOO__init, i32 0, i32 0, i32 0), i64 ptrtoint (%FOO* getelementptr (%FOO, %FOO* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %3 = getelementptr inbounds %FOO, %FOO* %fb, i32 0, i32 0 - %4 = bitcast [65537 x i8]* %3 to i8* - %5 = bitcast [65537 x i8]* %str to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %4, i8* align 1 %5, i32 65536, i1 false) - %6 = getelementptr inbounds %FOO, %FOO* %fb, i32 0, i32 1 - %7 = bitcast [1024 x i32]* %6 to i8* - %8 = bitcast [1024 x i32]* %arr to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %7, i8* align 1 %8, i64 ptrtoint ([1024 x i32]* getelementptr ([1024 x i32], [1024 x i32]* null, i32 1) to i64), i1 false) - call void @FOO(%FOO* %fb) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %str, i8 0, i64 ptrtoint (ptr getelementptr ([65537 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([1024 x i32], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__FOO__init, i64 ptrtoint (ptr getelementptr (%FOO, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %0 = getelementptr inbounds nuw %FOO, ptr %fb, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %0, ptr align 1 %str, i32 65536, i1 false) + %1 = getelementptr inbounds nuw %FOO, ptr %fb, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %1, ptr align 1 %arr, i64 ptrtoint (ptr getelementptr ([1024 x i32], ptr null, i32 1) to i64), i1 false) + call void @FOO(ptr %fb) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - define void @FOO(%FOO* %0) { + define void @FOO(ptr %0) { entry: - %this = alloca %FOO*, align 8 - store %FOO* %0, %FOO** %this, align 8 - %val = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 0 - %field = getelementptr inbounds %FOO, %FOO* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %val = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 0 + %field = getelementptr inbounds nuw %FOO, ptr %0, i32 0, i32 1 ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1141,57 +1117,47 @@ fn var_output_aggregate_types_are_memcopied() { @__OUT_TYPE__init = unnamed_addr constant %OUT_TYPE zeroinitializer @PRG_instance = global %PRG zeroinitializer - define void @FB(%FB* %0) { + define void @FB(ptr %0) { entry: - %this = alloca %FB*, align 8 - store %FB* %0, %FB** %this, align 8 - %output = getelementptr inbounds %FB, %FB* %0, i32 0, i32 0 - %output2 = getelementptr inbounds %FB, %FB* %0, i32 0, i32 1 - %output3 = getelementptr inbounds %FB, %FB* %0, i32 0, i32 2 - %output4 = getelementptr inbounds %FB, %FB* %0, i32 0, i32 3 - %output5 = getelementptr inbounds %FB, %FB* %0, i32 0, i32 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %output = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 0 + %output2 = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 1 + %output3 = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 2 + %output4 = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 3 + %output5 = getelementptr inbounds nuw %FB, ptr %0, i32 0, i32 4 ret void } - define void @PRG(%PRG* %0) { + define void @PRG(ptr %0) { entry: - %out = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 0 - %out2 = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 1 - %out3 = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 2 - %out4 = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 3 - %out5 = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 4 - %station = getelementptr inbounds %PRG, %PRG* %0, i32 0, i32 5 - call void @FB(%FB* %station) - %1 = getelementptr inbounds %FB, %FB* %station, i32 0, i32 0 - %2 = bitcast %OUT_TYPE* %out to i8* - %3 = bitcast %OUT_TYPE* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 %3, i64 ptrtoint (%OUT_TYPE* getelementptr (%OUT_TYPE, %OUT_TYPE* null, i32 1) to i64), i1 false) - %4 = getelementptr inbounds %FB, %FB* %station, i32 0, i32 1 - %5 = bitcast [11 x i32]* %out2 to i8* - %6 = bitcast [11 x i32]* %4 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 %6, i64 ptrtoint ([11 x i32]* getelementptr ([11 x i32], [11 x i32]* null, i32 1) to i64), i1 false) - %7 = getelementptr inbounds %FB, %FB* %station, i32 0, i32 2 - %8 = bitcast [11 x %OUT_TYPE]* %out3 to i8* - %9 = bitcast [11 x %OUT_TYPE]* %7 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %8, i8* align 1 %9, i64 ptrtoint ([11 x %OUT_TYPE]* getelementptr ([11 x %OUT_TYPE], [11 x %OUT_TYPE]* null, i32 1) to i64), i1 false) - %10 = getelementptr inbounds %FB, %FB* %station, i32 0, i32 3 - %11 = bitcast [81 x i8]* %out4 to i8* - %12 = bitcast [81 x i8]* %10 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %11, i8* align 1 %12, i32 80, i1 false) - %13 = getelementptr inbounds %FB, %FB* %station, i32 0, i32 4 - %14 = bitcast [81 x i16]* %out5 to i8* - %15 = bitcast [81 x i16]* %13 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %14, i8* align 2 %15, i32 160, i1 false) + %out = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 0 + %out2 = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 1 + %out3 = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 2 + %out4 = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 3 + %out5 = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 4 + %station = getelementptr inbounds nuw %PRG, ptr %0, i32 0, i32 5 + call void @FB(ptr %station) + %1 = getelementptr inbounds nuw %FB, ptr %station, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %out, ptr align 1 %1, i64 ptrtoint (ptr getelementptr (%OUT_TYPE, ptr null, i32 1) to i64), i1 false) + %2 = getelementptr inbounds nuw %FB, ptr %station, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %out2, ptr align 1 %2, i64 ptrtoint (ptr getelementptr ([11 x i32], ptr null, i32 1) to i64), i1 false) + %3 = getelementptr inbounds nuw %FB, ptr %station, i32 0, i32 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %out3, ptr align 1 %3, i64 ptrtoint (ptr getelementptr ([11 x %OUT_TYPE], ptr null, i32 1) to i64), i1 false) + %4 = getelementptr inbounds nuw %FB, ptr %station, i32 0, i32 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %out4, ptr align 1 %4, i32 80, i1 false) + %5 = getelementptr inbounds nuw %FB, ptr %station, i32 0, i32 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %out5, ptr align 2 %5, i32 160, i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -1216,7 +1182,7 @@ fn array_of_string_parameter_with_stride_calculation() { ", ); - filtered_assert_snapshot!(result, @r###" + filtered_assert_snapshot!(result, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" @@ -1225,38 +1191,36 @@ fn array_of_string_parameter_with_stride_calculation() { @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"Hello\00" @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"World\00" - define void @foo(i8* %0) { + define void @foo(ptr %0) { entry: - %strings = alloca i8*, align 8 - store i8* %0, i8** %strings, align 8 - %deref = load i8*, i8** %strings, align 8 - %tmpVar = getelementptr inbounds i8, i8* %deref, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref1 = load i8*, i8** %strings, align 8 - %tmpVar2 = getelementptr inbounds i8, i8* %deref1, i32 81 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar2, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) + %strings = alloca ptr, align 8 + store ptr %0, ptr %strings, align 8 + %deref = load ptr, ptr %strings, align 8 + %tmpVar = getelementptr inbounds [2 x [81 x i8]], ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref1 = load ptr, ptr %strings, align 8 + %tmpVar2 = getelementptr inbounds [2 x [81 x i8]], ptr %deref1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_1, i32 6, i1 false) ret void } define void @main() { entry: %arr = alloca [2 x [81 x i8]], align 1 - %0 = bitcast [2 x [81 x i8]]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x [81 x i8]]* getelementptr ([2 x [81 x i8]], [2 x [81 x i8]]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x [81 x i8]]* %arr to i8* - call void @foo(i8* %1) + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [81 x i8]], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %arr) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } - "###) + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } + "#) } #[test] @@ -1288,43 +1252,41 @@ fn array_of_array_integer_parameter_with_stride_calculation() { target datalayout = "[filtered]" target triple = "[filtered]" - define void @foo(i32* %0) { + define void @foo(ptr %0) { entry: - %numbers = alloca i32*, align 8 - store i32* %0, i32** %numbers, align 8 - %deref = load i32*, i32** %numbers, align 8 - %tmpVar = getelementptr inbounds i32, i32* %deref, i32 0 - %tmpVar1 = getelementptr inbounds i32, i32* %tmpVar, i32 0 - store i32 1, i32* %tmpVar1, align 4 - %deref2 = load i32*, i32** %numbers, align 8 - %tmpVar3 = getelementptr inbounds i32, i32* %deref2, i32 0 - %tmpVar4 = getelementptr inbounds i32, i32* %tmpVar3, i32 1 - store i32 2, i32* %tmpVar4, align 4 - %deref5 = load i32*, i32** %numbers, align 8 - %tmpVar6 = getelementptr inbounds i32, i32* %deref5, i32 3 - %tmpVar7 = getelementptr inbounds i32, i32* %tmpVar6, i32 0 - store i32 3, i32* %tmpVar7, align 4 - %deref8 = load i32*, i32** %numbers, align 8 - %tmpVar9 = getelementptr inbounds i32, i32* %deref8, i32 3 - %tmpVar10 = getelementptr inbounds i32, i32* %tmpVar9, i32 1 - store i32 4, i32* %tmpVar10, align 4 + %numbers = alloca ptr, align 8 + store ptr %0, ptr %numbers, align 8 + %deref = load ptr, ptr %numbers, align 8 + %tmpVar = getelementptr inbounds [2 x [3 x i32]], ptr %deref, i32 0, i32 0 + %tmpVar1 = getelementptr inbounds [3 x i32], ptr %tmpVar, i32 0, i32 0 + store i32 1, ptr %tmpVar1, align 4 + %deref2 = load ptr, ptr %numbers, align 8 + %tmpVar3 = getelementptr inbounds [2 x [3 x i32]], ptr %deref2, i32 0, i32 0 + %tmpVar4 = getelementptr inbounds [3 x i32], ptr %tmpVar3, i32 0, i32 1 + store i32 2, ptr %tmpVar4, align 4 + %deref5 = load ptr, ptr %numbers, align 8 + %tmpVar6 = getelementptr inbounds [2 x [3 x i32]], ptr %deref5, i32 0, i32 1 + %tmpVar7 = getelementptr inbounds [3 x i32], ptr %tmpVar6, i32 0, i32 0 + store i32 3, ptr %tmpVar7, align 4 + %deref8 = load ptr, ptr %numbers, align 8 + %tmpVar9 = getelementptr inbounds [2 x [3 x i32]], ptr %deref8, i32 0, i32 1 + %tmpVar10 = getelementptr inbounds [3 x i32], ptr %tmpVar9, i32 0, i32 1 + store i32 4, ptr %tmpVar10, align 4 ret void } define void @main() { entry: %arr = alloca [2 x [3 x i32]], align 4 - %0 = bitcast [2 x [3 x i32]]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x [3 x i32]]* getelementptr ([2 x [3 x i32]], [2 x [3 x i32]]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x [3 x i32]]* %arr to i32* - call void @foo(i32* %1) + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [3 x i32]], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %arr) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#) } @@ -1359,37 +1321,35 @@ fn mixed_string_lengths_parameter_compatibility() { @utf08_literal_0 = private unnamed_addr constant [4 x i8] c"Bye\00" @utf08_literal_1 = private unnamed_addr constant [3 x i8] c"Hi\00" - define void @foo(i8* %0) { + define void @foo(ptr %0) { entry: - %short_strings = alloca i8*, align 8 - store i8* %0, i8** %short_strings, align 8 - %deref = load i8*, i8** %short_strings, align 8 - %tmpVar = getelementptr inbounds i8, i8* %deref, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar, i8* align 1 getelementptr inbounds ([3 x i8], [3 x i8]* @utf08_literal_1, i32 0, i32 0), i32 3, i1 false) - %deref1 = load i8*, i8** %short_strings, align 8 - %tmpVar2 = getelementptr inbounds i8, i8* %deref1, i32 11 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar2, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 4, i1 false) + %short_strings = alloca ptr, align 8 + store ptr %0, ptr %short_strings, align 8 + %deref = load ptr, ptr %short_strings, align 8 + %tmpVar = getelementptr inbounds [2 x [11 x i8]], ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_1, i32 3, i1 false) + %deref1 = load ptr, ptr %short_strings, align 8 + %tmpVar2 = getelementptr inbounds [2 x [11 x i8]], ptr %deref1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_0, i32 4, i1 false) ret void } define void @main() { entry: %long_strings = alloca [2 x [81 x i8]], align 1 - %0 = bitcast [2 x [81 x i8]]* %long_strings to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x [81 x i8]]* getelementptr ([2 x [81 x i8]], [2 x [81 x i8]]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x [81 x i8]]* %long_strings to i8* - call void @foo(i8* %1) + call void @llvm.memset.p0.i64(ptr align 1 %long_strings, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [81 x i8]], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %long_strings) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#) } @@ -1421,7 +1381,7 @@ fn program_with_array_of_string_parameter_stride_calculation() { target datalayout = "[filtered]" target triple = "[filtered]" - %StringProcessor = type { [3 x [51 x i8]]* } + %StringProcessor = type { ptr } %main = type { [3 x [51 x i8]] } @StringProcessor_instance = global %StringProcessor zeroinitializer @@ -1430,36 +1390,33 @@ fn program_with_array_of_string_parameter_stride_calculation() { @utf08_literal_1 = private unnamed_addr constant [7 x i8] c"Second\00" @utf08_literal_2 = private unnamed_addr constant [6 x i8] c"Third\00" - define void @StringProcessor(%StringProcessor* %0) { + define void @StringProcessor(ptr %0) { entry: - %messages = getelementptr inbounds %StringProcessor, %StringProcessor* %0, i32 0, i32 0 - %deref = load [3 x [51 x i8]]*, [3 x [51 x i8]]** %messages, align 8 - %tmpVar = getelementptr inbounds [3 x [51 x i8]], [3 x [51 x i8]]* %deref, i32 0, i32 0 - %1 = bitcast [51 x i8]* %tmpVar to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref1 = load [3 x [51 x i8]]*, [3 x [51 x i8]]** %messages, align 8 - %tmpVar2 = getelementptr inbounds [3 x [51 x i8]], [3 x [51 x i8]]* %deref1, i32 0, i32 1 - %2 = bitcast [51 x i8]* %tmpVar2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([7 x i8], [7 x i8]* @utf08_literal_1, i32 0, i32 0), i32 7, i1 false) - %deref3 = load [3 x [51 x i8]]*, [3 x [51 x i8]]** %messages, align 8 - %tmpVar4 = getelementptr inbounds [3 x [51 x i8]], [3 x [51 x i8]]* %deref3, i32 0, i32 2 - %3 = bitcast [51 x i8]* %tmpVar4 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_2, i32 0, i32 0), i32 6, i1 false) + %messages = getelementptr inbounds nuw %StringProcessor, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %messages, align 8 + %tmpVar = getelementptr inbounds [3 x [51 x i8]], ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref1 = load ptr, ptr %messages, align 8 + %tmpVar2 = getelementptr inbounds [3 x [51 x i8]], ptr %deref1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_1, i32 7, i1 false) + %deref3 = load ptr, ptr %messages, align 8 + %tmpVar4 = getelementptr inbounds [3 x [51 x i8]], ptr %deref3, i32 0, i32 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar4, ptr align 1 @utf08_literal_2, i32 6, i1 false) ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %text_array = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - store [3 x [51 x i8]]* %text_array, [3 x [51 x i8]]** getelementptr inbounds (%StringProcessor, %StringProcessor* @StringProcessor_instance, i32 0, i32 0), align 8 - call void @StringProcessor(%StringProcessor* @StringProcessor_instance) + %text_array = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + store ptr %text_array, ptr @StringProcessor_instance, align 8 + call void @StringProcessor(ptr @StringProcessor_instance) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1493,43 +1450,43 @@ fn function_block_with_array_of_array_parameter_stride_calculation() { target datalayout = "[filtered]" target triple = "[filtered]" - %MatrixProcessor = type { [2 x [4 x float]]* } + %MatrixProcessor = type { ptr } %main = type { %MatrixProcessor, [2 x [4 x float]] } @__MatrixProcessor__init = unnamed_addr constant %MatrixProcessor zeroinitializer @main_instance = global %main zeroinitializer - define void @MatrixProcessor(%MatrixProcessor* %0) { + define void @MatrixProcessor(ptr %0) { entry: - %this = alloca %MatrixProcessor*, align 8 - store %MatrixProcessor* %0, %MatrixProcessor** %this, align 8 - %matrix = getelementptr inbounds %MatrixProcessor, %MatrixProcessor* %0, i32 0, i32 0 - %deref = load [2 x [4 x float]]*, [2 x [4 x float]]** %matrix, align 8 - %tmpVar = getelementptr inbounds [2 x [4 x float]], [2 x [4 x float]]* %deref, i32 0, i32 0 - %tmpVar1 = getelementptr inbounds [4 x float], [4 x float]* %tmpVar, i32 0, i32 0 - store float 0x3FF19999A0000000, float* %tmpVar1, align 4 - %deref2 = load [2 x [4 x float]]*, [2 x [4 x float]]** %matrix, align 8 - %tmpVar3 = getelementptr inbounds [2 x [4 x float]], [2 x [4 x float]]* %deref2, i32 0, i32 0 - %tmpVar4 = getelementptr inbounds [4 x float], [4 x float]* %tmpVar3, i32 0, i32 1 - store float 0x40019999A0000000, float* %tmpVar4, align 4 - %deref5 = load [2 x [4 x float]]*, [2 x [4 x float]]** %matrix, align 8 - %tmpVar6 = getelementptr inbounds [2 x [4 x float]], [2 x [4 x float]]* %deref5, i32 0, i32 1 - %tmpVar7 = getelementptr inbounds [4 x float], [4 x float]* %tmpVar6, i32 0, i32 0 - store float 0x400A666660000000, float* %tmpVar7, align 4 - %deref8 = load [2 x [4 x float]]*, [2 x [4 x float]]** %matrix, align 8 - %tmpVar9 = getelementptr inbounds [2 x [4 x float]], [2 x [4 x float]]* %deref8, i32 0, i32 1 - %tmpVar10 = getelementptr inbounds [4 x float], [4 x float]* %tmpVar9, i32 0, i32 1 - store float 0x40119999A0000000, float* %tmpVar10, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %matrix = getelementptr inbounds nuw %MatrixProcessor, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %matrix, align 8 + %tmpVar = getelementptr inbounds [2 x [4 x float]], ptr %deref, i32 0, i32 0 + %tmpVar1 = getelementptr inbounds [4 x float], ptr %tmpVar, i32 0, i32 0 + store float 0x3FF19999A0000000, ptr %tmpVar1, align 4 + %deref2 = load ptr, ptr %matrix, align 8 + %tmpVar3 = getelementptr inbounds [2 x [4 x float]], ptr %deref2, i32 0, i32 0 + %tmpVar4 = getelementptr inbounds [4 x float], ptr %tmpVar3, i32 0, i32 1 + store float 0x40019999A0000000, ptr %tmpVar4, align 4 + %deref5 = load ptr, ptr %matrix, align 8 + %tmpVar6 = getelementptr inbounds [2 x [4 x float]], ptr %deref5, i32 0, i32 1 + %tmpVar7 = getelementptr inbounds [4 x float], ptr %tmpVar6, i32 0, i32 0 + store float 0x400A666660000000, ptr %tmpVar7, align 4 + %deref8 = load ptr, ptr %matrix, align 8 + %tmpVar9 = getelementptr inbounds [2 x [4 x float]], ptr %deref8, i32 0, i32 1 + %tmpVar10 = getelementptr inbounds [4 x float], ptr %tmpVar9, i32 0, i32 1 + store float 0x40119999A0000000, ptr %tmpVar10, align 4 ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %processor = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %data = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %1 = getelementptr inbounds %MatrixProcessor, %MatrixProcessor* %processor, i32 0, i32 0 - store [2 x [4 x float]]* %data, [2 x [4 x float]]** %1, align 8 - call void @MatrixProcessor(%MatrixProcessor* %processor) + %processor = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %data = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %1 = getelementptr inbounds nuw %MatrixProcessor, ptr %processor, i32 0, i32 0 + store ptr %data, ptr %1, align 8 + call void @MatrixProcessor(ptr %processor) ret void } "#) @@ -1573,37 +1530,36 @@ fn method_with_var_in_out_array_of_strings() { @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"Hello\00" @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"World\00" - define void @StringHandler(%StringHandler* %0) { + define void @StringHandler(ptr %0) { entry: ret void } - define void @StringHandler__process_strings(%StringHandler* %0, i8* %1) { + define void @StringHandler__process_strings(ptr %0, ptr %1) { entry: - %string_list = alloca i8*, align 8 - store i8* %1, i8** %string_list, align 8 - %deref = load i8*, i8** %string_list, align 8 - %tmpVar = getelementptr inbounds i8, i8* %deref, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref1 = load i8*, i8** %string_list, align 8 - %tmpVar2 = getelementptr inbounds i8, i8* %deref1, i32 31 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar2, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) + %string_list = alloca ptr, align 8 + store ptr %1, ptr %string_list, align 8 + %deref = load ptr, ptr %string_list, align 8 + %tmpVar = getelementptr inbounds [2 x [31 x i8]], ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref1 = load ptr, ptr %string_list, align 8 + %tmpVar2 = getelementptr inbounds [2 x [31 x i8]], ptr %deref1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_1, i32 6, i1 false) ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %handler = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %my_strings = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %1 = bitcast [2 x [31 x i8]]* %my_strings to i8* - call void @StringHandler__process_strings(%StringHandler* %handler, i8* %1) + %handler = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %my_strings = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + call void @StringHandler__process_strings(ptr %handler, ptr %my_strings) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1645,44 +1601,43 @@ fn method_with_var_in_out_nested_integer_arrays() { @__DataProcessor__init = unnamed_addr constant %DataProcessor zeroinitializer @main_instance = global %main zeroinitializer - define void @DataProcessor(%DataProcessor* %0) { + define void @DataProcessor(ptr %0) { entry: - %this = alloca %DataProcessor*, align 8 - store %DataProcessor* %0, %DataProcessor** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define void @DataProcessor__process_matrix(%DataProcessor* %0, i32* %1) { + define void @DataProcessor__process_matrix(ptr %0, ptr %1) { entry: - %this = alloca %DataProcessor*, align 8 - store %DataProcessor* %0, %DataProcessor** %this, align 8 - %data = alloca i32*, align 8 - store i32* %1, i32** %data, align 8 - %deref = load i32*, i32** %data, align 8 - %tmpVar = getelementptr inbounds i32, i32* %deref, i32 0 - %tmpVar1 = getelementptr inbounds i32, i32* %tmpVar, i32 0 - store i32 10, i32* %tmpVar1, align 4 - %deref2 = load i32*, i32** %data, align 8 - %tmpVar3 = getelementptr inbounds i32, i32* %deref2, i32 0 - %tmpVar4 = getelementptr inbounds i32, i32* %tmpVar3, i32 1 - store i32 20, i32* %tmpVar4, align 4 - %deref5 = load i32*, i32** %data, align 8 - %tmpVar6 = getelementptr inbounds i32, i32* %deref5, i32 2 - %tmpVar7 = getelementptr inbounds i32, i32* %tmpVar6, i32 0 - store i32 30, i32* %tmpVar7, align 4 - %deref8 = load i32*, i32** %data, align 8 - %tmpVar9 = getelementptr inbounds i32, i32* %deref8, i32 2 - %tmpVar10 = getelementptr inbounds i32, i32* %tmpVar9, i32 1 - store i32 40, i32* %tmpVar10, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %data = alloca ptr, align 8 + store ptr %1, ptr %data, align 8 + %deref = load ptr, ptr %data, align 8 + %tmpVar = getelementptr inbounds [2 x [2 x i32]], ptr %deref, i32 0, i32 0 + %tmpVar1 = getelementptr inbounds [2 x i32], ptr %tmpVar, i32 0, i32 0 + store i32 10, ptr %tmpVar1, align 4 + %deref2 = load ptr, ptr %data, align 8 + %tmpVar3 = getelementptr inbounds [2 x [2 x i32]], ptr %deref2, i32 0, i32 0 + %tmpVar4 = getelementptr inbounds [2 x i32], ptr %tmpVar3, i32 0, i32 1 + store i32 20, ptr %tmpVar4, align 4 + %deref5 = load ptr, ptr %data, align 8 + %tmpVar6 = getelementptr inbounds [2 x [2 x i32]], ptr %deref5, i32 0, i32 1 + %tmpVar7 = getelementptr inbounds [2 x i32], ptr %tmpVar6, i32 0, i32 0 + store i32 30, ptr %tmpVar7, align 4 + %deref8 = load ptr, ptr %data, align 8 + %tmpVar9 = getelementptr inbounds [2 x [2 x i32]], ptr %deref8, i32 0, i32 1 + %tmpVar10 = getelementptr inbounds [2 x i32], ptr %tmpVar9, i32 0, i32 1 + store i32 40, ptr %tmpVar10, align 4 ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %processor = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %matrix = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %1 = bitcast [2 x [2 x i32]]* %matrix to i32* - call void @DataProcessor__process_matrix(%DataProcessor* %processor, i32* %1) + %processor = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %matrix = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + call void @DataProcessor__process_matrix(ptr %processor, ptr %matrix) ret void } "#) @@ -1730,53 +1685,51 @@ fn method_with_mixed_array_types() { @utf08_literal_0 = private unnamed_addr constant [5 x i8] c"Data\00" @utf08_literal_1 = private unnamed_addr constant [11 x i8] c"Processing\00" - define void @ComplexHandler(%ComplexHandler* %0) { + define void @ComplexHandler(ptr %0) { entry: - %this = alloca %ComplexHandler*, align 8 - store %ComplexHandler* %0, %ComplexHandler** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } - define void @ComplexHandler__handle_data(%ComplexHandler* %0, i8* %1, i16* %2) { + define void @ComplexHandler__handle_data(ptr %0, ptr %1, ptr %2) { entry: - %this = alloca %ComplexHandler*, align 8 - store %ComplexHandler* %0, %ComplexHandler** %this, align 8 - %strings = alloca i8*, align 8 - store i8* %1, i8** %strings, align 8 - %numbers = alloca i16*, align 8 - store i16* %2, i16** %numbers, align 8 - %deref = load i8*, i8** %strings, align 8 - %tmpVar = getelementptr inbounds i8, i8* %deref, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar, i8* align 1 getelementptr inbounds ([5 x i8], [5 x i8]* @utf08_literal_0, i32 0, i32 0), i32 5, i1 false) - %deref1 = load i8*, i8** %strings, align 8 - %tmpVar2 = getelementptr inbounds i8, i8* %deref1, i32 21 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %tmpVar2, i8* align 1 getelementptr inbounds ([11 x i8], [11 x i8]* @utf08_literal_1, i32 0, i32 0), i32 11, i1 false) - %deref3 = load i16*, i16** %numbers, align 8 - %tmpVar4 = getelementptr inbounds i16, i16* %deref3, i32 0 - %tmpVar5 = getelementptr inbounds i16, i16* %tmpVar4, i32 0 - store i16 100, i16* %tmpVar5, align 2 - %deref6 = load i16*, i16** %numbers, align 8 - %tmpVar7 = getelementptr inbounds i16, i16* %deref6, i32 2 - %tmpVar8 = getelementptr inbounds i16, i16* %tmpVar7, i32 1 - store i16 200, i16* %tmpVar8, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %strings = alloca ptr, align 8 + store ptr %1, ptr %strings, align 8 + %numbers = alloca ptr, align 8 + store ptr %2, ptr %numbers, align 8 + %deref = load ptr, ptr %strings, align 8 + %tmpVar = getelementptr inbounds [2 x [21 x i8]], ptr %deref, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_0, i32 5, i1 false) + %deref1 = load ptr, ptr %strings, align 8 + %tmpVar2 = getelementptr inbounds [2 x [21 x i8]], ptr %deref1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_1, i32 11, i1 false) + %deref3 = load ptr, ptr %numbers, align 8 + %tmpVar4 = getelementptr inbounds [3 x [2 x i16]], ptr %deref3, i32 0, i32 0 + %tmpVar5 = getelementptr inbounds [2 x i16], ptr %tmpVar4, i32 0, i32 0 + store i16 100, ptr %tmpVar5, align 2 + %deref6 = load ptr, ptr %numbers, align 8 + %tmpVar7 = getelementptr inbounds [3 x [2 x i16]], ptr %deref6, i32 0, i32 1 + %tmpVar8 = getelementptr inbounds [2 x i16], ptr %tmpVar7, i32 0, i32 1 + store i16 200, ptr %tmpVar8, align 2 ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %handler = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %text_data = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %num_data = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %1 = bitcast [2 x [21 x i8]]* %text_data to i8* - %2 = bitcast [3 x [2 x i16]]* %num_data to i16* - call void @ComplexHandler__handle_data(%ComplexHandler* %handler, i8* %1, i16* %2) + %handler = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %text_data = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %num_data = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + call void @ComplexHandler__handle_data(ptr %handler, ptr %text_data, ptr %num_data) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1837,109 +1790,86 @@ fn function_with_array_of_array_return() { @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"Three\00" @utf08_literal_2 = private unnamed_addr constant [4 x i8] c"Two\00" - define void @foo(i16* %0) { + define void @foo(ptr %0) { entry: - %foo = alloca i16*, align 8 - store i16* %0, i16** %foo, align 8 + %foo = alloca ptr, align 8 + store ptr %0, ptr %foo, align 8 %result = alloca [2 x [2 x i16]], align 2 - %1 = bitcast [2 x [2 x i16]]* %result to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) - %tmpVar = getelementptr inbounds [2 x [2 x i16]], [2 x [2 x i16]]* %result, i32 0, i32 0 - %tmpVar1 = getelementptr inbounds [2 x i16], [2 x i16]* %tmpVar, i32 0, i32 0 - store i16 5, i16* %tmpVar1, align 2 - %tmpVar2 = getelementptr inbounds [2 x [2 x i16]], [2 x [2 x i16]]* %result, i32 0, i32 0 - %tmpVar3 = getelementptr inbounds [2 x i16], [2 x i16]* %tmpVar2, i32 0, i32 1 - store i16 10, i16* %tmpVar3, align 2 - %tmpVar4 = getelementptr inbounds [2 x [2 x i16]], [2 x [2 x i16]]* %result, i32 0, i32 1 - %tmpVar5 = getelementptr inbounds [2 x i16], [2 x i16]* %tmpVar4, i32 0, i32 0 - store i16 15, i16* %tmpVar5, align 2 - %tmpVar6 = getelementptr inbounds [2 x [2 x i16]], [2 x [2 x i16]]* %result, i32 0, i32 1 - %tmpVar7 = getelementptr inbounds [2 x i16], [2 x i16]* %tmpVar6, i32 0, i32 1 - store i16 20, i16* %tmpVar7, align 2 - %deref = load i16*, i16** %foo, align 8 - %2 = bitcast i16* %deref to i8* - %3 = bitcast [2 x [2 x i16]]* %result to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 %3, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %result, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) + %tmpVar = getelementptr inbounds [2 x [2 x i16]], ptr %result, i32 0, i32 0 + %tmpVar1 = getelementptr inbounds [2 x i16], ptr %tmpVar, i32 0, i32 0 + store i16 5, ptr %tmpVar1, align 2 + %tmpVar2 = getelementptr inbounds [2 x [2 x i16]], ptr %result, i32 0, i32 0 + %tmpVar3 = getelementptr inbounds [2 x i16], ptr %tmpVar2, i32 0, i32 1 + store i16 10, ptr %tmpVar3, align 2 + %tmpVar4 = getelementptr inbounds [2 x [2 x i16]], ptr %result, i32 0, i32 1 + %tmpVar5 = getelementptr inbounds [2 x i16], ptr %tmpVar4, i32 0, i32 0 + store i16 15, ptr %tmpVar5, align 2 + %tmpVar6 = getelementptr inbounds [2 x [2 x i16]], ptr %result, i32 0, i32 1 + %tmpVar7 = getelementptr inbounds [2 x i16], ptr %tmpVar6, i32 0, i32 1 + store i16 20, ptr %tmpVar7, align 2 + %deref = load ptr, ptr %foo, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %deref, ptr align 1 %result, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) ret void } - define void @bar(i16* %0) { + define void @bar(ptr %0) { entry: - %bar = alloca i16*, align 8 - store i16* %0, i16** %bar, align 8 + %bar = alloca ptr, align 8 + store ptr %0, ptr %bar, align 8 %data = alloca [2 x [2 x i16]], align 2 - %1 = bitcast [2 x [2 x i16]]* %data to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %data, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) %__foo0 = alloca [2 x [2 x i16]], align 2 - %2 = bitcast [2 x [2 x i16]]* %__foo0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) - %3 = bitcast [2 x [2 x i16]]* %__foo0 to i16* - call void @foo(i16* %3) - %4 = bitcast [2 x [2 x i16]]* %data to i8* - %5 = bitcast [2 x [2 x i16]]* %__foo0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %4, i8* align 1 %5, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) - %deref = load i16*, i16** %bar, align 8 - %6 = bitcast i16* %deref to i8* - %7 = bitcast [2 x [2 x i16]]* %data to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %6, i8* align 1 %7, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__foo0, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %__foo0) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %data, ptr align 1 %__foo0, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) + %deref = load ptr, ptr %bar, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %deref, ptr align 1 %data, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) ret void } - define void @baz(i8* %0) { + define void @baz(ptr %0) { entry: - %baz = alloca i8*, align 8 - store i8* %0, i8** %baz, align 8 + %baz = alloca ptr, align 8 + store ptr %0, ptr %baz, align 8 %texts = alloca [3 x [21 x i8]], align 1 - %1 = bitcast [3 x [21 x i8]]* %texts to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([3 x [21 x i8]]* getelementptr ([3 x [21 x i8]], [3 x [21 x i8]]* null, i32 1) to i64), i1 false) - %tmpVar = getelementptr inbounds [3 x [21 x i8]], [3 x [21 x i8]]* %texts, i32 0, i32 0 - %2 = bitcast [21 x i8]* %tmpVar to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 4, i1 false) - %tmpVar1 = getelementptr inbounds [3 x [21 x i8]], [3 x [21 x i8]]* %texts, i32 0, i32 1 - %3 = bitcast [21 x i8]* %tmpVar1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_2, i32 0, i32 0), i32 4, i1 false) - %tmpVar2 = getelementptr inbounds [3 x [21 x i8]], [3 x [21 x i8]]* %texts, i32 0, i32 2 - %4 = bitcast [21 x i8]* %tmpVar2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %4, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) - %deref = load i8*, i8** %baz, align 8 - %5 = bitcast [3 x [21 x i8]]* %texts to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %deref, i8* align 1 %5, i64 ptrtoint ([3 x [21 x i8]]* getelementptr ([3 x [21 x i8]], [3 x [21 x i8]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %texts, i8 0, i64 ptrtoint (ptr getelementptr ([3 x [21 x i8]], ptr null, i32 1) to i64), i1 false) + %tmpVar = getelementptr inbounds [3 x [21 x i8]], ptr %texts, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar, ptr align 1 @utf08_literal_0, i32 4, i1 false) + %tmpVar1 = getelementptr inbounds [3 x [21 x i8]], ptr %texts, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar1, ptr align 1 @utf08_literal_2, i32 4, i1 false) + %tmpVar2 = getelementptr inbounds [3 x [21 x i8]], ptr %texts, i32 0, i32 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmpVar2, ptr align 1 @utf08_literal_1, i32 6, i1 false) + %deref = load ptr, ptr %baz, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %deref, ptr align 1 %texts, i64 ptrtoint (ptr getelementptr ([3 x [21 x i8]], ptr null, i32 1) to i64), i1 false) ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %numbers = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %strings = getelementptr inbounds %main, %main* %0, i32 0, i32 1 + %numbers = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %strings = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 %__bar1 = alloca [2 x [2 x i16]], align 2 - %1 = bitcast [2 x [2 x i16]]* %__bar1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) - %2 = bitcast [2 x [2 x i16]]* %__bar1 to i16* - call void @bar(i16* %2) - %3 = bitcast [2 x [2 x i16]]* %numbers to i8* - %4 = bitcast [2 x [2 x i16]]* %__bar1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 %4, i64 ptrtoint ([2 x [2 x i16]]* getelementptr ([2 x [2 x i16]], [2 x [2 x i16]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__bar1, i8 0, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) + call void @bar(ptr %__bar1) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %numbers, ptr align 1 %__bar1, i64 ptrtoint (ptr getelementptr ([2 x [2 x i16]], ptr null, i32 1) to i64), i1 false) %__baz2 = alloca [3 x [21 x i8]], align 1 - %5 = bitcast [3 x [21 x i8]]* %__baz2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %5, i8 0, i64 ptrtoint ([3 x [21 x i8]]* getelementptr ([3 x [21 x i8]], [3 x [21 x i8]]* null, i32 1) to i64), i1 false) - %6 = bitcast [3 x [21 x i8]]* %__baz2 to i8* - call void @baz(i8* %6) - %7 = bitcast [3 x [21 x i8]]* %strings to i8* - %8 = bitcast [3 x [21 x i8]]* %__baz2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %7, i8* align 1 %8, i64 ptrtoint ([3 x [21 x i8]]* getelementptr ([3 x [21 x i8]], [3 x [21 x i8]]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__baz2, i8 0, i64 ptrtoint (ptr getelementptr ([3 x [21 x i8]], ptr null, i32 1) to i64), i1 false) + call void @baz(ptr %__baz2) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %strings, ptr align 1 %__baz2, i64 ptrtoint (ptr getelementptr ([3 x [21 x i8]], ptr null, i32 1) to i64), i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } diff --git a/src/codegen/tests/polymorphism.rs b/src/codegen/tests/polymorphism.rs index 223b0b810cf..b359f473791 100644 --- a/src/codegen/tests/polymorphism.rs +++ b/src/codegen/tests/polymorphism.rs @@ -51,12 +51,12 @@ fn simple_overridden_method() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_A = type { void (%A*)*, i16 (%A*, i32)* } - %A = type { i32*, i16, i16 } - %__vtable_B = type { void (%B*)*, i16 (%B*, i32)* } + %__vtable_A = type { ptr, ptr } + %A = type { ptr, i16, i16 } + %__vtable_B = type { ptr, ptr } %B = type { %A, i16, i16 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_A__init = unnamed_addr constant %__vtable_A zeroinitializer @__A__init = unnamed_addr constant %A zeroinitializer @__vtable_A_instance = global %__vtable_A zeroinitializer @@ -64,53 +64,53 @@ fn simple_overridden_method() { @__B__init = unnamed_addr constant %B zeroinitializer @__vtable_B_instance = global %__vtable_B zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 - %one = getelementptr inbounds %A, %A* %0, i32 0, i32 1 - %two = getelementptr inbounds %A, %A* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 + %one = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 1 + %two = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 2 ret void } - define i16 @A__foo(%A* %0, i32 %1) { + define i16 @A__foo(ptr %0, i32 %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 - %one = getelementptr inbounds %A, %A* %0, i32 0, i32 1 - %two = getelementptr inbounds %A, %A* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 + %one = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 1 + %two = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 2 %A.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %A.foo, align 2 - %A__foo_ret = load i16, i16* %A.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %A.foo, align 2 + %A__foo_ret = load i16, ptr %A.foo, align 2 ret i16 %A__foo_ret } - define void @B(%B* %0) { + define void @B(ptr %0) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 - %three = getelementptr inbounds %B, %B* %0, i32 0, i32 1 - %four = getelementptr inbounds %B, %B* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 + %three = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 1 + %four = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 2 ret void } - define i16 @B__foo(%B* %0, i32 %1) { + define i16 @B__foo(ptr %0, i32 %1) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 - %three = getelementptr inbounds %B, %B* %0, i32 0, i32 1 - %four = getelementptr inbounds %B, %B* %0, i32 0, i32 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 + %three = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 1 + %four = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 2 %B.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %B.foo, align 2 - %B__foo_ret = load i16, i16* %B.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %B.foo, align 2 + %B__foo_ret = load i16, ptr %B.foo, align 2 ret i16 %B__foo_ret } @@ -118,132 +118,127 @@ fn simple_overridden_method() { entry: %instanceA = alloca %A, align 8 %instanceB = alloca %B, align 8 - %refInstanceA = alloca %A*, align 8 - %0 = bitcast %A* %instanceA to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%A* @__A__init to i8*), i64 ptrtoint (%A* getelementptr (%A, %A* null, i32 1) to i64), i1 false) - %1 = bitcast %B* %instanceB to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%B* @__B__init to i8*), i64 ptrtoint (%B* getelementptr (%B, %B* null, i32 1) to i64), i1 false) - store %A* null, %A** %refInstanceA, align 8 - call void @__init_a(%A* %instanceA) - call void @__init_b(%B* %instanceB) - call void @__user_init_A(%A* %instanceA) - call void @__user_init_B(%B* %instanceB) - store %A* %instanceA, %A** %refInstanceA, align 8 - %deref = load %A*, %A** %refInstanceA, align 8 - %__vtable = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - %deref1 = load i32*, i32** %__vtable, align 8 - %cast = bitcast i32* %deref1 to %__vtable_A* - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %cast, i32 0, i32 1 - %2 = load i16 (%A*, i32)*, i16 (%A*, i32)** %foo, align 8 - %deref2 = load %A*, %A** %refInstanceA, align 8 - %fnptr_call = call i16 %2(%A* %deref2, i32 5) - %3 = bitcast %B* %instanceB to %A* - store %A* %3, %A** %refInstanceA, align 8 - %deref3 = load %A*, %A** %refInstanceA, align 8 - %__vtable4 = getelementptr inbounds %A, %A* %deref3, i32 0, i32 0 - %deref5 = load i32*, i32** %__vtable4, align 8 - %cast6 = bitcast i32* %deref5 to %__vtable_A* - %foo7 = getelementptr inbounds %__vtable_A, %__vtable_A* %cast6, i32 0, i32 1 - %4 = load i16 (%A*, i32)*, i16 (%A*, i32)** %foo7, align 8 - %deref8 = load %A*, %A** %refInstanceA, align 8 - %fnptr_call9 = call i16 %4(%A* %deref8, i32 10) + %refInstanceA = alloca ptr, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceA, ptr align 1 @__A__init, i64 ptrtoint (ptr getelementptr (%A, ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %instanceB, ptr align 1 @__B__init, i64 ptrtoint (ptr getelementptr (%B, ptr null, i32 1) to i64), i1 false) + store ptr null, ptr %refInstanceA, align 8 + call void @__init_a(ptr %instanceA) + call void @__init_b(ptr %instanceB) + call void @__user_init_A(ptr %instanceA) + call void @__user_init_B(ptr %instanceB) + store ptr %instanceA, ptr %refInstanceA, align 8 + %deref = load ptr, ptr %refInstanceA, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + %deref1 = load ptr, ptr %__vtable, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + %0 = load ptr, ptr %foo, align 8 + %deref2 = load ptr, ptr %refInstanceA, align 8 + %fnptr_call = call i16 %0(ptr %deref2, i32 5) + store ptr %instanceB, ptr %refInstanceA, align 8 + %deref3 = load ptr, ptr %refInstanceA, align 8 + %__vtable4 = getelementptr inbounds nuw %A, ptr %deref3, i32 0, i32 0 + %deref5 = load ptr, ptr %__vtable4, align 8 + %foo6 = getelementptr inbounds nuw %__vtable_A, ptr %deref5, i32 0, i32 1 + %1 = load ptr, ptr %foo6, align 8 + %deref7 = load ptr, ptr %refInstanceA, align 8 + %fnptr_call8 = call i16 %1(ptr %deref7, i32 10) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_a(%__vtable_A* %0) { + define void @__init___vtable_a(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 - %deref = load %__vtable_A*, %__vtable_A** %self, align 8 - %__body = getelementptr inbounds %__vtable_A, %__vtable_A* %deref, i32 0, i32 0 - store void (%A*)* @A, void (%A*)** %__body, align 8 - %deref1 = load %__vtable_A*, %__vtable_A** %self, align 8 - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %deref1, i32 0, i32 1 - store i16 (%A*, i32)* @A__foo, i16 (%A*, i32)** %foo, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @A, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @A__foo, ptr %foo, align 8 ret void } - define void @__init___vtable_b(%__vtable_B* %0) { + define void @__init___vtable_b(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 - %deref = load %__vtable_B*, %__vtable_B** %self, align 8 - %__body = getelementptr inbounds %__vtable_B, %__vtable_B* %deref, i32 0, i32 0 - store void (%B*)* @B, void (%B*)** %__body, align 8 - %deref1 = load %__vtable_B*, %__vtable_B** %self, align 8 - %foo = getelementptr inbounds %__vtable_B, %__vtable_B* %deref1, i32 0, i32 1 - store i16 (%B*, i32)* @B__foo, i16 (%B*, i32)** %foo, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @B, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @B__foo, ptr %foo, align 8 ret void } - define void @__init_b(%B* %0) { + define void @__init_b(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__init_a(%A* %__A) - %deref1 = load %B*, %B** %self, align 8 - %__A2 = getelementptr inbounds %B, %B* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %A, %A* %__A2, i32 0, i32 0 - store i32* bitcast (%__vtable_B* @__vtable_B_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__init_a(ptr %__A) + %deref1 = load ptr, ptr %self, align 8 + %__A2 = getelementptr inbounds nuw %B, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %A, ptr %__A2, i32 0, i32 0 + store ptr @__vtable_B_instance, ptr %__vtable, align 8 ret void } - define void @__init_a(%A* %0) { + define void @__init_a(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 - %deref = load %A*, %A** %self, align 8 - %__vtable = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_A* @__vtable_A_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + store ptr @__vtable_A_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_A(%__vtable_A* %0) { + define void @__user_init___vtable_A(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_B(%B* %0) { + define void @__user_init_B(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__user_init_A(%A* %__A) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__user_init_A(ptr %__A) ret void } - define void @__user_init_A(%A* %0) { + define void @__user_init_A(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_B(%__vtable_B* %0) { + define void @__user_init___vtable_B(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_a(%__vtable_A* @__vtable_A_instance) - call void @__init___vtable_b(%__vtable_B* @__vtable_B_instance) - call void @__user_init___vtable_A(%__vtable_A* @__vtable_A_instance) - call void @__user_init___vtable_B(%__vtable_B* @__vtable_B_instance) + call void @__init___vtable_a(ptr @__vtable_A_instance) + call void @__init___vtable_b(ptr @__vtable_B_instance) + call void @__user_init___vtable_A(ptr @__vtable_A_instance) + call void @__user_init___vtable_B(ptr @__vtable_B_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -273,95 +268,94 @@ fn method_call_within_method() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_A = type { void (%A*)*, i16 (%A*, i32)*, void (%A*)* } - %A = type { i32* } + %__vtable_A = type { ptr, ptr, ptr } + %A = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_A__init = unnamed_addr constant %__vtable_A zeroinitializer @__A__init = unnamed_addr constant %A zeroinitializer @__vtable_A_instance = global %__vtable_A zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 ret void } - define i16 @A__foo(%A* %0, i32 %1) { + define i16 @A__foo(ptr %0, i32 %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 %A.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %A.foo, align 2 - %A__foo_ret = load i16, i16* %A.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %A.foo, align 2 + %A__foo_ret = load i16, ptr %A.foo, align 2 ret i16 %A__foo_ret } - define void @A__bar(%A* %0) { + define void @A__bar(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 - %deref = load %A*, %A** %this, align 8 - %__vtable1 = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - %deref2 = load i32*, i32** %__vtable1, align 8 - %cast = bitcast i32* %deref2 to %__vtable_A* - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %cast, i32 0, i32 1 - %1 = load i16 (%A*, i32)*, i16 (%A*, i32)** %foo, align 8 - %deref3 = load %A*, %A** %this, align 8 - %fnptr_call = call i16 %1(%A* %deref3, i32 5) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + %__vtable1 = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + %deref2 = load ptr, ptr %__vtable1, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 1 + %1 = load ptr, ptr %foo, align 8 + %deref3 = load ptr, ptr %this, align 8 + %fnptr_call = call i16 %1(ptr %deref3, i32 5) ret void } - define void @__init___vtable_a(%__vtable_A* %0) { + define void @__init___vtable_a(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 - %deref = load %__vtable_A*, %__vtable_A** %self, align 8 - %__body = getelementptr inbounds %__vtable_A, %__vtable_A* %deref, i32 0, i32 0 - store void (%A*)* @A, void (%A*)** %__body, align 8 - %deref1 = load %__vtable_A*, %__vtable_A** %self, align 8 - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %deref1, i32 0, i32 1 - store i16 (%A*, i32)* @A__foo, i16 (%A*, i32)** %foo, align 8 - %deref2 = load %__vtable_A*, %__vtable_A** %self, align 8 - %bar = getelementptr inbounds %__vtable_A, %__vtable_A* %deref2, i32 0, i32 2 - store void (%A*)* @A__bar, void (%A*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @A, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @A__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @A__bar, ptr %bar, align 8 ret void } - define void @__init_a(%A* %0) { + define void @__init_a(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 - %deref = load %A*, %A** %self, align 8 - %__vtable = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_A* @__vtable_A_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + store ptr @__vtable_A_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_A(%A* %0) { + define void @__user_init_A(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_A(%__vtable_A* %0) { + define void @__user_init___vtable_A(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_a(%__vtable_A* @__vtable_A_instance) - call void @__user_init___vtable_A(%__vtable_A* @__vtable_A_instance) + call void @__init___vtable_a(ptr @__vtable_A_instance) + call void @__user_init___vtable_A(ptr @__vtable_A_instance) ret void } "#); @@ -412,14 +406,14 @@ fn this_is_untouched() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_A = type { void (%A*)*, i16 (%A*, i32)*, void (%A*)* } - %A = type { i32* } - %__vtable_B = type { void (%B*)*, i16 (%A*, i32)*, void (%B*)* } + %__vtable_A = type { ptr, ptr, ptr } + %A = type { ptr } + %__vtable_B = type { ptr, ptr, ptr } %B = type { %A } - %__vtable_C = type { void (%C*)*, i16 (%C*, i32)*, void (%C*)* } + %__vtable_C = type { ptr, ptr, ptr } %C = type { %A } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_A__init = unnamed_addr constant %__vtable_A zeroinitializer @__A__init = unnamed_addr constant %A zeroinitializer @__vtable_A_instance = global %__vtable_A zeroinitializer @@ -430,229 +424,229 @@ fn this_is_untouched() { @__C__init = unnamed_addr constant %C zeroinitializer @__vtable_C_instance = global %__vtable_C zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 ret void } - define i16 @A__foo(%A* %0, i32 %1) { + define i16 @A__foo(ptr %0, i32 %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 %A.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %A.foo, align 2 - %A__foo_ret = load i16, i16* %A.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %A.foo, align 2 + %A__foo_ret = load i16, ptr %A.foo, align 2 ret i16 %A__foo_ret } - define void @A__bar(%A* %0) { + define void @A__bar(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 ret void } - define void @B(%B* %0) { + define void @B(ptr %0) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 ret void } - define void @B__bar(%B* %0) { + define void @B__bar(ptr %0) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 - %deref = load %B*, %B** %this, align 8 - %__A1 = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - %call = call i16 @A__foo(%A* %__A1, i32 5) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + %__A1 = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + %call = call i16 @A__foo(ptr %__A1, i32 5) ret void } - define void @C(%C* %0) { + define void @C(ptr %0) { entry: - %this = alloca %C*, align 8 - store %C* %0, %C** %this, align 8 - %__A = getelementptr inbounds %C, %C* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %C, ptr %0, i32 0, i32 0 ret void } - define i16 @C__foo(%C* %0, i32 %1) { + define i16 @C__foo(ptr %0, i32 %1) { entry: - %this = alloca %C*, align 8 - store %C* %0, %C** %this, align 8 - %__A = getelementptr inbounds %C, %C* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %C, ptr %0, i32 0, i32 0 %C.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %C.foo, align 2 - %deref = load %C*, %C** %this, align 8 - call void @C__bar(%C* %deref) - %C__foo_ret = load i16, i16* %C.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %C.foo, align 2 + %deref = load ptr, ptr %this, align 8 + call void @C__bar(ptr %deref) + %C__foo_ret = load i16, ptr %C.foo, align 2 ret i16 %C__foo_ret } - define void @C__bar(%C* %0) { + define void @C__bar(ptr %0) { entry: - %this = alloca %C*, align 8 - store %C* %0, %C** %this, align 8 - %__A = getelementptr inbounds %C, %C* %0, i32 0, i32 0 - %deref = load %C*, %C** %this, align 8 - %call = call i16 @C__foo(%C* %deref, i32 5) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %C, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %this, align 8 + %call = call i16 @C__foo(ptr %deref, i32 5) ret void } - define void @__init___vtable_a(%__vtable_A* %0) { + define void @__init___vtable_a(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 - %deref = load %__vtable_A*, %__vtable_A** %self, align 8 - %__body = getelementptr inbounds %__vtable_A, %__vtable_A* %deref, i32 0, i32 0 - store void (%A*)* @A, void (%A*)** %__body, align 8 - %deref1 = load %__vtable_A*, %__vtable_A** %self, align 8 - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %deref1, i32 0, i32 1 - store i16 (%A*, i32)* @A__foo, i16 (%A*, i32)** %foo, align 8 - %deref2 = load %__vtable_A*, %__vtable_A** %self, align 8 - %bar = getelementptr inbounds %__vtable_A, %__vtable_A* %deref2, i32 0, i32 2 - store void (%A*)* @A__bar, void (%A*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @A, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @A__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @A__bar, ptr %bar, align 8 ret void } - define void @__init___vtable_b(%__vtable_B* %0) { + define void @__init___vtable_b(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 - %deref = load %__vtable_B*, %__vtable_B** %self, align 8 - %__body = getelementptr inbounds %__vtable_B, %__vtable_B* %deref, i32 0, i32 0 - store void (%B*)* @B, void (%B*)** %__body, align 8 - %deref1 = load %__vtable_B*, %__vtable_B** %self, align 8 - %foo = getelementptr inbounds %__vtable_B, %__vtable_B* %deref1, i32 0, i32 1 - store i16 (%A*, i32)* @A__foo, i16 (%A*, i32)** %foo, align 8 - %deref2 = load %__vtable_B*, %__vtable_B** %self, align 8 - %bar = getelementptr inbounds %__vtable_B, %__vtable_B* %deref2, i32 0, i32 2 - store void (%B*)* @B__bar, void (%B*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @B, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @A__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @B__bar, ptr %bar, align 8 ret void } - define void @__init___vtable_c(%__vtable_C* %0) { + define void @__init___vtable_c(ptr %0) { entry: - %self = alloca %__vtable_C*, align 8 - store %__vtable_C* %0, %__vtable_C** %self, align 8 - %deref = load %__vtable_C*, %__vtable_C** %self, align 8 - %__body = getelementptr inbounds %__vtable_C, %__vtable_C* %deref, i32 0, i32 0 - store void (%C*)* @C, void (%C*)** %__body, align 8 - %deref1 = load %__vtable_C*, %__vtable_C** %self, align 8 - %foo = getelementptr inbounds %__vtable_C, %__vtable_C* %deref1, i32 0, i32 1 - store i16 (%C*, i32)* @C__foo, i16 (%C*, i32)** %foo, align 8 - %deref2 = load %__vtable_C*, %__vtable_C** %self, align 8 - %bar = getelementptr inbounds %__vtable_C, %__vtable_C* %deref2, i32 0, i32 2 - store void (%C*)* @C__bar, void (%C*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @C, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @C__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @C__bar, ptr %bar, align 8 ret void } - define void @__init_a(%A* %0) { + define void @__init_a(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 - %deref = load %A*, %A** %self, align 8 - %__vtable = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_A* @__vtable_A_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + store ptr @__vtable_A_instance, ptr %__vtable, align 8 ret void } - define void @__init_b(%B* %0) { + define void @__init_b(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__init_a(%A* %__A) - %deref1 = load %B*, %B** %self, align 8 - %__A2 = getelementptr inbounds %B, %B* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %A, %A* %__A2, i32 0, i32 0 - store i32* bitcast (%__vtable_B* @__vtable_B_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__init_a(ptr %__A) + %deref1 = load ptr, ptr %self, align 8 + %__A2 = getelementptr inbounds nuw %B, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %A, ptr %__A2, i32 0, i32 0 + store ptr @__vtable_B_instance, ptr %__vtable, align 8 ret void } - define void @__init_c(%C* %0) { + define void @__init_c(ptr %0) { entry: - %self = alloca %C*, align 8 - store %C* %0, %C** %self, align 8 - %deref = load %C*, %C** %self, align 8 - %__A = getelementptr inbounds %C, %C* %deref, i32 0, i32 0 - call void @__init_a(%A* %__A) - %deref1 = load %C*, %C** %self, align 8 - %__A2 = getelementptr inbounds %C, %C* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %A, %A* %__A2, i32 0, i32 0 - store i32* bitcast (%__vtable_C* @__vtable_C_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__init_a(ptr %__A) + %deref1 = load ptr, ptr %self, align 8 + %__A2 = getelementptr inbounds nuw %B, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %A, ptr %__A2, i32 0, i32 0 + store ptr @__vtable_C_instance, ptr %__vtable, align 8 ret void } - define void @__user_init_C(%C* %0) { + define void @__user_init_C(ptr %0) { entry: - %self = alloca %C*, align 8 - store %C* %0, %C** %self, align 8 - %deref = load %C*, %C** %self, align 8 - %__A = getelementptr inbounds %C, %C* %deref, i32 0, i32 0 - call void @__user_init_A(%A* %__A) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__user_init_A(ptr %__A) ret void } - define void @__user_init_A(%A* %0) { + define void @__user_init_A(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_A(%__vtable_A* %0) { + define void @__user_init___vtable_A(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_B(%B* %0) { + define void @__user_init_B(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__user_init_A(%A* %__A) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__user_init_A(ptr %__A) ret void } - define void @__user_init___vtable_C(%__vtable_C* %0) { + define void @__user_init___vtable_C(ptr %0) { entry: - %self = alloca %__vtable_C*, align 8 - store %__vtable_C* %0, %__vtable_C** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_B(%__vtable_B* %0) { + define void @__user_init___vtable_B(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_a(%__vtable_A* @__vtable_A_instance) - call void @__init___vtable_b(%__vtable_B* @__vtable_B_instance) - call void @__init___vtable_c(%__vtable_C* @__vtable_C_instance) - call void @__user_init___vtable_A(%__vtable_A* @__vtable_A_instance) - call void @__user_init___vtable_B(%__vtable_B* @__vtable_B_instance) - call void @__user_init___vtable_C(%__vtable_C* @__vtable_C_instance) + call void @__init___vtable_a(ptr @__vtable_A_instance) + call void @__init___vtable_b(ptr @__vtable_B_instance) + call void @__init___vtable_c(ptr @__vtable_C_instance) + call void @__user_init___vtable_A(ptr @__vtable_A_instance) + call void @__user_init___vtable_B(ptr @__vtable_B_instance) + call void @__user_init___vtable_C(ptr @__vtable_C_instance) ret void } "#); @@ -698,12 +692,12 @@ fn super_is_untouched() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_A = type { void (%A*)*, i16 (%A*, i32)*, void (%A*)* } - %A = type { i32* } - %__vtable_B = type { void (%B*)*, i16 (%B*, i32)*, void (%B*)* } + %__vtable_A = type { ptr, ptr, ptr } + %A = type { ptr } + %__vtable_B = type { ptr, ptr, ptr } %B = type { %A } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_A__init = unnamed_addr constant %__vtable_A zeroinitializer @__A__init = unnamed_addr constant %A zeroinitializer @__vtable_A_instance = global %__vtable_A zeroinitializer @@ -711,161 +705,161 @@ fn super_is_untouched() { @__B__init = unnamed_addr constant %B zeroinitializer @__vtable_B_instance = global %__vtable_B zeroinitializer - define void @A(%A* %0) { + define void @A(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 ret void } - define i16 @A__foo(%A* %0, i32 %1) { + define i16 @A__foo(ptr %0, i32 %1) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 %A.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %A.foo, align 2 - %A__foo_ret = load i16, i16* %A.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %A.foo, align 2 + %A__foo_ret = load i16, ptr %A.foo, align 2 ret i16 %A__foo_ret } - define void @A__bar(%A* %0) { + define void @A__bar(ptr %0) { entry: - %this = alloca %A*, align 8 - store %A* %0, %A** %this, align 8 - %__vtable = getelementptr inbounds %A, %A* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %0, i32 0, i32 0 ret void } - define void @B(%B* %0) { + define void @B(ptr %0) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 ret void } - define i16 @B__foo(%B* %0, i32 %1) { + define i16 @B__foo(ptr %0, i32 %1) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 %B.foo = alloca i16, align 2 %in = alloca i32, align 4 - store i32 %1, i32* %in, align 4 - store i16 0, i16* %B.foo, align 2 - %call = call i16 @A__foo(%A* %__A, i32 5) - call void @A__bar(%A* %__A) - %B__foo_ret = load i16, i16* %B.foo, align 2 + store i32 %1, ptr %in, align 4 + store i16 0, ptr %B.foo, align 2 + %call = call i16 @A__foo(ptr %__A, i32 5) + call void @A__bar(ptr %__A) + %B__foo_ret = load i16, ptr %B.foo, align 2 ret i16 %B__foo_ret } - define void @B__bar(%B* %0) { + define void @B__bar(ptr %0) { entry: - %this = alloca %B*, align 8 - store %B* %0, %B** %this, align 8 - %__A = getelementptr inbounds %B, %B* %0, i32 0, i32 0 - %call = call i16 @A__foo(%A* %__A, i32 5) - call void @A__bar(%A* %__A) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__A = getelementptr inbounds nuw %B, ptr %0, i32 0, i32 0 + %call = call i16 @A__foo(ptr %__A, i32 5) + call void @A__bar(ptr %__A) ret void } - define void @__init___vtable_a(%__vtable_A* %0) { + define void @__init___vtable_a(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 - %deref = load %__vtable_A*, %__vtable_A** %self, align 8 - %__body = getelementptr inbounds %__vtable_A, %__vtable_A* %deref, i32 0, i32 0 - store void (%A*)* @A, void (%A*)** %__body, align 8 - %deref1 = load %__vtable_A*, %__vtable_A** %self, align 8 - %foo = getelementptr inbounds %__vtable_A, %__vtable_A* %deref1, i32 0, i32 1 - store i16 (%A*, i32)* @A__foo, i16 (%A*, i32)** %foo, align 8 - %deref2 = load %__vtable_A*, %__vtable_A** %self, align 8 - %bar = getelementptr inbounds %__vtable_A, %__vtable_A* %deref2, i32 0, i32 2 - store void (%A*)* @A__bar, void (%A*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @A, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @A__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @A__bar, ptr %bar, align 8 ret void } - define void @__init___vtable_b(%__vtable_B* %0) { + define void @__init___vtable_b(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 - %deref = load %__vtable_B*, %__vtable_B** %self, align 8 - %__body = getelementptr inbounds %__vtable_B, %__vtable_B* %deref, i32 0, i32 0 - store void (%B*)* @B, void (%B*)** %__body, align 8 - %deref1 = load %__vtable_B*, %__vtable_B** %self, align 8 - %foo = getelementptr inbounds %__vtable_B, %__vtable_B* %deref1, i32 0, i32 1 - store i16 (%B*, i32)* @B__foo, i16 (%B*, i32)** %foo, align 8 - %deref2 = load %__vtable_B*, %__vtable_B** %self, align 8 - %bar = getelementptr inbounds %__vtable_B, %__vtable_B* %deref2, i32 0, i32 2 - store void (%B*)* @B__bar, void (%B*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_A, ptr %deref, i32 0, i32 0 + store ptr @B, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %foo = getelementptr inbounds nuw %__vtable_A, ptr %deref1, i32 0, i32 1 + store ptr @B__foo, ptr %foo, align 8 + %deref2 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_A, ptr %deref2, i32 0, i32 2 + store ptr @B__bar, ptr %bar, align 8 ret void } - define void @__init_a(%A* %0) { + define void @__init_a(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 - %deref = load %A*, %A** %self, align 8 - %__vtable = getelementptr inbounds %A, %A* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_A* @__vtable_A_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %A, ptr %deref, i32 0, i32 0 + store ptr @__vtable_A_instance, ptr %__vtable, align 8 ret void } - define void @__init_b(%B* %0) { + define void @__init_b(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__init_a(%A* %__A) - %deref1 = load %B*, %B** %self, align 8 - %__A2 = getelementptr inbounds %B, %B* %deref1, i32 0, i32 0 - %__vtable = getelementptr inbounds %A, %A* %__A2, i32 0, i32 0 - store i32* bitcast (%__vtable_B* @__vtable_B_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__init_a(ptr %__A) + %deref1 = load ptr, ptr %self, align 8 + %__A2 = getelementptr inbounds nuw %B, ptr %deref1, i32 0, i32 0 + %__vtable = getelementptr inbounds nuw %A, ptr %__A2, i32 0, i32 0 + store ptr @__vtable_B_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_A(%__vtable_A* %0) { + define void @__user_init___vtable_A(ptr %0) { entry: - %self = alloca %__vtable_A*, align 8 - store %__vtable_A* %0, %__vtable_A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_B(%B* %0) { + define void @__user_init_B(ptr %0) { entry: - %self = alloca %B*, align 8 - store %B* %0, %B** %self, align 8 - %deref = load %B*, %B** %self, align 8 - %__A = getelementptr inbounds %B, %B* %deref, i32 0, i32 0 - call void @__user_init_A(%A* %__A) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__A = getelementptr inbounds nuw %B, ptr %deref, i32 0, i32 0 + call void @__user_init_A(ptr %__A) ret void } - define void @__user_init_A(%A* %0) { + define void @__user_init_A(ptr %0) { entry: - %self = alloca %A*, align 8 - store %A* %0, %A** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_B(%__vtable_B* %0) { + define void @__user_init___vtable_B(ptr %0) { entry: - %self = alloca %__vtable_B*, align 8 - store %__vtable_B* %0, %__vtable_B** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_a(%__vtable_A* @__vtable_A_instance) - call void @__init___vtable_b(%__vtable_B* @__vtable_B_instance) - call void @__user_init___vtable_A(%__vtable_A* @__vtable_A_instance) - call void @__user_init___vtable_B(%__vtable_B* @__vtable_B_instance) + call void @__init___vtable_a(ptr @__vtable_A_instance) + call void @__init___vtable_b(ptr @__vtable_B_instance) + call void @__user_init___vtable_A(ptr @__vtable_A_instance) + call void @__user_init___vtable_B(ptr @__vtable_B_instance) ret void } "#); diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__a_global_variables_generates_in_separate_global_variables.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__a_global_variables_generates_in_separate_global_variables.snap index 39012603f24..1b99eef5dab 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__a_global_variables_generates_in_separate_global_variables.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__a_global_variables_generates_in_separate_global_variables.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,7 +13,7 @@ target triple = "[filtered]" @gY = global i8 0 @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_array_in_struct.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_array_in_struct.snap index d322e874d59..8ec499bd037 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_array_in_struct.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_array_in_struct.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,11 +13,11 @@ target triple = "[filtered]" @Main_instance = global %Main zeroinitializer @__MyStruct__init = unnamed_addr constant %MyStruct zeroinitializer -define void @Main(%Main* %0) { +define void @Main(ptr %0) { entry: - %m = getelementptr inbounds %Main, %Main* %0, i32 0, i32 0 - %field1 = getelementptr inbounds %MyStruct, %MyStruct* %m, i32 0, i32 0 - %tmpVar = getelementptr inbounds [5 x i16], [5 x i16]* %field1, i32 0, i32 3 - store i16 7, i16* %tmpVar, align 2 + %m = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 0 + %field1 = getelementptr inbounds nuw %MyStruct, ptr %m, i32 0, i32 0 + %tmpVar = getelementptr inbounds [5 x i16], ptr %field1, i32 0, i32 3 + store i16 7, ptr %tmpVar, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_structs.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_structs.snap index 4fc4cbccf06..ce8dd2d9a10 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_structs.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__accessing_nested_structs.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,14 +15,14 @@ target triple = "[filtered]" @__OuterStruct__init = unnamed_addr constant %OuterStruct zeroinitializer @__InnerStruct__init = unnamed_addr constant %InnerStruct zeroinitializer -define void @Main(%Main* %0) { +define void @Main(ptr %0) { entry: - %m = getelementptr inbounds %Main, %Main* %0, i32 0, i32 0 - %out1 = getelementptr inbounds %OuterStruct, %OuterStruct* %m, i32 0, i32 0 - %inner1 = getelementptr inbounds %InnerStruct, %InnerStruct* %out1, i32 0, i32 0 - store i16 3, i16* %inner1, align 2 - %out2 = getelementptr inbounds %OuterStruct, %OuterStruct* %m, i32 0, i32 1 - %inner2 = getelementptr inbounds %InnerStruct, %InnerStruct* %out2, i32 0, i32 1 - store i16 7, i16* %inner2, align 2 + %m = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 0 + %out1 = getelementptr inbounds nuw %OuterStruct, ptr %m, i32 0, i32 0 + %inner1 = getelementptr inbounds nuw %InnerStruct, ptr %out1, i32 0, i32 0 + store i16 3, ptr %inner1, align 2 + %out2 = getelementptr inbounds nuw %OuterStruct, ptr %m, i32 0, i32 1 + %inner2 = getelementptr inbounds nuw %InnerStruct, ptr %out2, i32 0, i32 1 + store i16 7, ptr %inner2, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__action_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__action_called_in_program.snap index b4a1de72867..72e2fd0d190 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__action_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__action_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - call void @prg__foo(%prg* %0) + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + call void @prg__foo(ptr %0) ret void } -define void @prg__foo(%prg* %0) { +define void @prg__foo(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 2, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 2, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_cast_int_type_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_cast_int_type_generated.snap index 9e4a0ef654d..d0547d891e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_cast_int_type_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_cast_int_type_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_negative_type_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_negative_type_generated.snap index 5b3533a6411..52f99051494 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_negative_type_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_negative_type_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_type_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_type_generated.snap index 9e4a0ef654d..d0547d891e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_type_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_non_zero_type_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_generated.snap index 9e4a0ef654d..d0547d891e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_used.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_used.snap index 68e5d47ca1b..21a2e8d9173 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_used.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_used.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %tmpVar = getelementptr inbounds [4 x i32], [4 x i32]* %x, i32 0, i32 1 - store i32 3, i32* %tmpVar, align 4 - %tmpVar1 = getelementptr inbounds [4 x i32], [4 x i32]* %x, i32 0, i32 2 - %tmpVar2 = getelementptr inbounds [4 x i32], [4 x i32]* %x, i32 0, i32 3 - %load_tmpVar = load i32, i32* %tmpVar2, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %tmpVar = getelementptr inbounds [4 x i32], ptr %x, i32 0, i32 1 + store i32 3, ptr %tmpVar, align 4 + %tmpVar1 = getelementptr inbounds [4 x i32], ptr %x, i32 0, i32 2 + %tmpVar2 = getelementptr inbounds [4 x i32], ptr %x, i32 0, i32 3 + %load_tmpVar = load i32, ptr %tmpVar2, align 4 %tmpVar3 = add i32 %load_tmpVar, 3 - store i32 %tmpVar3, i32* %tmpVar1, align 4 + store i32 %tmpVar3, ptr %tmpVar1, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_negative_start_used.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_negative_start_used.snap index 016d218b00f..9d6cf980251 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_negative_start_used.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_negative_start_used.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %tmpVar = getelementptr inbounds [6 x i32], [6 x i32]* %x, i32 0, i32 1 - store i32 3, i32* %tmpVar, align 4 - %tmpVar1 = getelementptr inbounds [6 x i32], [6 x i32]* %x, i32 0, i32 4 - %tmpVar2 = getelementptr inbounds [6 x i32], [6 x i32]* %x, i32 0, i32 5 - %load_tmpVar = load i32, i32* %tmpVar2, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %tmpVar = getelementptr inbounds [6 x i32], ptr %x, i32 0, i32 1 + store i32 3, ptr %tmpVar, align 4 + %tmpVar1 = getelementptr inbounds [6 x i32], ptr %x, i32 0, i32 4 + %tmpVar2 = getelementptr inbounds [6 x i32], ptr %x, i32 0, i32 5 + %load_tmpVar = load i32, ptr %tmpVar2, align 4 %tmpVar3 = add i32 %load_tmpVar, 3 - store i32 %tmpVar3, i32* %tmpVar1, align 4 + store i32 %tmpVar3, ptr %tmpVar1, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_start_used.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_start_used.snap index aa1a2db3869..8bfe018a538 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_start_used.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_int_type_with_non_zero_start_used.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %tmpVar = getelementptr inbounds [3 x i32], [3 x i32]* %x, i32 0, i32 0 - store i32 3, i32* %tmpVar, align 4 - %tmpVar1 = getelementptr inbounds [3 x i32], [3 x i32]* %x, i32 0, i32 1 - %tmpVar2 = getelementptr inbounds [3 x i32], [3 x i32]* %x, i32 0, i32 2 - %load_tmpVar = load i32, i32* %tmpVar2, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %tmpVar = getelementptr inbounds [3 x i32], ptr %x, i32 0, i32 0 + store i32 3, ptr %tmpVar, align 4 + %tmpVar1 = getelementptr inbounds [3 x i32], ptr %x, i32 0, i32 1 + %tmpVar2 = getelementptr inbounds [3 x i32], ptr %x, i32 0, i32 2 + %load_tmpVar = load i32, ptr %tmpVar2, align 4 %tmpVar3 = add i32 %load_tmpVar, 3 - store i32 %tmpVar3, i32* %tmpVar1, align 4 + store i32 %tmpVar3, ptr %tmpVar1, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_and_variable_declaration_is_initialized.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_and_variable_declaration_is_initialized.snap index 3a40df76ba3..34d6573b4b3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_and_variable_declaration_is_initialized.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_and_variable_declaration_is_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,8 +16,8 @@ target triple = "[filtered]" @__STRUCT2__init = unnamed_addr constant %STRUCT2 zeroinitializer @__mainProg.var_str1__init = unnamed_addr constant [5 x %STRUCT1] [%STRUCT1 { i16 1, [5 x %STRUCT2] [%STRUCT2 { i8 1, i32 128 }, %STRUCT2 { i8 0, i32 1024 }, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer] }, %STRUCT1 { i16 2, [5 x %STRUCT2] [%STRUCT2 { i8 1, i32 256 }, %STRUCT2 { i8 0, i32 2048 }, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer] }, %STRUCT1 zeroinitializer, %STRUCT1 zeroinitializer, %STRUCT1 zeroinitializer] -define void @mainProg(%mainProg* %0) { +define void @mainProg(ptr %0) { entry: - %var_str1 = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 0 + %var_str1 = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_is_initialized.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_is_initialized.snap index 3d010cae44f..fe6a2f84fe8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_is_initialized.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__array_of_struct_as_member_of_another_struct_is_initialized.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,8 +16,8 @@ target triple = "[filtered]" @__STRUCT2__init = unnamed_addr constant %STRUCT2 zeroinitializer @__mainProg.var_str1__init = unnamed_addr constant %STRUCT1 { i16 10, [11 x %STRUCT2] [%STRUCT2 { i8 1, i32 128 }, %STRUCT2 { i8 0, i32 1024 }, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer, %STRUCT2 zeroinitializer] } -define void @mainProg(%mainProg* %0) { +define void @mainProg(ptr %0) { entry: - %var_str1 = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 0 + %var_str1 = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_constant_expressions_in_case_selectors.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_constant_expressions_in_case_selectors.snap index c3a2b2845fa..dbccff09590 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_constant_expressions_in_case_selectors.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_constant_expressions_in_case_selectors.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,11 +17,11 @@ entry: %input = alloca i32, align 4 %horiz = alloca i32, align 4 %depth = alloca i32, align 4 - store i32 0, i32* %input, align 4 - store i32 0, i32* %horiz, align 4 - store i32 0, i32* %depth, align 4 - store i32 0, i32* %drive, align 4 - %load_input = load i32, i32* %input, align 4 + store i32 0, ptr %input, align 4 + store i32 0, ptr %horiz, align 4 + store i32 0, ptr %depth, align 4 + store i32 0, ptr %drive, align 4 + %load_input = load i32, ptr %input, align 4 switch i32 %load_input, label %else [ i32 7, label %case i32 14, label %case1 @@ -31,33 +30,33 @@ entry: ] case: ; preds = %entry - %load_horiz = load i32, i32* %horiz, align 4 + %load_horiz = load i32, ptr %horiz, align 4 %tmpVar = add i32 %load_horiz, 1 - store i32 %tmpVar, i32* %horiz, align 4 + store i32 %tmpVar, ptr %horiz, align 4 br label %continue case1: ; preds = %entry - %load_horiz2 = load i32, i32* %horiz, align 4 + %load_horiz2 = load i32, ptr %horiz, align 4 %tmpVar3 = add i32 %load_horiz2, 2 - store i32 %tmpVar3, i32* %horiz, align 4 + store i32 %tmpVar3, ptr %horiz, align 4 br label %continue case4: ; preds = %entry - %load_depth = load i32, i32* %depth, align 4 + %load_depth = load i32, ptr %depth, align 4 %tmpVar5 = sub i32 %load_depth, 1 - store i32 %tmpVar5, i32* %depth, align 4 + store i32 %tmpVar5, ptr %depth, align 4 br label %continue case6: ; preds = %entry - %load_depth7 = load i32, i32* %depth, align 4 + %load_depth7 = load i32, ptr %depth, align 4 %tmpVar8 = add i32 %load_depth7, 1 - store i32 %tmpVar8, i32* %depth, align 4 + store i32 %tmpVar8, ptr %depth, align 4 br label %continue else: ; preds = %entry br label %continue continue: ; preds = %else, %case6, %case4, %case1, %case - %drive_ret = load i32, i32* %drive, align 4 + %drive_ret = load i32, ptr %drive, align 4 ret i32 %drive_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_enum_expressions_in_case_selectors.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_enum_expressions_in_case_selectors.snap index a44fd34479f..fa89e04d4d3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_enum_expressions_in_case_selectors.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_enum_expressions_in_case_selectors.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -19,11 +18,11 @@ entry: %input = alloca i32, align 4 %horiz = alloca i32, align 4 %depth = alloca i32, align 4 - store i32 0, i32* %input, align 4 - store i32 0, i32* %horiz, align 4 - store i32 0, i32* %depth, align 4 - store i32 0, i32* %drive, align 4 - %load_input = load i32, i32* %input, align 4 + store i32 0, ptr %input, align 4 + store i32 0, ptr %horiz, align 4 + store i32 0, ptr %depth, align 4 + store i32 0, ptr %drive, align 4 + %load_input = load i32, ptr %input, align 4 switch i32 %load_input, label %else [ i32 7, label %case i32 14, label %case1 @@ -32,33 +31,33 @@ entry: ] case: ; preds = %entry - %load_horiz = load i32, i32* %horiz, align 4 + %load_horiz = load i32, ptr %horiz, align 4 %tmpVar = add i32 %load_horiz, 1 - store i32 %tmpVar, i32* %horiz, align 4 + store i32 %tmpVar, ptr %horiz, align 4 br label %continue case1: ; preds = %entry - %load_horiz2 = load i32, i32* %horiz, align 4 + %load_horiz2 = load i32, ptr %horiz, align 4 %tmpVar3 = add i32 %load_horiz2, 2 - store i32 %tmpVar3, i32* %horiz, align 4 + store i32 %tmpVar3, ptr %horiz, align 4 br label %continue case4: ; preds = %entry - %load_depth = load i32, i32* %depth, align 4 + %load_depth = load i32, ptr %depth, align 4 %tmpVar5 = sub i32 %load_depth, 1 - store i32 %tmpVar5, i32* %depth, align 4 + store i32 %tmpVar5, ptr %depth, align 4 br label %continue case6: ; preds = %entry - %load_depth7 = load i32, i32* %depth, align 4 + %load_depth7 = load i32, ptr %depth, align 4 %tmpVar8 = add i32 %load_depth7, 1 - store i32 %tmpVar8, i32* %depth, align 4 + store i32 %tmpVar8, ptr %depth, align 4 br label %continue else: ; preds = %entry br label %continue continue: ; preds = %else, %case6, %case4, %case1, %case - %drive_ret = load i32, i32* %drive, align 4 + %drive_ret = load i32, ptr %drive, align 4 ret i32 %drive_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_multiple_labels_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_multiple_labels_statement.snap index c9f4edd47f5..f05e0585251 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_multiple_labels_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_multiple_labels_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 switch i32 %load_x, label %else [ i32 1, label %case i32 2, label %case @@ -25,15 +24,15 @@ entry: ] case: ; preds = %entry, %entry - store i32 1, i32* %y, align 4 + store i32 1, ptr %y, align 4 br label %continue case1: ; preds = %entry, %entry - store i32 2, i32* %y, align 4 + store i32 2, ptr %y, align 4 br label %continue else: ; preds = %entry - store i32 -1, i32* %y, align 4 + store i32 -1, ptr %y, align 4 br label %continue continue: ; preds = %else, %case1, %case diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_ranges_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_ranges_statement.snap index f9e3ecae343..a5437d95c9a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_ranges_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__case_with_ranges_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,25 +11,25 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 switch i32 %load_x, label %else [ ] case: ; preds = %range_then - store i32 2, i32* %y, align 4 + store i32 2, ptr %y, align 4 br label %continue else: ; preds = %entry - %load_x1 = load i32, i32* %x, align 4 + %load_x1 = load i32, ptr %x, align 4 %tmpVar = icmp sge i32 %load_x1, 2 br i1 %tmpVar, label %range_then, label %range_else range_then: ; preds = %else - %load_x2 = load i32, i32* %x, align 4 + %load_x2 = load i32, ptr %x, align 4 %tmpVar3 = icmp sle i32 %load_x2, 3 br i1 %tmpVar3, label %case, label %range_else diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_bool_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_bool_code_gen_test.snap index ddda0d7b319..a2776f9b20a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_bool_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_bool_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i8 1, i8* %z, align 1 - store i8 0, i8* %z, align 1 - store i8 1, i8* %z, align 1 - store i8 0, i8* %z, align 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i8 1, ptr %z, align 1 + store i8 0, ptr %z, align 1 + store i8 1, ptr %z, align 1 + store i8 0, ptr %z, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_code_gen_test.snap index 1925655b163..9a084a2bc59 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,14 +11,14 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = sext i16 %load_x to i32 %tmpVar = add i32 %1, 7 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %z, align 2 + store i16 %2, ptr %z, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_code_gen_test.snap index 895a6806b35..d4bee31ddd2 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,14 +11,14 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = sext i16 %load_x to i32 %tmpVar = add i32 %1, 13 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %z, align 2 + store i16 %2, ptr %z, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_ints_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_ints_code_gen_test.snap index 0cb3affb82d..abf2217ef63 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_ints_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_hex_ints_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,10 +11,10 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 -1, i32* %x, align 4 - store i32 65535, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 -1, ptr %x, align 4 + store i32 65535, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_lreal_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_lreal_code_gen_test.snap index 6012a2a7c8b..aa47a045ba2 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_lreal_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_lreal_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,14 +11,14 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load float, float* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load float, ptr %x, align 4 %1 = fpext float %load_x to double %tmpVar = fadd double %1, 7.700000e+00 %2 = fptrunc double %tmpVar to float - store float %2, float* %z, align 4 + store float %2, ptr %z, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_real_code_gen_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_real_code_gen_test.snap index 838eecf906d..cde8ec8af1e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_real_code_gen_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__casted_literals_real_code_gen_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,13 +11,13 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = sitofp i16 %load_x to float %tmpVar = fdiv float %1, 7.000000e+00 - store float %tmpVar, float* %z, align 4 + store float %tmpVar, ptr %z, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_member_access_from_method.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_member_access_from_method.snap index eaad2331741..1721fbfeffe 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_member_access_from_method.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_member_access_from_method.snap @@ -11,28 +11,28 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 ret void } -define void @MyClass__testMethod(%MyClass* %0, i16 %1) { +define void @MyClass__testMethod(ptr %0, i16 %1) { entry: - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 + store i16 %1, ptr %myMethodArg, align 2 %myMethodLocalVar = alloca i16, align 2 - store i16 0, i16* %myMethodLocalVar, align 2 - %load_myMethodArg = load i16, i16* %myMethodArg, align 2 - store i16 %load_myMethodArg, i16* %x, align 2 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %y, align 2 - %load_myMethodLocalVar = load i16, i16* %myMethodLocalVar, align 2 + store i16 0, ptr %myMethodLocalVar, align 2 + %load_myMethodArg = load i16, ptr %myMethodArg, align 2 + store i16 %load_myMethodArg, ptr %x, align 2 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %y, align 2 + %load_myMethodLocalVar = load i16, ptr %myMethodLocalVar, align 2 %2 = sext i16 %load_myMethodLocalVar to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %3 = sext i16 %load_y to i32 %tmpVar = icmp eq i32 %2, %3 ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_method_in_pou.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_method_in_pou.snap index cd287725b27..ce2812edcad 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_method_in_pou.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__class_method_in_pou.snap @@ -13,43 +13,43 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer @prg_instance = global %prg zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 ret void } -define void @MyClass__testMethod(%MyClass* %0, i16 %1) { +define void @MyClass__testMethod(ptr %0, i16 %1) { entry: - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 + store i16 %1, ptr %myMethodArg, align 2 %myMethodLocalVar = alloca i16, align 2 - store i16 0, i16* %myMethodLocalVar, align 2 - %load_myMethodArg = load i16, i16* %myMethodArg, align 2 - store i16 %load_myMethodArg, i16* %x, align 2 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %y, align 2 - %load_myMethodLocalVar = load i16, i16* %myMethodLocalVar, align 2 + store i16 0, ptr %myMethodLocalVar, align 2 + %load_myMethodArg = load i16, ptr %myMethodArg, align 2 + store i16 %load_myMethodArg, ptr %x, align 2 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %y, align 2 + %load_myMethodLocalVar = load i16, ptr %myMethodLocalVar, align 2 %2 = sext i16 %load_myMethodLocalVar to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %3 = sext i16 %load_y to i32 %tmpVar = icmp eq i32 %2, %3 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %cl = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x1 = getelementptr inbounds %MyClass, %MyClass* %cl, i32 0, i32 0 - %load_x = load i16, i16* %x1, align 2 - store i16 %load_x, i16* %x, align 2 - %load_x2 = load i16, i16* %x, align 2 - call void @MyClass__testMethod(%MyClass* %cl, i16 %load_x2) - %load_x3 = load i16, i16* %x, align 2 - call void @MyClass__testMethod(%MyClass* %cl, i16 %load_x3) + %cl = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x1 = getelementptr inbounds nuw %MyClass, ptr %cl, i32 0, i32 0 + %load_x = load i16, ptr %x1, align 2 + store i16 %load_x, ptr %x, align 2 + %load_x2 = load i16, ptr %x, align 2 + call void @MyClass__testMethod(ptr %cl, i16 %load_x2) + %load_x3 = load i16, ptr %x, align 2 + call void @MyClass__testMethod(ptr %cl, i16 %load_x3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__complex_pointers.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__complex_pointers.snap index 195ed8a2dba..de6ff86f827 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__complex_pointers.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__complex_pointers.snap @@ -1,47 +1,46 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prg = type { i16, [10 x i16], [10 x i16*], [10 x i16]* } +%prg = type { i16, [10 x i16], [10 x ptr], ptr } @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %X = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %arrX = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %arrrX = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %rarrX = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %tmpVar = getelementptr inbounds [10 x i16], [10 x i16]* %arrX, i32 0, i32 0 - %load_X = load i16, i16* %X, align 2 - store i16 %load_X, i16* %tmpVar, align 2 - %tmpVar1 = getelementptr inbounds [10 x i16*], [10 x i16*]* %arrrX, i32 0, i32 1 - %tmpVar2 = getelementptr inbounds [10 x i16], [10 x i16]* %arrX, i32 0, i32 2 - store i16* %tmpVar2, i16** %tmpVar1, align 8 - store [10 x i16]* %arrX, [10 x i16]** %rarrX, align 8 - %tmpVar3 = getelementptr inbounds [10 x i16*], [10 x i16*]* %arrrX, i32 0, i32 3 - %deref = load i16*, i16** %tmpVar3, align 8 - %load_tmpVar = load i16, i16* %deref, align 2 - store i16 %load_tmpVar, i16* %X, align 2 - %deref4 = load [10 x i16]*, [10 x i16]** %rarrX, align 8 - %tmpVar5 = getelementptr inbounds [10 x i16], [10 x i16]* %deref4, i32 0, i32 4 - %load_tmpVar6 = load i16, i16* %tmpVar5, align 2 - store i16 %load_tmpVar6, i16* %X, align 2 - %tmpVar7 = getelementptr inbounds [10 x i16*], [10 x i16*]* %arrrX, i32 0, i32 5 - %deref8 = load i16*, i16** %tmpVar7, align 8 - %load_X9 = load i16, i16* %X, align 2 - store i16 %load_X9, i16* %deref8, align 2 - %deref10 = load [10 x i16]*, [10 x i16]** %rarrX, align 8 - %tmpVar11 = getelementptr inbounds [10 x i16], [10 x i16]* %deref10, i32 0, i32 6 - %tmpVar12 = getelementptr inbounds [10 x i16*], [10 x i16*]* %arrrX, i32 0, i32 7 - %deref13 = load i16*, i16** %tmpVar12, align 8 - %load_tmpVar14 = load i16, i16* %deref13, align 2 - store i16 %load_tmpVar14, i16* %tmpVar11, align 2 + %X = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %arrX = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %arrrX = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %rarrX = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %tmpVar = getelementptr inbounds [10 x i16], ptr %arrX, i32 0, i32 0 + %load_X = load i16, ptr %X, align 2 + store i16 %load_X, ptr %tmpVar, align 2 + %tmpVar1 = getelementptr inbounds [10 x ptr], ptr %arrrX, i32 0, i32 1 + %tmpVar2 = getelementptr inbounds [10 x i16], ptr %arrX, i32 0, i32 2 + store ptr %tmpVar2, ptr %tmpVar1, align 8 + store ptr %arrX, ptr %rarrX, align 8 + %tmpVar3 = getelementptr inbounds [10 x ptr], ptr %arrrX, i32 0, i32 3 + %deref = load ptr, ptr %tmpVar3, align 8 + %load_tmpVar = load i16, ptr %deref, align 2 + store i16 %load_tmpVar, ptr %X, align 2 + %deref4 = load ptr, ptr %rarrX, align 8 + %tmpVar5 = getelementptr inbounds [10 x i16], ptr %deref4, i32 0, i32 4 + %load_tmpVar6 = load i16, ptr %tmpVar5, align 2 + store i16 %load_tmpVar6, ptr %X, align 2 + %tmpVar7 = getelementptr inbounds [10 x ptr], ptr %arrrX, i32 0, i32 5 + %deref8 = load ptr, ptr %tmpVar7, align 8 + %load_X9 = load i16, ptr %X, align 2 + store i16 %load_X9, ptr %deref8, align 2 + %deref10 = load ptr, ptr %rarrX, align 8 + %tmpVar11 = getelementptr inbounds [10 x i16], ptr %deref10, i32 0, i32 6 + %tmpVar12 = getelementptr inbounds [10 x ptr], ptr %arrrX, i32 0, i32 7 + %deref13 = load ptr, ptr %tmpVar12, align 8 + %load_tmpVar14 = load i16, ptr %deref13, align 2 + store i16 %load_tmpVar14, ptr %tmpVar11, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expression_in_function_blocks_are_propagated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expression_in_function_blocks_are_propagated.snap index e9258fc8939..3a0d797b6fd 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expression_in_function_blocks_are_propagated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expression_in_function_blocks_are_propagated.snap @@ -11,12 +11,12 @@ target triple = "[filtered]" @__fbWithConstant__init = unnamed_addr constant %fbWithConstant { i16 0, i16 2 } -define void @fbWithConstant(%fbWithConstant* %0) { +define void @fbWithConstant(ptr %0) { entry: - %this = alloca %fbWithConstant*, align 8 - store %fbWithConstant* %0, %fbWithConstant** %this, align 8 - %x = getelementptr inbounds %fbWithConstant, %fbWithConstant* %0, i32 0, i32 0 - %const = getelementptr inbounds %fbWithConstant, %fbWithConstant* %0, i32 0, i32 1 - store i16 2, i16* %x, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fbWithConstant, ptr %0, i32 0, i32 0 + %const = getelementptr inbounds nuw %fbWithConstant, ptr %0, i32 0, i32 1 + store i16 2, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expressions_in_ranged_type_declaration_are_propagated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expressions_in_ranged_type_declaration_are_propagated.snap index bbfcd2c2b27..9f6c62bc0cb 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expressions_in_ranged_type_declaration_are_propagated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_expressions_in_ranged_type_declaration_are_propagated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,22 +16,22 @@ define i16 @CheckRangeSigned(i16 %0, i16 %1, i16 %2) { entry: %CheckRangeSigned = alloca i16, align 2 %value = alloca i16, align 2 - store i16 %0, i16* %value, align 2 + store i16 %0, ptr %value, align 2 %lower = alloca i16, align 2 - store i16 %1, i16* %lower, align 2 + store i16 %1, ptr %lower, align 2 %upper = alloca i16, align 2 - store i16 %2, i16* %upper, align 2 - store i16 0, i16* %CheckRangeSigned, align 2 - %load_value = load i16, i16* %value, align 2 - store i16 %load_value, i16* %CheckRangeSigned, align 2 - %CheckRangeSigned_ret = load i16, i16* %CheckRangeSigned, align 2 + store i16 %2, ptr %upper, align 2 + store i16 0, ptr %CheckRangeSigned, align 2 + %load_value = load i16, ptr %value, align 2 + store i16 %load_value, ptr %CheckRangeSigned, align 2 + %CheckRangeSigned_ret = load i16, ptr %CheckRangeSigned, align 2 ret i16 %CheckRangeSigned_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i16 @CheckRangeSigned(i16 5, i16 0, i16 8) - store i16 %call, i16* %x, align 2 + store i16 %call, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_propagation_of_struct_fields_on_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_propagation_of_struct_fields_on_assignment.snap index 05ef5080506..ba0ce8959cb 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_propagation_of_struct_fields_on_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__constant_propagation_of_struct_fields_on_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,10 +16,10 @@ define i32 @main() { entry: %main = alloca i32, align 4 %local_value = alloca i32, align 4 - store i32 0, i32* %local_value, align 4 - store i32 0, i32* %main, align 4 - %load_value = load i32, i32* getelementptr inbounds (%STRUCT1, %STRUCT1* @MyStruct, i32 0, i32 0), align 4 - store i32 %load_value, i32* %local_value, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 0, ptr %local_value, align 4 + store i32 0, ptr %main, align 4 + %load_value = load i32, ptr @MyStruct, align 4 + store i32 %load_value, ptr %local_value, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__contants_in_case_statements_resolved.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__contants_in_case_statements_resolved.snap index dd70063f19a..05137f95352 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__contants_in_case_statements_resolved.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__contants_in_case_statements_resolved.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,44 +11,44 @@ target triple = "[filtered]" @main_instance = global %main { i32 0, i32 60 } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %DAYS_IN_MONTH = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %SIXTY = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %load_DAYS_IN_MONTH = load i32, i32* %DAYS_IN_MONTH, align 4 + %DAYS_IN_MONTH = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %SIXTY = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %load_DAYS_IN_MONTH = load i32, ptr %DAYS_IN_MONTH, align 4 switch i32 %load_DAYS_IN_MONTH, label %else [ ] case: ; preds = %range_then - store i32 29, i32* %DAYS_IN_MONTH, align 4 + store i32 29, ptr %DAYS_IN_MONTH, align 4 br label %continue case4: ; preds = %range_then5 - store i32 30, i32* %DAYS_IN_MONTH, align 4 + store i32 30, ptr %DAYS_IN_MONTH, align 4 br label %continue else: ; preds = %entry - %load_DAYS_IN_MONTH1 = load i32, i32* %DAYS_IN_MONTH, align 4 + %load_DAYS_IN_MONTH1 = load i32, ptr %DAYS_IN_MONTH, align 4 %tmpVar = icmp sge i32 %load_DAYS_IN_MONTH1, 32 br i1 %tmpVar, label %range_then, label %range_else range_then: ; preds = %else - %load_DAYS_IN_MONTH2 = load i32, i32* %DAYS_IN_MONTH, align 4 + %load_DAYS_IN_MONTH2 = load i32, ptr %DAYS_IN_MONTH, align 4 %tmpVar3 = icmp sle i32 %load_DAYS_IN_MONTH2, 60 br i1 %tmpVar3, label %case, label %range_else range_else: ; preds = %range_then, %else - %load_DAYS_IN_MONTH7 = load i32, i32* %DAYS_IN_MONTH, align 4 + %load_DAYS_IN_MONTH7 = load i32, ptr %DAYS_IN_MONTH, align 4 %tmpVar8 = icmp sge i32 %load_DAYS_IN_MONTH7, 62 br i1 %tmpVar8, label %range_then5, label %range_else6 range_then5: ; preds = %range_else - %load_DAYS_IN_MONTH9 = load i32, i32* %DAYS_IN_MONTH, align 4 + %load_DAYS_IN_MONTH9 = load i32, ptr %DAYS_IN_MONTH, align 4 %tmpVar10 = icmp sle i32 %load_DAYS_IN_MONTH9, 70 br i1 %tmpVar10, label %case4, label %range_else6 range_else6: ; preds = %range_then5, %range_else - store i32 31, i32* %DAYS_IN_MONTH, align 4 + store i32 31, ptr %DAYS_IN_MONTH, align 4 br label %continue continue: ; preds = %range_else6, %case4, %case diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_addition_in_var_output.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_addition_in_var_output.snap index fc50d9d1cd3..3a9d5d5a230 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_addition_in_var_output.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_addition_in_var_output.snap @@ -1,28 +1,27 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i32 @func(i64* %0, i64* %1) { +define i32 @func(ptr %0, ptr %1) { entry: %func = alloca i32, align 4 - %d_and_t = alloca i64*, align 8 - store i64* %0, i64** %d_and_t, align 8 - %time_var = alloca i64*, align 8 - store i64* %1, i64** %time_var, align 8 - store i32 0, i32* %func, align 4 - %deref = load i64*, i64** %d_and_t, align 8 - %deref1 = load i64*, i64** %d_and_t, align 8 - %load_d_and_t = load i64, i64* %deref1, align 8 - %deref2 = load i64*, i64** %time_var, align 8 - %load_time_var = load i64, i64* %deref2, align 8 + %d_and_t = alloca ptr, align 8 + store ptr %0, ptr %d_and_t, align 8 + %time_var = alloca ptr, align 8 + store ptr %1, ptr %time_var, align 8 + store i32 0, ptr %func, align 4 + %deref = load ptr, ptr %d_and_t, align 8 + %deref1 = load ptr, ptr %d_and_t, align 8 + %load_d_and_t = load i64, ptr %deref1, align 8 + %deref2 = load ptr, ptr %time_var, align 8 + %load_time_var = load i64, ptr %deref2, align 8 %tmpVar = add i64 %load_d_and_t, %load_time_var - store i64 %tmpVar, i64* %deref, align 8 - %func_ret = load i32, i32* %func, align 4 + store i64 %tmpVar, ptr %deref, align 8 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_global_constants_initialize.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_global_constants_initialize.snap index 544b86feb71..9487f177f3d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_global_constants_initialize.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_and_time_global_constants_initialize.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -28,7 +27,7 @@ target triple = "[filtered]" @cLDT_SHORT = unnamed_addr constant i64 172799123000000 @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %t1 = alloca i64, align 8 %t2 = alloca i64, align 8 @@ -46,37 +45,37 @@ entry: %dt2 = alloca i64, align 8 %ldt1 = alloca i64, align 8 %ldt2 = alloca i64, align 8 - store i64 0, i64* %t1, align 8 - store i64 0, i64* %t2, align 8 - store i64 0, i64* %lt1, align 8 - store i64 0, i64* %lt2, align 8 - store i64 0, i64* %d1, align 8 - store i64 0, i64* %d2, align 8 - store i64 0, i64* %ld1, align 8 - store i64 0, i64* %ld2, align 8 - store i64 0, i64* %tod1, align 8 - store i64 0, i64* %tod2, align 8 - store i64 0, i64* %ltod1, align 8 - store i64 0, i64* %ltod2, align 8 - store i64 0, i64* %dt1, align 8 - store i64 0, i64* %dt2, align 8 - store i64 0, i64* %ldt1, align 8 - store i64 0, i64* %ldt2, align 8 - store i64 1000000000, i64* %t1, align 8 - store i64 1000000000, i64* %t2, align 8 - store i64 1000000000000, i64* %lt1, align 8 - store i64 1000000000000, i64* %lt2, align 8 - store i64 0, i64* %d1, align 8 - store i64 161308800000000000, i64* %d2, align 8 - store i64 161308800000000000, i64* %ld1, align 8 - store i64 161308800000000000, i64* %ld2, align 8 - store i64 0, i64* %tod1, align 8 - store i64 0, i64* %tod2, align 8 - store i64 86399999999999, i64* %ltod1, align 8 - store i64 86399999999999, i64* %ltod2, align 8 - store i64 172799000000000, i64* %dt1, align 8 - store i64 172799000000000, i64* %dt2, align 8 - store i64 172799123000000, i64* %ldt1, align 8 - store i64 172799123000000, i64* %ldt2, align 8 + store i64 0, ptr %t1, align 8 + store i64 0, ptr %t2, align 8 + store i64 0, ptr %lt1, align 8 + store i64 0, ptr %lt2, align 8 + store i64 0, ptr %d1, align 8 + store i64 0, ptr %d2, align 8 + store i64 0, ptr %ld1, align 8 + store i64 0, ptr %ld2, align 8 + store i64 0, ptr %tod1, align 8 + store i64 0, ptr %tod2, align 8 + store i64 0, ptr %ltod1, align 8 + store i64 0, ptr %ltod2, align 8 + store i64 0, ptr %dt1, align 8 + store i64 0, ptr %dt2, align 8 + store i64 0, ptr %ldt1, align 8 + store i64 0, ptr %ldt2, align 8 + store i64 1000000000, ptr %t1, align 8 + store i64 1000000000, ptr %t2, align 8 + store i64 1000000000000, ptr %lt1, align 8 + store i64 1000000000000, ptr %lt2, align 8 + store i64 0, ptr %d1, align 8 + store i64 161308800000000000, ptr %d2, align 8 + store i64 161308800000000000, ptr %ld1, align 8 + store i64 161308800000000000, ptr %ld2, align 8 + store i64 0, ptr %tod1, align 8 + store i64 0, ptr %tod2, align 8 + store i64 86399999999999, ptr %ltod1, align 8 + store i64 86399999999999, ptr %ltod2, align 8 + store i64 172799000000000, ptr %dt1, align 8 + store i64 172799000000000, ptr %dt2, align 8 + store i64 172799123000000, ptr %ldt1, align 8 + store i64 172799123000000, ptr %ldt2, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_comparisons.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_comparisons.snap index c6eae872411..5fa62f74918 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_comparisons.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__date_comparisons.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,19 +11,19 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %d = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %load_a = load i64, i64* %a, align 8 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %d = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %load_a = load i64, ptr %a, align 8 %tmpVar = icmp sgt i64 %load_a, 1619827200000000000 - %load_b = load i64, i64* %b, align 8 + %load_b = load i64, ptr %b, align 8 %tmpVar1 = icmp sgt i64 %load_b, 1619897357000000000 - %load_c = load i64, i64* %c, align 8 + %load_c = load i64, ptr %c, align 8 %tmpVar2 = icmp sgt i64 %load_c, 156557000000000 - %load_d = load i64, i64* %d, align 8 + %load_d = load i64, ptr %d, align 8 %tmpVar3 = icmp sgt i64 %load_d, 70157000000000 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__default_values_for_not_initialized_function_vars.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__default_values_for_not_initialized_function_vars.snap index 664deeea1c7..36f365fee1c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__default_values_for_not_initialized_function_vars.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__default_values_for_not_initialized_function_vars.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,19 +12,18 @@ entry: %func = alloca i16, align 2 %int_var = alloca i16, align 2 %arr_var = alloca [3 x i32], align 4 - %ptr_var = alloca i32*, align 8 + %ptr_var = alloca ptr, align 8 %float_var = alloca float, align 4 - store i16 0, i16* %int_var, align 2 - %0 = bitcast [3 x i32]* %arr_var to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([3 x i32]* getelementptr ([3 x i32], [3 x i32]* null, i32 1) to i64), i1 false) - store i32* null, i32** %ptr_var, align 8 - store float 0.000000e+00, float* %float_var, align 4 - store i16 0, i16* %func, align 2 - %func_ret = load i16, i16* %func, align 2 + store i16 0, ptr %int_var, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %arr_var, i8 0, i64 ptrtoint (ptr getelementptr ([3 x i32], ptr null, i32 1) to i64), i1 false) + store ptr null, ptr %ptr_var, align 8 + store float 0.000000e+00, ptr %float_var, align 4 + store i16 0, ptr %func, align 2 + %func_ret = load i16, ptr %func, align 2 ret i16 %func_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__different_case_references.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__different_case_references.snap index f842b3ba5f6..38986e8c45a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__different_case_references.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__different_case_references.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,10 +11,10 @@ target triple = "[filtered]" @prg_instance = global %prg { i16 0, i16 1, i32 2 } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %zz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %zz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_function_with_name_generates_int_function.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_function_with_name_generates_int_function.snap index 80b8915ddcb..cf6217219cd 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_function_with_name_generates_int_function.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_function_with_name_generates_int_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,7 +10,7 @@ target triple = "[filtered]" define i16 @foo() { entry: %foo = alloca i16, align 2 - store i16 0, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + store i16 0, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_global_variable_list_generates_nothing.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_global_variable_list_generates_nothing.snap index ff7f91f2daf..0fc5e59b1e7 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_global_variable_list_generates_nothing.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_global_variable_list_generates_nothing.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,7 +11,7 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_program_with_name_generates_void_function.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_program_with_name_generates_void_function.snap index 5a1acf1006e..4ff4f5a8aa4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_program_with_name_generates_void_function.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_program_with_name_generates_void_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,7 +11,7 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_statements_dont_generate_anything.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_statements_dont_generate_anything.snap index c581c13ce15..8595d140303 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_statements_dont_generate_anything.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__empty_statements_dont_generate_anything.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 - %load_y = load i32, i32* %y, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 + %load_y = load i32, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enum_members_can_be_used_in_asignments.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enum_members_can_be_used_in_asignments.snap index c1b5088c34e..345e3a9791c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enum_members_can_be_used_in_asignments.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enum_members_can_be_used_in_asignments.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,11 +14,11 @@ target triple = "[filtered]" @MyEnum.yellow = unnamed_addr constant i32 1 @MyEnum.green = unnamed_addr constant i32 2 -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %color = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - store i32 0, i32* %color, align 4 - store i32 1, i32* %color, align 4 - store i32 2, i32* %color, align 4 + %color = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + store i32 0, ptr %color, align 4 + store i32 1, ptr %color, align 4 + store i32 2, ptr %color, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enums_custom_type_are_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enums_custom_type_are_generated.snap index 5ad32fb833f..556c5221054 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enums_custom_type_are_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__enums_custom_type_are_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,8 +15,8 @@ target triple = "[filtered]" @TrafficLight.Yellow = unnamed_addr constant i32 2 @TrafficLight.Green = unnamed_addr constant i32 3 -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %tf1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %tf1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_function_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_function_called_in_program.snap index efdb31739fe..94e39c2f984 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_function_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_function_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,7 +13,7 @@ target triple = "[filtered]" declare i32 @foo() -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: %call = call i32 @foo() ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_global_variable_generates_as_external.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_global_variable_generates_as_external.snap index 378ebf7addd..9bd4f7f23ef 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_global_variable_generates_as_external.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_global_variable_generates_as_external.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,7 +13,7 @@ target triple = "[filtered]" @gY = external global i8 @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_program_global_var_is_external.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_program_global_var_is_external.snap index b9db48f6b59..54258b062e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_program_global_var_is_external.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__external_program_global_var_is_external.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,4 +11,4 @@ target triple = "[filtered]" @prg_instance = external global %prg -declare void @prg(%prg*) +declare void @prg(ptr) diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_called_as_function.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_called_as_function.snap index bf0cfafb7ec..2a744300308 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_called_as_function.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_called_as_function.snap @@ -11,46 +11,46 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 - %call = call i16 @MyClass__testMethod(%MyClass* %0, i16 1) - %call1 = call i16 @MyClass__testMethod(%MyClass* %0, i16 3) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 + %call = call i16 @MyClass__testMethod(ptr %0, i16 1) + %call1 = call i16 @MyClass__testMethod(ptr %0, i16 3) ret void } -define i16 @MyClass__testMethod(%MyClass* %0, i16 %1) { +define i16 @MyClass__testMethod(ptr %0, i16 %1) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 %MyClass.testMethod = alloca i16, align 2 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 + store i16 %1, ptr %myMethodArg, align 2 %myMethodLocalVar = alloca i16, align 2 - store i16 0, i16* %myMethodLocalVar, align 2 - store i16 0, i16* %MyClass.testMethod, align 2 - %load_myMethodArg = load i16, i16* %myMethodArg, align 2 - store i16 %load_myMethodArg, i16* %x, align 2 - %load_x = load i16, i16* %x, align 2 + store i16 0, ptr %myMethodLocalVar, align 2 + store i16 0, ptr %MyClass.testMethod, align 2 + %load_myMethodArg = load i16, ptr %myMethodArg, align 2 + store i16 %load_myMethodArg, ptr %x, align 2 + %load_x = load i16, ptr %x, align 2 %2 = sext i16 %load_x to i32 %tmpVar = add i32 %2, 1 %3 = trunc i32 %tmpVar to i16 - store i16 %3, i16* %y, align 2 - %load_y = load i16, i16* %y, align 2 + store i16 %3, ptr %y, align 2 + %load_y = load i16, ptr %y, align 2 %4 = sext i16 %load_y to i32 %tmpVar1 = add i32 %4, 1 %5 = trunc i32 %tmpVar1 to i16 - store i16 %5, i16* %myMethodLocalVar, align 2 - %load_myMethodLocalVar = load i16, i16* %myMethodLocalVar, align 2 + store i16 %5, ptr %myMethodLocalVar, align 2 + %load_myMethodLocalVar = load i16, ptr %myMethodLocalVar, align 2 %6 = sext i16 %load_myMethodLocalVar to i32 %tmpVar2 = add i32 %6, 1 %7 = trunc i32 %tmpVar2 to i16 - store i16 %7, i16* %MyClass.testMethod, align 2 - %MyClass__testMethod_ret = load i16, i16* %MyClass.testMethod, align 2 + store i16 %7, ptr %MyClass.testMethod, align 2 + %MyClass__testMethod_ret = load i16, ptr %MyClass.testMethod, align 2 ret i16 %MyClass__testMethod_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_in_pou.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_in_pou.snap index b70e98ff1e0..ecc242e67f8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_in_pou.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_in_pou.snap @@ -13,47 +13,47 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer @prg_instance = global %prg zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 ret void } -define void @MyClass__testMethod(%MyClass* %0, i16 %1) { +define void @MyClass__testMethod(ptr %0, i16 %1) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 + store i16 %1, ptr %myMethodArg, align 2 %myMethodLocalVar = alloca i16, align 2 - store i16 0, i16* %myMethodLocalVar, align 2 - %load_myMethodArg = load i16, i16* %myMethodArg, align 2 - store i16 %load_myMethodArg, i16* %x, align 2 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %y, align 2 - %load_myMethodLocalVar = load i16, i16* %myMethodLocalVar, align 2 + store i16 0, ptr %myMethodLocalVar, align 2 + %load_myMethodArg = load i16, ptr %myMethodArg, align 2 + store i16 %load_myMethodArg, ptr %x, align 2 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %y, align 2 + %load_myMethodLocalVar = load i16, ptr %myMethodLocalVar, align 2 %2 = sext i16 %load_myMethodLocalVar to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %3 = sext i16 %load_y to i32 %tmpVar = icmp eq i32 %2, %3 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %cl = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x1 = getelementptr inbounds %MyClass, %MyClass* %cl, i32 0, i32 0 - %load_x = load i16, i16* %x1, align 2 - store i16 %load_x, i16* %x, align 2 - %load_x2 = load i16, i16* %x, align 2 - call void @MyClass__testMethod(%MyClass* %cl, i16 %load_x2) - %load_x3 = load i16, i16* %x, align 2 - call void @MyClass__testMethod(%MyClass* %cl, i16 %load_x3) + %cl = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x1 = getelementptr inbounds nuw %MyClass, ptr %cl, i32 0, i32 0 + %load_x = load i16, ptr %x1, align 2 + store i16 %load_x, ptr %x, align 2 + %load_x2 = load i16, ptr %x, align 2 + call void @MyClass__testMethod(ptr %cl, i16 %load_x2) + %load_x3 = load i16, ptr %x, align 2 + call void @MyClass__testMethod(ptr %cl, i16 %load_x3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_in_out.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_in_out.snap index fd8a47323ce..e8f94457e87 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_in_out.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_in_out.snap @@ -13,33 +13,33 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer @prg_instance = global %prg zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 ret void } -define void @MyClass__testMethod(%MyClass* %0, i16* %1) { +define void @MyClass__testMethod(ptr %0, ptr %1) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 - %myMethodArg = alloca i16*, align 8 - store i16* %1, i16** %myMethodArg, align 8 - %deref = load i16*, i16** %myMethodArg, align 8 - %load_x = load i16, i16* %x, align 2 - store i16 %load_x, i16* %deref, align 2 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 + %myMethodArg = alloca ptr, align 8 + store ptr %1, ptr %myMethodArg, align 8 + %deref = load ptr, ptr %myMethodArg, align 8 + %load_x = load i16, ptr %x, align 2 + store i16 %load_x, ptr %deref, align 2 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %cl = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - call void @MyClass__testMethod(%MyClass* %cl, i16* %x) + %cl = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @MyClass__testMethod(ptr %cl, ptr %x) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_input_defaults.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_input_defaults.snap index 311ec5917e8..dab9fa99b51 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_input_defaults.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__fb_method_with_var_input_defaults.snap @@ -13,31 +13,31 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer @prg_instance = global %prg zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 ret void } -define void @MyClass__testMethod(%MyClass* %0, i16 %1) { +define void @MyClass__testMethod(ptr %0, i16 %1) { entry: - %this = alloca %MyClass*, align 8 - store %MyClass* %0, %MyClass** %this, align 8 - %x = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 0 - %y = getelementptr inbounds %MyClass, %MyClass* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %MyClass, ptr %0, i32 0, i32 1 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 - %load_myMethodArg = load i16, i16* %myMethodArg, align 2 - store i16 %load_myMethodArg, i16* %x, align 2 + store i16 %1, ptr %myMethodArg, align 2 + %load_myMethodArg = load i16, ptr %myMethodArg, align 2 + store i16 %load_myMethodArg, ptr %x, align 2 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %cl = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - call void @MyClass__testMethod(%MyClass* %cl, i16 3) + %cl = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + call void @MyClass__testMethod(ptr %cl, i16 3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_continue.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_continue.snap index 02d4fca4109..7d22bee8b04 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_continue.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_continue.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,19 +11,19 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 3, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 3, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %2, 10 br i1 %condition1, label %loop, label %continue @@ -32,12 +31,12 @@ loop: ; preds = %predicate_sge, %pre br label %increment increment: ; preds = %loop - %3 = load i32, i32* %x, align 4 + %3 = load i32, ptr %x, align 4 %next = add i32 1, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_int.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_int.snap index ca6110a60bb..1ef4186c8f3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_int.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_int.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,34 +11,34 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i16 3, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i16 3, ptr %x, align 2 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i16, i16* %x, align 2 + %1 = load i16, ptr %x, align 2 %2 = sext i16 %1 to i32 %condition = icmp sle i32 %2, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %3 = load i16, i16* %x, align 2 + %3 = load i16, ptr %x, align 2 %4 = sext i16 %3 to i32 %condition1 = icmp sge i32 %4, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i16, i16* %x, align 2 + %load_x = load i16, ptr %x, align 2 br label %increment increment: ; preds = %loop - %5 = load i16, i16* %x, align 2 + %5 = load i16, ptr %x, align 2 %6 = sext i16 %5 to i32 %next = add i32 1, %6 %7 = trunc i32 %next to i16 - store i16 %7, i16* %x, align 2 + store i16 %7, ptr %x, align 2 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_lint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_lint.snap index de600044ea3..297abbe3da6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_lint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_lint.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,30 +11,30 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i64 3, i64* %x, align 8 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i64 3, ptr %x, align 8 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i64, i64* %x, align 8 + %1 = load i64, ptr %x, align 8 %condition = icmp sle i64 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i64, i64* %x, align 8 + %2 = load i64, ptr %x, align 8 %condition1 = icmp sge i64 %2, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i64, i64* %x, align 8 + %load_x = load i64, ptr %x, align 8 br label %increment increment: ; preds = %loop - %3 = load i64, i64* %x, align 8 + %3 = load i64, ptr %x, align 8 %next = add i64 1, %3 - store i64 %next, i64* %x, align 8 + store i64 %next, ptr %x, align 8 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_sint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_sint.snap index e8486f762be..2100b66f40d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_sint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_sint.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,34 +11,34 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i8 3, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i8 3, ptr %x, align 1 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i8, i8* %x, align 1 + %1 = load i8, ptr %x, align 1 %2 = sext i8 %1 to i32 %condition = icmp sle i32 %2, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %3 = load i8, i8* %x, align 1 + %3 = load i8, ptr %x, align 1 %4 = sext i8 %3 to i32 %condition1 = icmp sge i32 %4, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i8, i8* %x, align 1 + %load_x = load i8, ptr %x, align 1 br label %increment increment: ; preds = %loop - %5 = load i8, i8* %x, align 1 + %5 = load i8, ptr %x, align 1 %6 = sext i8 %5 to i32 %next = add i32 1, %6 %7 = trunc i32 %next to i8 - store i8 %7, i8* %x, align 1 + store i8 %7, ptr %x, align 1 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_continue.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_continue.snap index b3e93af44d0..c0a5428a3e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_continue.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_continue.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,38 +11,38 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 3, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 3, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %2, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 1 - store i32 %tmpVar, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 br label %increment buffer_block: ; No predecessors! - %load_x2 = load i32, i32* %x, align 4 + %load_x2 = load i32, ptr %x, align 4 %tmpVar3 = sub i32 %load_x2, 1 - store i32 %tmpVar3, i32* %x, align 4 + store i32 %tmpVar3, ptr %x, align 4 br label %increment increment: ; preds = %buffer_block, %loop - %3 = load i32, i32* %x, align 4 + %3 = load i32, ptr %x, align 4 %next = add i32 7, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_exit.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_exit.snap index f5006ef21d5..c15977ad91a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_exit.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_exit.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,38 +11,38 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 3, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 3, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %2, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 2 - store i32 %tmpVar, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 br label %continue buffer_block: ; No predecessors! - %load_x2 = load i32, i32* %x, align 4 + %load_x2 = load i32, ptr %x, align 4 %tmpVar3 = add i32 %load_x2, 5 - store i32 %tmpVar3, i32* %x, align 4 + store i32 %tmpVar3, ptr %x, align 4 br label %increment increment: ; preds = %buffer_block - %3 = load i32, i32* %x, align 4 + %3 = load i32, ptr %x, align 4 %next = add i32 7, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %loop, %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_references_steps_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_references_steps_test.snap index e06586770b6..9525a29e788 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_references_steps_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_references_steps_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,39 +11,39 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %step = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %load_y = load i32, i32* %y, align 4 - store i32 %load_y, i32* %x, align 4 - %load_step = load i32, i32* %step, align 4 + %step = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %load_y = load i32, ptr %y, align 4 + store i32 %load_y, ptr %x, align 4 + %load_step = load i32, ptr %step, align 4 %is_incrementing = icmp sgt i32 %load_step, 0 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %z, align 4 - %2 = load i32, i32* %x, align 4 + %1 = load i32, ptr %z, align 4 + %2 = load i32, ptr %x, align 4 %condition = icmp sle i32 %2, %1 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %3 = load i32, i32* %z, align 4 - %4 = load i32, i32* %x, align 4 + %3 = load i32, ptr %z, align 4 + %4 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %4, %3 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %increment increment: ; preds = %loop - %5 = load i32, i32* %x, align 4 - %load_step2 = load i32, i32* %step, align 4 + %5 = load i32, ptr %x, align 4 + %load_step2 = load i32, ptr %step, align 4 %next = add i32 %load_step2, %5 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 %is_incrementing, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_steps_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_steps_test.snap index 9e0bbb8727d..de417fdb7f9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_steps_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_with_steps_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,30 +11,30 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 3, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 3, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %2, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %increment increment: ; preds = %loop - %3 = load i32, i32* %x, align 4 + %3 = load i32, ptr %x, align 4 %next = add i32 7, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_without_steps_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_without_steps_test.snap index 24453db05ed..67d094a6f74 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_without_steps_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__for_statement_without_steps_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,30 +11,30 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 3, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 3, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge predicate_sle: ; preds = %increment, %entry - %1 = load i32, i32* %x, align 4 + %1 = load i32, ptr %x, align 4 %condition = icmp sle i32 %1, 10 br i1 %condition, label %loop, label %continue predicate_sge: ; preds = %increment, %entry - %2 = load i32, i32* %x, align 4 + %2 = load i32, ptr %x, align 4 %condition1 = icmp sge i32 %2, 10 br i1 %condition1, label %loop, label %continue loop: ; preds = %predicate_sge, %predicate_sle - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %increment increment: ; preds = %loop - %3 = load i32, i32* %x, align 4 + %3 = load i32, ptr %x, align 4 %next = add i32 1, %3 - store i32 %next, i32* %x, align 4 + store i32 %next, ptr %x, align 4 br i1 true, label %predicate_sle, label %predicate_sge continue: ; preds = %predicate_sge, %predicate_sle diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_instance_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_instance_call.snap index a3135862470..b691128df4e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_instance_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_instance_call.snap @@ -13,18 +13,18 @@ target triple = "[filtered]" @__foo__init = unnamed_addr constant %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %fb_inst = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - call void @foo(%foo* %fb_inst) + %fb_inst = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + call void @foo(ptr %fb_inst) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_qualified_instance_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_qualified_instance_call.snap index 711bb6736cb..9591c13f73d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_qualified_instance_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_block_qualified_instance_call.snap @@ -15,25 +15,25 @@ target triple = "[filtered]" @__bar__init = unnamed_addr constant %bar zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %bar_inst = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %bar_inst = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } -define void @bar(%bar* %0) { +define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %foo_inst = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %bar_inst = getelementptr inbounds %foo, %foo* %foo_inst, i32 0, i32 0 - call void @bar(%bar* %bar_inst) + %foo_inst = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %bar_inst = getelementptr inbounds nuw %foo, ptr %foo_inst, i32 0, i32 0 + call void @bar(ptr %bar_inst) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_call_with_same_name_as_return_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_call_with_same_name_as_return_type.snap index ab98c69be38..e419a56c47b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_call_with_same_name_as_return_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_call_with_same_name_as_return_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,12 +14,12 @@ target triple = "[filtered]" define i64 @TIME() { entry: %TIME = alloca i64, align 8 - store i64 0, i64* %TIME, align 8 - %TIME_ret = load i64, i64* %TIME, align 8 + store i64 0, ptr %TIME, align 8 + %TIME_ret = load i64, ptr %TIME, align 8 ret i64 %TIME_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: %call = call i64 @TIME() ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_in_program.snap index c6ace5627b6..9f0f56be426 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,16 +14,16 @@ target triple = "[filtered]" define i32 @foo() { entry: %foo = alloca i32, align 4 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i32 @foo() - store i32 %call, i32* %x, align 4 + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_when_shadowed.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_when_shadowed.snap index 0c879f6608c..4ab6d4e6ab0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_when_shadowed.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_called_when_shadowed.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,16 +14,16 @@ target triple = "[filtered]" define i32 @foo() { entry: %foo = alloca i32, align 4 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %froo = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %froo = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i32 @foo() - store i32 %call, i32* %froo, align 4 + store i32 %call, ptr %froo, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_temp_var_initialization.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_temp_var_initialization.snap index 1fe2820215b..3742adbab4a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_temp_var_initialization.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_temp_var_initialization.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,24 +15,24 @@ define i32 @foo(i32 %0) { entry: %foo = alloca i32, align 4 %in1 = alloca i32, align 4 - store i32 %0, i32* %in1, align 4 + store i32 %0, ptr %in1, align 4 %x = alloca i16, align 2 %y = alloca i16, align 2 %z = alloca i16, align 2 - store i16 7, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 9, i16* %z, align 2 - store i32 0, i32* %foo, align 4 - %load_z = load i16, i16* %z, align 2 + store i16 7, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 9, ptr %z, align 2 + store i32 0, ptr %foo, align 4 + %load_z = load i16, ptr %z, align 2 %1 = sext i16 %load_z to i32 %tmpVar = add i32 %1, 1 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %y, align 2 - %foo_ret = load i32, i32* %foo, align 4 + store i16 %2, ptr %y, align 2 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: %call = call i32 @foo(i32 5) ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_var_initialization_and_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_var_initialization_and_call.snap index 1ebb89bcb30..544feca54b5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_var_initialization_and_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_local_var_initialization_and_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,20 +15,20 @@ define i32 @foo(i32 %0) { entry: %foo = alloca i32, align 4 %in1 = alloca i32, align 4 - store i32 %0, i32* %in1, align 4 + store i32 %0, ptr %in1, align 4 %x = alloca i16, align 2 %y = alloca i16, align 2 %z = alloca i16, align 2 - store i16 7, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 9, i16* %z, align 2 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i16 7, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 9, ptr %z, align 2 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: %call = call i32 @foo(i32 5) ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_parameters_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_parameters_called_in_program.snap index d007ed4a0c6..568ac1f4e2b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_parameters_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_parameters_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,17 +15,17 @@ define i32 @foo(i32 %0) { entry: %foo = alloca i32, align 4 %bar = alloca i32, align 4 - store i32 %0, i32* %bar, align 4 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %bar, align 4 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i32 @foo(i32 2) - store i32 %call, i32* %x, align 4 + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_two_parameters_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_two_parameters_called_in_program.snap index 74bf8ecf889..096a79a7f7e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_two_parameters_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__function_with_two_parameters_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,19 +15,19 @@ define i32 @foo(i32 %0, i8 %1) { entry: %foo = alloca i32, align 4 %bar = alloca i32, align 4 - store i32 %0, i32* %bar, align 4 + store i32 %0, ptr %bar, align 4 %buz = alloca i8, align 1 - store i8 %1, i8* %buz, align 1 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i8 %1, ptr %buz, align 1 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i32 @foo(i32 2, i8 1) - store i32 %call, i32* %x, align 4 + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__global_variable_reference_is_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__global_variable_reference_is_generated.snap index b7547e46e38..52f6a168c5f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__global_variable_reference_is_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__global_variable_reference_is_generated.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: function -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,11 +12,11 @@ target triple = "[filtered]" @gX = global i16 0 @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i16 20, i16* @gX, align 2 - %load_gX = load i16, i16* @gX, align 2 - store i16 %load_gX, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i16 20, ptr @gX, align 2 + %load_gX = load i16, ptr @gX, align 2 + store i16 %load_gX, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_elsif_else_generator_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_elsif_else_generator_test.snap index 2e5bf6202a3..5983f7994f8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_elsif_else_generator_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_elsif_else_generator_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,43 +11,43 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %u = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %b1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 4 - %b2 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 5 - %b3 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 6 - %load_b1 = load i8, i8* %b1, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %u = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %b1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 4 + %b2 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 5 + %b3 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 6 + %load_b1 = load i8, ptr %b1, align 1 %1 = icmp ne i8 %load_b1, 0 br i1 %1, label %condition_body, label %branch condition_body: ; preds = %entry - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %continue branch: ; preds = %entry - %load_b2 = load i8, i8* %b2, align 1 + %load_b2 = load i8, ptr %b2, align 1 %2 = icmp ne i8 %load_b2, 0 br i1 %2, label %condition_body2, label %branch1 condition_body2: ; preds = %branch - %load_y = load i32, i32* %y, align 4 + %load_y = load i32, ptr %y, align 4 br label %continue branch1: ; preds = %branch - %load_b3 = load i8, i8* %b3, align 1 + %load_b3 = load i8, ptr %b3, align 1 %3 = icmp ne i8 %load_b3, 0 br i1 %3, label %condition_body3, label %else condition_body3: ; preds = %branch1 - %load_z = load i32, i32* %z, align 4 + %load_z = load i32, ptr %z, align 4 br label %continue else: ; preds = %branch1 - %load_u = load i32, i32* %u, align 4 + %load_u = load i32, ptr %u, align 4 br label %continue continue: ; preds = %else, %condition_body3, %condition_body2, %condition_body diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_generator_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_generator_test.snap index 86eab054f2c..3ec27f598a9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_generator_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_generator_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_b1 = load i8, i8* %b1, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_b1 = load i8, ptr %b1, align 1 %1 = icmp ne i8 %load_b1, 0 br i1 %1, label %condition_body, label %continue condition_body: ; preds = %entry - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 br label %continue continue: ; preds = %condition_body, %entry diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_with_expression_generator_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_with_expression_generator_test.snap index 4a1e10b1df8..87dbe297bd1 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_with_expression_generator_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__if_with_expression_generator_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,25 +11,25 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 %tmpVar = icmp sgt i32 %load_x, 1 %1 = zext i1 %tmpVar to i8 %2 = icmp ne i8 %1, 0 br i1 %2, label %5, label %3 condition_body: ; preds = %5 - %load_x1 = load i32, i32* %x, align 4 + %load_x1 = load i32, ptr %x, align 4 br label %continue continue: ; preds = %condition_body, %5 ret void 3: ; preds = %entry - %load_b1 = load i8, i8* %b1, align 1 + %load_b1 = load i8, ptr %b1, align 1 %4 = icmp ne i8 %load_b1, 0 br label %5 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__inlined_array_size_from_local_scoped_constants.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__inlined_array_size_from_local_scoped_constants.snap index e3328a4b8eb..0a7123ab0e3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__inlined_array_size_from_local_scoped_constants.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__inlined_array_size_from_local_scoped_constants.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,11 +14,11 @@ target triple = "[filtered]" @c = unnamed_addr constant i16 5 @aaa_instance = global %aaa { i16 3, i16 7, [5 x i8] zeroinitializer, [3 x i8] zeroinitializer } -define void @aaa(%aaa* %0) { +define void @aaa(ptr %0) { entry: - %a = getelementptr inbounds %aaa, %aaa* %0, i32 0, i32 0 - %b = getelementptr inbounds %aaa, %aaa* %0, i32 0, i32 1 - %arr = getelementptr inbounds %aaa, %aaa* %0, i32 0, i32 2 - %arr2 = getelementptr inbounds %aaa, %aaa* %0, i32 0, i32 3 + %a = getelementptr inbounds nuw %aaa, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %aaa, ptr %0, i32 0, i32 1 + %arr = getelementptr inbounds nuw %aaa, ptr %0, i32 0, i32 2 + %arr2 = getelementptr inbounds nuw %aaa, ptr %0, i32 0, i32 3 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_return.snap index 71fa9ba941d..8dd8e3706fc 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_return.snap @@ -11,18 +11,18 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: ret void } -define i16 @MyClass__testMethod(%MyClass* %0, i16 %1) { +define i16 @MyClass__testMethod(ptr %0, i16 %1) { entry: %MyClass.testMethod = alloca i16, align 2 %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 - store i16 0, i16* %MyClass.testMethod, align 2 - store i16 1, i16* %MyClass.testMethod, align 2 - %MyClass__testMethod_ret = load i16, i16* %MyClass.testMethod, align 2 + store i16 %1, ptr %myMethodArg, align 2 + store i16 0, ptr %MyClass.testMethod, align 2 + store i16 1, ptr %MyClass.testMethod, align 2 + %MyClass__testMethod_ret = load i16, ptr %MyClass.testMethod, align 2 ret i16 %MyClass__testMethod_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_void.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_void.snap index ed98c5de648..70136979bf3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_void.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_void.snap @@ -11,17 +11,17 @@ target triple = "[filtered]" @__MyClass__init = unnamed_addr constant %MyClass zeroinitializer -define void @MyClass(%MyClass* %0) { +define void @MyClass(ptr %0) { entry: ret void } -define void @MyClass__testMethod(%MyClass* %0, i16 %1) { +define void @MyClass__testMethod(ptr %0, i16 %1) { entry: %myMethodArg = alloca i16, align 2 - store i16 %1, i16* %myMethodArg, align 2 + store i16 %1, ptr %myMethodArg, align 2 %myMethodLocalVar = alloca i16, align 2 - store i16 0, i16* %myMethodLocalVar, align 2 - store i16 1, i16* %myMethodLocalVar, align 2 + store i16 0, ptr %myMethodLocalVar, align 2 + store i16 1, ptr %myMethodLocalVar, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_initialized_input.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_initialized_input.snap index cbc686079cf..e1e8e06232f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_initialized_input.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_initialized_input.snap @@ -11,31 +11,31 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb zeroinitializer -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %call = call i32 @fb__meth(%fb* %0, i32 5) - %call1 = call i32 @fb__meth(%fb* %0, i32 4) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %call = call i32 @fb__meth(ptr %0, i32 5) + %call1 = call i32 @fb__meth(ptr %0, i32 4) ret void } -define i32 @fb__meth(%fb* %0, i32 %1) { +define i32 @fb__meth(ptr %0, i32 %1) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %fb.meth = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %1, i32* %a, align 4 - store i32 0, i32* %fb.meth, align 4 - %fb__meth_ret = load i32, i32* %fb.meth, align 4 + store i32 %1, ptr %a, align 4 + store i32 0, ptr %fb.meth, align 4 + %fb__meth_ret = load i32, ptr %fb.meth, align 4 ret i32 %fb__meth_ret } define i32 @foo() { entry: %foo = alloca i32, align 4 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_multiple_input.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_multiple_input.snap index 692f2745485..4ac1032d74b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_multiple_input.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_codegen_with_multiple_input.snap @@ -11,29 +11,29 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb zeroinitializer -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %call = call i32 @fb__meth(%fb* %0, i32 1, i32 2, i32 3) - %call1 = call i32 @fb__meth(%fb* %0, i32 5, i32 7, i32 10) - %call2 = call i32 @fb__meth(%fb* %0, i32 3, i32 4, i32 10) - %call3 = call i32 @fb__meth(%fb* %0, i32 6, i32 4, i32 10) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %call = call i32 @fb__meth(ptr %0, i32 1, i32 2, i32 3) + %call1 = call i32 @fb__meth(ptr %0, i32 5, i32 7, i32 10) + %call2 = call i32 @fb__meth(ptr %0, i32 3, i32 4, i32 10) + %call3 = call i32 @fb__meth(ptr %0, i32 6, i32 4, i32 10) ret void } -define i32 @fb__meth(%fb* %0, i32 %1, i32 %2, i32 %3) { +define i32 @fb__meth(ptr %0, i32 %1, i32 %2, i32 %3) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %fb.meth = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %1, i32* %a, align 4 + store i32 %1, ptr %a, align 4 %b = alloca i32, align 4 - store i32 %2, i32* %b, align 4 + store i32 %2, ptr %b, align 4 %c = alloca i32, align 4 - store i32 %3, i32* %c, align 4 - store i32 0, i32* %fb.meth, align 4 - %fb__meth_ret = load i32, i32* %fb.meth, align 4 + store i32 %3, ptr %c, align 4 + store i32 0, ptr %fb.meth, align 4 + %fb__meth_ret = load i32, ptr %fb.meth, align 4 ret i32 %fb__meth_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_with_aggregate_return_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_with_aggregate_return_type.snap index 04caa3700ac..da9036ec995 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_with_aggregate_return_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__method_with_aggregate_return_type.snap @@ -12,49 +12,42 @@ target triple = "[filtered]" @__fb_with_method__init = unnamed_addr constant %fb_with_method zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"Hello\00" -define void @fb_with_method(%fb_with_method* %0) { +define void @fb_with_method(ptr %0) { entry: - %this = alloca %fb_with_method*, align 8 - store %fb_with_method* %0, %fb_with_method** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %ret = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %ret to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %ret, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) %__method_with_aggregagte_return0 = alloca [81 x i8], align 1 - %2 = bitcast [81 x i8]* %__method_with_aggregagte_return0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %3 = bitcast [81 x i8]* %__method_with_aggregagte_return0 to i8* - call void @fb_with_method__method_with_aggregagte_return(%fb_with_method* %0, i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0)) - %4 = bitcast [81 x i8]* %ret to i8* - %5 = bitcast [81 x i8]* %__method_with_aggregagte_return0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %4, i8* align 1 %5, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__method_with_aggregagte_return0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @fb_with_method__method_with_aggregagte_return(ptr %0, ptr %__method_with_aggregagte_return0, ptr @utf08_literal_0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %ret, ptr align 1 %__method_with_aggregagte_return0, i32 80, i1 false) ret void } -define void @fb_with_method__method_with_aggregagte_return(%fb_with_method* %0, i8* %1, i8* %2) { +define void @fb_with_method__method_with_aggregagte_return(ptr %0, ptr %1, ptr %2) { entry: - %this = alloca %fb_with_method*, align 8 - store %fb_with_method* %0, %fb_with_method** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 %ret = alloca [81 x i8], align 1 - %method_with_aggregagte_return = alloca i8*, align 8 - store i8* %1, i8** %method_with_aggregagte_return, align 8 + %method_with_aggregagte_return = alloca ptr, align 8 + store ptr %1, ptr %method_with_aggregagte_return, align 8 %in = alloca [81 x i8], align 1 - %bitcast = bitcast [81 x i8]* %in to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 81, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %2, i64 80, i1 false) - %deref = load i8*, i8** %method_with_aggregagte_return, align 8 - %3 = bitcast [81 x i8]* %in to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 %3, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %in, i8 0, i64 81, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %in, ptr align 1 %2, i64 80, i1 false) + %deref = load ptr, ptr %method_with_aggregagte_return, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 %in, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__methods_var_output.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__methods_var_output.snap index 6aec05b98db..a8e6dae6a4d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__methods_var_output.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__methods_var_output.snap @@ -12,22 +12,21 @@ target triple = "[filtered]" @__foo__init = unnamed_addr constant %foo zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } -define void @foo__baz(%foo* %0, [81 x i8]* %1) { +define void @foo__baz(ptr %0, ptr %1) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %out = alloca [81 x i8]*, align 8 - store [81 x i8]* %1, [81 x i8]** %out, align 8 - %deref = load [81 x i8]*, [81 x i8]** %out, align 8 - %2 = bitcast [81 x i8]* %deref to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %out = alloca ptr, align 8 + store ptr %1, ptr %out, align 8 + %deref = load ptr, ptr %out, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } @@ -35,25 +34,21 @@ define void @main() { entry: %s = alloca [81 x i8], align 1 %fb = alloca %foo, align 8 - %0 = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %s to i8* - call void @foo__baz(%foo* %fb, i8* %2) - %3 = bitcast [81 x i8]* %s to i8* - call void @foo__baz(%foo* %fb, i8* %3) + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + call void @foo__baz(ptr %fb, ptr %s) + call void @foo__baz(ptr %fb, ptr %s) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__min_max_real_and_lreal_values_do_not_result_in_an_under_or_overflow.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__min_max_real_and_lreal_values_do_not_result_in_an_under_or_overflow.snap index 7dd08966c8c..23de519c4ee 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__min_max_real_and_lreal_values_do_not_result_in_an_under_or_overflow.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__min_max_real_and_lreal_values_do_not_result_in_an_under_or_overflow.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @main_instance = global %main { float 0xC7EFFFFFE0000000, float 0x47EFFFFFE0000000, double 0xFFEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %F32_MIN = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %F32_MAX = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %F64_MIN = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %F64_MAX = getelementptr inbounds %main, %main* %0, i32 0, i32 3 + %F32_MIN = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %F32_MAX = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %F64_MIN = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %F64_MAX = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_access.snap index 7de21f74a66..d33b4ed8ec0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_access.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %tmpVar = getelementptr inbounds [8 x i32], [8 x i32]* %x, i32 0, i32 4 - store i32 3, i32* %tmpVar, align 4 - %tmpVar1 = getelementptr inbounds [8 x i32], [8 x i32]* %x, i32 0, i32 7 - %tmpVar2 = getelementptr inbounds [8 x i32], [8 x i32]* %x, i32 0, i32 3 - %load_tmpVar = load i32, i32* %tmpVar2, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %tmpVar = getelementptr inbounds [8 x i32], ptr %x, i32 0, i32 4 + store i32 3, ptr %tmpVar, align 4 + %tmpVar1 = getelementptr inbounds [8 x i32], ptr %x, i32 0, i32 7 + %tmpVar2 = getelementptr inbounds [8 x i32], ptr %x, i32 0, i32 3 + %load_tmpVar = load i32, ptr %tmpVar2, align 4 %tmpVar3 = add i32 %load_tmpVar, 3 - store i32 %tmpVar3, i32* %tmpVar1, align 4 + store i32 %tmpVar3, ptr %tmpVar1, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_declaration.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_declaration.snap index fde9c0c713c..ec5088d0761 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_declaration.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__multidim_array_declaration.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_access.snap index 5389c99652d..d30f0d2ce3d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_access.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,18 +11,18 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %tmpVar = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %x, i32 0, i32 2 - %tmpVar1 = getelementptr inbounds [2 x i32], [2 x i32]* %tmpVar, i32 0, i32 0 - store i32 3, i32* %tmpVar1, align 4 - %tmpVar2 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %x, i32 0, i32 3 - %tmpVar3 = getelementptr inbounds [2 x i32], [2 x i32]* %tmpVar2, i32 0, i32 1 - %tmpVar4 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %x, i32 0, i32 1 - %tmpVar5 = getelementptr inbounds [2 x i32], [2 x i32]* %tmpVar4, i32 0, i32 1 - %load_tmpVar = load i32, i32* %tmpVar5, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %tmpVar = getelementptr inbounds [4 x [2 x i32]], ptr %x, i32 0, i32 2 + %tmpVar1 = getelementptr inbounds [2 x i32], ptr %tmpVar, i32 0, i32 0 + store i32 3, ptr %tmpVar1, align 4 + %tmpVar2 = getelementptr inbounds [4 x [2 x i32]], ptr %x, i32 0, i32 3 + %tmpVar3 = getelementptr inbounds [2 x i32], ptr %tmpVar2, i32 0, i32 1 + %tmpVar4 = getelementptr inbounds [4 x [2 x i32]], ptr %x, i32 0, i32 1 + %tmpVar5 = getelementptr inbounds [2 x i32], ptr %tmpVar4, i32 0, i32 1 + %load_tmpVar = load i32, ptr %tmpVar5, align 4 %tmpVar6 = add i32 %load_tmpVar, 3 - store i32 %tmpVar6, i32* %tmpVar3, align 4 + store i32 %tmpVar6, ptr %tmpVar3, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes.snap index f250f19b24b..6deacc4ee02 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,33 +11,33 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %z = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %cube = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %cube = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %load_x = load i16, ptr %x, align 2 %1 = sext i16 %load_x to i32 %tmpVar = mul i32 25, %1 %tmpVar1 = add i32 %tmpVar, 0 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %2 = sext i16 %load_y to i32 %tmpVar2 = mul i32 5, %2 %tmpVar3 = add i32 %tmpVar2, %tmpVar1 - %load_z = load i16, i16* %z, align 2 + %load_z = load i16, ptr %z, align 2 %3 = sext i16 %load_z to i32 %tmpVar4 = mul i32 1, %3 %tmpVar5 = add i32 %tmpVar4, %tmpVar3 - %tmpVar6 = getelementptr inbounds [125 x i32], [125 x i32]* %cube, i32 0, i32 %tmpVar5 - %load_x7 = load i16, i16* %x, align 2 + %tmpVar6 = getelementptr inbounds [125 x i32], ptr %cube, i32 0, i32 %tmpVar5 + %load_x7 = load i16, ptr %x, align 2 %4 = sext i16 %load_x7 to i32 - %load_y8 = load i16, i16* %y, align 2 + %load_y8 = load i16, ptr %y, align 2 %5 = sext i16 %load_y8 to i32 %tmpVar9 = mul i32 %4, %5 - %load_z10 = load i16, i16* %z, align 2 + %load_z10 = load i16, ptr %z, align 2 %6 = sext i16 %load_z10 to i32 %tmpVar11 = mul i32 %tmpVar9, %6 - store i32 %tmpVar11, i32* %tmpVar6, align 4 + store i32 %tmpVar11, ptr %tmpVar6, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes_negative_start.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes_negative_start.snap index 63e1a12c22f..bc75e8035f6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes_negative_start.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_cube_writes_negative_start.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,36 +11,36 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %z = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %cube = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %cube = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %load_x = load i16, ptr %x, align 2 %1 = sub i16 %load_x, -2 %2 = sext i16 %1 to i32 %tmpVar = mul i32 25, %2 %tmpVar1 = add i32 %tmpVar, 0 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %3 = sub i16 %load_y, -2 %4 = sext i16 %3 to i32 %tmpVar2 = mul i32 5, %4 %tmpVar3 = add i32 %tmpVar2, %tmpVar1 - %load_z = load i16, i16* %z, align 2 + %load_z = load i16, ptr %z, align 2 %5 = sub i16 %load_z, -2 %6 = sext i16 %5 to i32 %tmpVar4 = mul i32 1, %6 %tmpVar5 = add i32 %tmpVar4, %tmpVar3 - %tmpVar6 = getelementptr inbounds [125 x i32], [125 x i32]* %cube, i32 0, i32 %tmpVar5 - %load_x7 = load i16, i16* %x, align 2 + %tmpVar6 = getelementptr inbounds [125 x i32], ptr %cube, i32 0, i32 %tmpVar5 + %load_x7 = load i16, ptr %x, align 2 %7 = sext i16 %load_x7 to i32 - %load_y8 = load i16, i16* %y, align 2 + %load_y8 = load i16, ptr %y, align 2 %8 = sext i16 %load_y8 to i32 %tmpVar9 = mul i32 %7, %8 - %load_z10 = load i16, i16* %z, align 2 + %load_z10 = load i16, ptr %z, align 2 %9 = sext i16 %load_z10 to i32 %tmpVar11 = mul i32 %tmpVar9, %9 - store i32 %tmpVar11, i32* %tmpVar6, align 4 + store i32 %tmpVar11, ptr %tmpVar6, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_declaration.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_declaration.snap index 3700b362589..72df30c4981 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_declaration.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_array_declaration.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_function_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_function_called_in_program.snap index 35adccc8a4a..42a6e01a207 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_function_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__nested_function_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,9 +14,9 @@ target triple = "[filtered]" define i32 @bar() { entry: %bar = alloca i32, align 4 - store i32 0, i32* %bar, align 4 - store i32 1, i32* %bar, align 4 - %bar_ret = load i32, i32* %bar, align 4 + store i32 0, ptr %bar, align 4 + store i32 1, ptr %bar, align 4 + %bar_ret = load i32, ptr %bar, align 4 ret i32 %bar_ret } @@ -25,18 +24,18 @@ define i32 @foo(i32 %0) { entry: %foo = alloca i32, align 4 %in = alloca i32, align 4 - store i32 %0, i32* %in, align 4 - store i32 0, i32* %foo, align 4 - store i32 1, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %in, align 4 + store i32 0, ptr %foo, align 4 + store i32 1, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call i32 @bar() %call1 = call i32 @foo(i32 %call) - store i32 %call1, i32* %x, align 4 + store i32 %call1, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__order_var_and_var_temp_block.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__order_var_and_var_temp_block.snap index 91c2859d3bf..f61c3e15738 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__order_var_and_var_temp_block.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__order_var_and_var_temp_block.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,10 +11,10 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %temp = alloca i16, align 2 - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - store i16 0, i16* %temp, align 2 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + store i16 0, ptr %temp, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pass_inout_to_inout.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pass_inout_to_inout.snap index 099458304ee..cbd40ddd881 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pass_inout_to_inout.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pass_inout_to_inout.snap @@ -1,44 +1,43 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%foo2 = type { i32*, i32 } -%foo = type { i32* } +%foo2 = type { ptr, i32 } +%foo = type { ptr } %prg = type { i32 } @foo2_instance = global %foo2 zeroinitializer @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo2(%foo2* %0) { +define void @foo2(ptr %0) { entry: - %inout = getelementptr inbounds %foo2, %foo2* %0, i32 0, i32 0 - %in = getelementptr inbounds %foo2, %foo2* %0, i32 0, i32 1 + %inout = getelementptr inbounds nuw %foo2, ptr %0, i32 0, i32 0 + %in = getelementptr inbounds nuw %foo2, ptr %0, i32 0, i32 1 ret void } -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %inout = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %deref = load i32*, i32** %inout, align 8 - store i32* %deref, i32** getelementptr inbounds (%foo2, %foo2* @foo2_instance, i32 0, i32 0), align 8 - %deref1 = load i32*, i32** %inout, align 8 - %load_inout = load i32, i32* %deref1, align 4 - store i32 %load_inout, i32* getelementptr inbounds (%foo2, %foo2* @foo2_instance, i32 0, i32 1), align 4 - call void @foo2(%foo2* @foo2_instance) + %inout = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %inout, align 8 + store ptr %deref, ptr @foo2_instance, align 8 + %deref1 = load ptr, ptr %inout, align 8 + %load_inout = load i32, ptr %deref1, align 4 + store i32 %load_inout, ptr getelementptr inbounds nuw (%foo2, ptr @foo2_instance, i32 0, i32 1), align 4 + call void @foo2(ptr @foo2_instance) ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %baz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32* %baz, i32** getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 8 - call void @foo(%foo* @foo_instance) + %baz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store ptr %baz, ptr @foo_instance, align 8 + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointer_and_array_access_to_in_out.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointer_and_array_access_to_in_out.snap index b2cce2ddcd0..76fa52ba486 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointer_and_array_access_to_in_out.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointer_and_array_access_to_in_out.snap @@ -1,31 +1,30 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i16 @main(i16** %0, i16* %1) { +define i16 @main(ptr %0, ptr %1) { entry: %main = alloca i16, align 2 - %a = alloca i16**, align 8 - store i16** %0, i16*** %a, align 8 - %b = alloca i16*, align 8 - store i16* %1, i16** %b, align 8 + %a = alloca ptr, align 8 + store ptr %0, ptr %a, align 8 + %b = alloca ptr, align 8 + store ptr %1, ptr %b, align 8 %c = alloca i16, align 2 - store i16 0, i16* %c, align 2 - store i16 0, i16* %main, align 2 - %deref = load i16**, i16*** %a, align 8 - %deref1 = load i16*, i16** %deref, align 8 - %load_tmpVar = load i16, i16* %deref1, align 2 - store i16 %load_tmpVar, i16* %c, align 2 - %deref2 = load i16*, i16** %b, align 8 - %tmpVar = getelementptr inbounds i16, i16* %deref2, i32 0 - %load_tmpVar3 = load i16, i16* %tmpVar, align 2 - store i16 %load_tmpVar3, i16* %c, align 2 - %main_ret = load i16, i16* %main, align 2 + store i16 0, ptr %c, align 2 + store i16 0, ptr %main, align 2 + %deref = load ptr, ptr %a, align 8 + %deref1 = load ptr, ptr %deref, align 8 + %load_tmpVar = load i16, ptr %deref1, align 2 + store i16 %load_tmpVar, ptr %c, align 2 + %deref2 = load ptr, ptr %b, align 8 + %tmpVar = getelementptr inbounds [2 x i16], ptr %deref2, i32 0, i32 0 + %load_tmpVar3 = load i16, ptr %tmpVar, align 2 + store i16 %load_tmpVar3, ptr %c, align 2 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointers_generated.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointers_generated.snap index c34eb17bb60..314cc3ec3cd 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointers_generated.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__pointers_generated.snap @@ -1,37 +1,36 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prg = type { i8, i8*, i8* } +%prg = type { i8, ptr, ptr } @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %X = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %pX = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %rX = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - store i8* null, i8** %pX, align 8 - store i8* null, i8** %rX, align 8 - store i8* %X, i8** %pX, align 8 - store i8* %X, i8** %rX, align 8 - %deref = load i8*, i8** %pX, align 8 - %load_tmpVar = load i8, i8* %deref, align 1 - store i8 %load_tmpVar, i8* %X, align 1 - %deref1 = load i8*, i8** %rX, align 8 - %load_tmpVar2 = load i8, i8* %deref1, align 1 - store i8 %load_tmpVar2, i8* %X, align 1 - %deref3 = load i8*, i8** %pX, align 8 - %load_X = load i8, i8* %X, align 1 - store i8 %load_X, i8* %deref3, align 1 - %deref4 = load i8*, i8** %rX, align 8 - %load_X5 = load i8, i8* %X, align 1 - store i8 %load_X5, i8* %deref4, align 1 + %X = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %pX = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %rX = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + store ptr null, ptr %pX, align 8 + store ptr null, ptr %rX, align 8 + store ptr %X, ptr %pX, align 8 + store ptr %X, ptr %rX, align 8 + %deref = load ptr, ptr %pX, align 8 + %load_tmpVar = load i8, ptr %deref, align 1 + store i8 %load_tmpVar, ptr %X, align 1 + %deref1 = load ptr, ptr %rX, align 8 + %load_tmpVar2 = load i8, ptr %deref1, align 1 + store i8 %load_tmpVar2, ptr %X, align 1 + %deref3 = load ptr, ptr %pX, align 8 + %load_X = load i8, ptr %X, align 1 + store i8 %load_X, ptr %deref3, align 1 + %deref4 = load ptr, ptr %rX, align 8 + %load_X5 = load i8, ptr %X, align 1 + store i8 %load_X5, ptr %deref4, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_called_in_program.snap index 13026672f1b..69970eaf146 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,13 +13,13 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - call void @foo(%foo* @foo_instance) + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_and_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_and_statement.snap index 63e46e7312f..12bd5b2dda0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_and_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_and_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i8, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x, 0 br i1 %1, label %2, label %4 2: ; preds = %entry - %load_y = load i8, i8* %y, align 1 + %load_y = load i8, ptr %y, align 1 %3 = icmp ne i8 %load_y, 0 br label %4 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_bool_variables_and_references_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_bool_variables_and_references_generates_void_function_and_struct_and_body.snap index 6ce4e9dbbcb..78f680fc396 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_bool_variables_and_references_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_bool_variables_and_references_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i8, i8* %x, align 1 - %load_y = load i8, i8* %y, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i8, ptr %x, align 1 + %load_y = load i8, ptr %y, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_boolean_assignment_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_boolean_assignment_generates_void_function_and_struct_and_body.snap index 3a4df173975..a76012c128c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_boolean_assignment_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_boolean_assignment_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,10 +11,10 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i8 1, i8* %y, align 1 - store i8 0, i8* %y, align 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i8 1, ptr %y, align 1 + store i8 0, ptr %y, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_casted_chars_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_casted_chars_assignment.snap index 04ab9a30cef..31ead9fcf99 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_casted_chars_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_casted_chars_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,11 +13,11 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"B\00" @utf16_literal_0 = private unnamed_addr constant [2 x i16] [i16 65, i16 0] -define void @mainPROG(%mainPROG* %0) { +define void @mainPROG(ptr %0) { entry: - %x = getelementptr inbounds %mainPROG, %mainPROG* %0, i32 0, i32 0 - %y = getelementptr inbounds %mainPROG, %mainPROG* %0, i32 0, i32 1 - store i8 65, i8* %x, align 1 - store i16 66, i16* %y, align 2 + %x = getelementptr inbounds nuw %mainPROG, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %mainPROG, ptr %0, i32 0, i32 1 + store i8 65, ptr %x, align 1 + store i16 66, ptr %y, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_chars.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_chars.snap index 9f69a89967f..8da29e98fbe 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_chars.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_chars.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,15 +17,15 @@ target triple = "[filtered]" @utf16_literal_2 = private unnamed_addr constant [2 x i16] [i16 39, i16 0] @utf16_literal_3 = private unnamed_addr constant [2 x i16] [i16 65, i16 0] -define void @mainPROG(%mainPROG* %0) { +define void @mainPROG(ptr %0) { entry: - %x = getelementptr inbounds %mainPROG, %mainPROG* %0, i32 0, i32 0 - %y = getelementptr inbounds %mainPROG, %mainPROG* %0, i32 0, i32 1 - store i8 97, i8* %x, align 1 - store i8 32, i8* %x, align 1 - store i16 65, i16* %y, align 2 - store i16 32, i16* %y, align 2 - store i16 39, i16* %y, align 2 - store i16 34, i16* %y, align 2 + %x = getelementptr inbounds nuw %mainPROG, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %mainPROG, ptr %0, i32 0, i32 1 + store i8 97, ptr %x, align 1 + store i8 32, ptr %x, align 1 + store i16 65, ptr %y, align 2 + store i16 32, ptr %y, align 2 + store i16 39, ptr %y, align 2 + store i16 34, ptr %y, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment.snap index 4bfac75e8bb..b8dd9a05af3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,23 +11,23 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %w = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - store i64 56190123000000, i64* %w, align 8 - store i64 56190123000000, i64* %w, align 8 - store i64 100012000000, i64* %x, align 8 - store i64 100012000000, i64* %x, align 8 - store i64 465436800000000000, i64* %y, align 8 - store i64 0, i64* %y, align 8 - store i64 465509714000000000, i64* %z, align 8 - store i64 58804123000000, i64* %z, align 8 - store i64 58804123456789, i64* %z, align 8 - store i64 946757700000000000, i64* %z, align 8 - store i64 946757700000000000, i64* %z, align 8 - store i64 946757708123000000, i64* %z, align 8 + %w = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + store i64 56190123000000, ptr %w, align 8 + store i64 56190123000000, ptr %w, align 8 + store i64 100012000000, ptr %x, align 8 + store i64 100012000000, ptr %x, align 8 + store i64 465436800000000000, ptr %y, align 8 + store i64 0, ptr %y, align 8 + store i64 465509714000000000, ptr %z, align 8 + store i64 58804123000000, ptr %z, align 8 + store i64 58804123456789, ptr %z, align 8 + store i64 946757700000000000, ptr %z, align 8 + store i64 946757700000000000, ptr %z, align 8 + store i64 946757708123000000, ptr %z, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment_whit_short_datatype_names.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment_whit_short_datatype_names.snap index 98c6860b9e3..ba84bffed8c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment_whit_short_datatype_names.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_date_assignment_whit_short_datatype_names.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,20 +11,20 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %w = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - store i64 56190123000000, i64* %w, align 8 - store i64 56190123000000, i64* %w, align 8 - store i64 100012000000, i64* %x, align 8 - store i64 100012000000, i64* %x, align 8 - store i64 465436800000000000, i64* %y, align 8 - store i64 0, i64* %y, align 8 - store i64 465509700000000000, i64* %z, align 8 - store i64 58808123000000, i64* %z, align 8 - store i64 58804123456789, i64* %z, align 8 + %w = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + store i64 56190123000000, ptr %w, align 8 + store i64 56190123000000, ptr %w, align 8 + store i64 100012000000, ptr %x, align 8 + store i64 100012000000, ptr %x, align 8 + store i64 465436800000000000, ptr %y, align 8 + store i64 0, ptr %y, align 8 + store i64 465509700000000000, ptr %z, align 8 + store i64 58808123000000, ptr %z, align 8 + store i64 58804123456789, ptr %z, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_floats_variable_and_comparison_assignment_generates_correctly.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_floats_variable_and_comparison_assignment_generates_correctly.snap index def45d32d06..bc1b8765be5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_floats_variable_and_comparison_assignment_generates_correctly.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_floats_variable_and_comparison_assignment_generates_correctly.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,33 +11,33 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load float, float* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load float, ptr %x, align 4 %tmpVar = fcmp oeq float %load_x, 1.000000e+00 %1 = zext i1 %tmpVar to i8 - store i8 %1, i8* %y, align 1 - %load_x1 = load float, float* %x, align 4 + store i8 %1, ptr %y, align 1 + %load_x1 = load float, ptr %x, align 4 %tmpVar2 = fcmp ogt float %load_x1, 2.000000e+00 %2 = zext i1 %tmpVar2 to i8 - store i8 %2, i8* %y, align 1 - %load_x3 = load float, float* %x, align 4 + store i8 %2, ptr %y, align 1 + %load_x3 = load float, ptr %x, align 4 %tmpVar4 = fcmp olt float %load_x3, 3.000000e+00 %3 = zext i1 %tmpVar4 to i8 - store i8 %3, i8* %y, align 1 - %load_x5 = load float, float* %x, align 4 + store i8 %3, ptr %y, align 1 + %load_x5 = load float, ptr %x, align 4 %tmpVar6 = fcmp one float %load_x5, 4.000000e+00 %4 = zext i1 %tmpVar6 to i8 - store i8 %4, i8* %y, align 1 - %load_x7 = load float, float* %x, align 4 + store i8 %4, ptr %y, align 1 + %load_x7 = load float, ptr %x, align 4 %tmpVar8 = fcmp oge float %load_x7, 5.000000e+00 %5 = zext i1 %tmpVar8 to i8 - store i8 %5, i8* %y, align 1 - %load_x9 = load float, float* %x, align 4 + store i8 %5, ptr %y, align 1 + %load_x9 = load float, ptr %x, align 4 %tmpVar10 = fcmp ole float %load_x9, 6.000000e+00 %6 = zext i1 %tmpVar10 to i8 - store i8 %6, i8* %y, align 1 + store i8 %6, ptr %y, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_local_temp_var_initialization.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_local_temp_var_initialization.snap index f544c8a8882..ec14f4268bf 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_local_temp_var_initialization.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_local_temp_var_initialization.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,23 +13,23 @@ target triple = "[filtered]" @foo_instance = global %foo { i16 7 } @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %y = alloca i16, align 2 %z = alloca i16, align 2 - store i16 0, i16* %y, align 2 - store i16 9, i16* %z, align 2 - %load_z = load i16, i16* %z, align 2 + store i16 0, ptr %y, align 2 + store i16 9, ptr %z, align 2 + %load_z = load i16, ptr %z, align 2 %1 = sext i16 %load_z to i32 %tmpVar = add i32 %1, 1 %2 = trunc i32 %tmpVar to i16 - store i16 %2, i16* %y, align 2 + store i16 %2, ptr %y, align 2 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - call void @foo(%foo* @foo_instance) + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_long_date_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_long_date_assignment.snap index f2fcbf7e1f7..05e17398d60 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_long_date_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_long_date_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,19 +11,19 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %w = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - store i64 100012006003, i64* %w, align 8 - store i64 100012006003, i64* %w, align 8 - store i64 465436800000000000, i64* %x, align 8 - store i64 0, i64* %x, align 8 - store i64 465509714000000000, i64* %y, align 8 - store i64 58804123456789, i64* %y, align 8 - store i64 56190999999999, i64* %z, align 8 - store i64 56190123456000, i64* %z, align 8 + %w = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + store i64 100012006003, ptr %w, align 8 + store i64 100012006003, ptr %w, align 8 + store i64 465436800000000000, ptr %x, align 8 + store i64 0, ptr %x, align 8 + store i64 465509714000000000, ptr %y, align 8 + store i64 58804123456789, ptr %y, align 8 + store i64 56190999999999, ptr %z, align 8 + store i64 56190123456000, ptr %z, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_combined_expressions_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_combined_expressions_generates_void_function_and_struct_and_body.snap index a9a5d11a9e4..9be3c16b314 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_combined_expressions_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_combined_expressions_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,28 +11,28 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_y = load i8, i8* %y, align 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_y = load i8, ptr %y, align 1 %1 = icmp ne i8 %load_y, 0 br i1 %1, label %2, label %3 2: ; preds = %entry - %load_z = load i32, i32* %z, align 4 + %load_z = load i32, ptr %z, align 4 %tmpVar = icmp sge i32 %load_z, 5 br label %3 3: ; preds = %2, %entry %4 = phi i1 [ %1, %entry ], [ %tmpVar, %2 ] - %load_z1 = load i32, i32* %z, align 4 + %load_z1 = load i32, ptr %z, align 4 %tmpVar2 = icmp sle i32 %load_z1, 6 %tmpVar3 = xor i1 %tmpVar2, true br i1 %tmpVar3, label %7, label %5 5: ; preds = %3 - %load_y4 = load i8, i8* %y, align 1 + %load_y4 = load i8, ptr %y, align 1 %6 = icmp ne i8 %load_y4, 0 br label %7 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_expressions_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_expressions_generates_void_function_and_struct_and_body.snap index 6a541e8e96d..1a39b4d172f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_expressions_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_negated_expressions_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,19 +11,19 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i8, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x, 0 %tmpVar = xor i1 %1, true - %load_x1 = load i8, i8* %x, align 1 + %load_x1 = load i8, ptr %x, align 1 %2 = icmp ne i8 %load_x1, 0 br i1 %2, label %3, label %5 3: ; preds = %entry - %load_y = load i8, i8* %y, align 1 + %load_y = load i8, ptr %y, align 1 %4 = icmp ne i8 %load_y, 0 %tmpVar2 = xor i1 %4, true br label %5 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_or_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_or_statement.snap index 014e146ab7a..a7a7938d667 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_or_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_or_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i8, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x, 0 br i1 %1, label %4, label %2 2: ; preds = %entry - %load_y = load i8, i8* %y, align 1 + %load_y = load i8, ptr %y, align 1 %3 = icmp ne i8 %load_y, 0 br label %4 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_additions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_additions.snap index c40b5c61aab..f2f52747f04 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_additions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_additions.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - store float 1.237500e+01, float* %x, align 4 - store float 2.500000e-01, float* %y, align 4 - %load_x = load float, float* %x, align 4 - %load_y = load float, float* %y, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + store float 1.237500e+01, ptr %x, align 4 + store float 2.500000e-01, ptr %y, align 4 + %load_x = load float, ptr %x, align 4 + %load_y = load float, ptr %y, align 4 %tmpVar = fadd float %load_x, %load_y - store float %tmpVar, float* %z, align 4 + store float %tmpVar, ptr %z, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_assignment.snap index 5591466b756..6eaa68b463e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store float 1.562500e-01, float* %y, align 4 - store float 1.000000e+02, float* %y, align 4 - store float 1.000000e+03, float* %y, align 4 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store float 1.562500e-01, ptr %y, align 4 + store float 1.000000e+02, ptr %y, align 4 + store float 1.000000e+03, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_cast_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_cast_assignment.snap index 793006bdf45..4e11603f674 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_cast_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_real_cast_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = sitofp i16 %load_x to float - store float %1, float* %y, align 4 + store float %1, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_signed_combined_expressions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_signed_combined_expressions.snap index 0f1ac9daf0c..e6ef03cf3f2 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_signed_combined_expressions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_signed_combined_expressions.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_z = load i32, i32* %z, align 4 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_z = load i32, ptr %z, align 4 %tmpVar = add i32 -1, %load_z - %load_z1 = load i32, i32* %z, align 4 + %load_z1 = load i32, ptr %z, align 4 %tmpVar2 = sub i32 0, %load_z1 %tmpVar3 = add i32 2, %tmpVar2 - %load_y = load i32, i32* %y, align 4 + %load_y = load i32, ptr %y, align 4 %tmpVar4 = sub i32 0, %load_y %tmpVar5 = add i32 %tmpVar4, 3 ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_special_chars_in_string.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_special_chars_in_string.snap index 62fb521e51e..f8e0a6ef9ec 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_special_chars_in_string.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_special_chars_in_string.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,24 +15,20 @@ target triple = "[filtered]" @utf16_literal_0 = private unnamed_addr constant [19 x i16] [i16 36, i16 52, i16 51, i16 32, i16 36, i16 39, i16 110, i16 111, i16 32, i16 114, i16 101, i16 112, i16 108, i16 97, i16 99, i16 101, i16 36, i16 39, i16 0] @utf16_literal_1 = private unnamed_addr constant [41 x i16] [i16 97, i16 10, i16 10, i16 32, i16 98, i16 10, i16 10, i16 32, i16 99, i16 12, i16 12, i16 32, i16 100, i16 13, i16 13, i16 32, i16 101, i16 9, i16 9, i16 32, i16 36, i16 32, i16 34, i16 100, i16 111, i16 117, i16 98, i16 108, i16 101, i16 34, i16 32, i16 87, i16 -10179, i16 -9066, i16 -10179, i16 -9066, i16 0, i16 0, i16 0, i16 0, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %should_replace_s = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %should_not_replace_s = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %should_replace_ws = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %should_not_replace_ws = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %1 = bitcast [81 x i8]* %should_replace_s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([41 x i8], [41 x i8]* @utf08_literal_1, i32 0, i32 0), i32 41, i1 false) - %2 = bitcast [81 x i8]* %should_not_replace_s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([19 x i8], [19 x i8]* @utf08_literal_0, i32 0, i32 0), i32 19, i1 false) - %3 = bitcast [81 x i16]* %should_replace_ws to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %3, i8* align 2 bitcast ([41 x i16]* @utf16_literal_1 to i8*), i32 82, i1 false) - %4 = bitcast [81 x i16]* %should_not_replace_ws to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %4, i8* align 2 bitcast ([19 x i16]* @utf16_literal_0 to i8*), i32 38, i1 false) + %should_replace_s = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %should_not_replace_s = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %should_replace_ws = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %should_not_replace_ws = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %should_replace_s, ptr align 1 @utf08_literal_1, i32 41, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %should_not_replace_s, ptr align 1 @utf08_literal_0, i32 19, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %should_replace_ws, ptr align 2 @utf16_literal_1, i32 82, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %should_not_replace_ws, ptr align 2 @utf16_literal_0, i32 38, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_string_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_string_assignment.snap index 65c413ffe7e..4d03d075357 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_string_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_string_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,18 +13,16 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [12 x i8] c"im a genius\00" @utf16_literal_0 = private unnamed_addr constant [18 x i16] [i16 105, i16 109, i16 32, i16 97, i16 32, i16 117, i16 116, i16 102, i16 49, i16 54, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([12 x i8], [12 x i8]* @utf08_literal_0, i32 0, i32 0), i32 12, i1 false) - %2 = bitcast [81 x i16]* %z to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([18 x i16]* @utf16_literal_0 to i8*), i32 36, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 @utf08_literal_0, i32 12, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %z, ptr align 2 @utf16_literal_0, i32 36, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_assignment.snap index 985138e91d5..e3234956439 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,17 +11,17 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i64 0, i64* %y, align 8 - store i64 43200000000000, i64* %y, align 8 - store i64 100000000, i64* %y, align 8 - store i64 100000000, i64* %y, align 8 - store i64 1000000, i64* %y, align 8 - store i64 -1000, i64* %y, align 8 - store i64 1, i64* %y, align 8 - store i64 -86400001000000, i64* %y, align 8 - store i64 8640000001000000, i64* %y, align 8 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i64 0, ptr %y, align 8 + store i64 43200000000000, ptr %y, align 8 + store i64 100000000, ptr %y, align 8 + store i64 100000000, ptr %y, align 8 + store i64 1000000, ptr %y, align 8 + store i64 -1000, ptr %y, align 8 + store i64 1, ptr %y, align 8 + store i64 -86400001000000, ptr %y, align 8 + store i64 8640000001000000, ptr %y, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_of_day_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_of_day_assignment.snap index 3b832ddc391..054f4f69884 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_of_day_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_time_of_day_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i64 0, i64* %y, align 8 - store i64 3600000000000, i64* %y, align 8 - store i64 3600001000000, i64* %y, align 8 - store i64 3661000000000, i64* %y, align 8 - store i64 72900000000000, i64* %y, align 8 - store i64 72900000000000, i64* %y, align 8 - store i64 40260000000000, i64* %y, align 8 - store i64 40260000000000, i64* %y, align 8 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i64 0, ptr %y, align 8 + store i64 3600000000000, ptr %y, align 8 + store i64 3600001000000, ptr %y, align 8 + store i64 3661000000000, ptr %y, align 8 + store i64 72900000000000, ptr %y, align 8 + store i64 72900000000000, ptr %y, align 8 + store i64 40260000000000, ptr %y, align 8 + store i64 40260000000000, ptr %y, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_explicit_parameters_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_explicit_parameters_called_in_program.snap index 5a4ff5bc649..1a5528a694b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_explicit_parameters_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_explicit_parameters_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,17 +13,17 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %buz = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %buz = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - store i8 1, i8* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 1), align 1 - store i32 2, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 4 - call void @foo(%foo* @foo_instance) + store i8 1, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 1), align 1 + store i32 2, ptr @foo_instance, align 4 + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_parameters_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_parameters_called_in_program.snap index 87014b1019a..1d7f9fe8772 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_parameters_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_two_parameters_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,17 +13,17 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %buz = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %buz = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - store i32 2, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 4 - store i8 1, i8* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 1), align 1 - call void @foo(%foo* @foo_instance) + store i32 2, ptr @foo_instance, align 4 + store i8 1, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 1), align 1 + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_inout_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_inout_called_in_program.snap index 13ec1ddeea2..d404f8ad56f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_inout_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_inout_called_in_program.snap @@ -1,35 +1,34 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%foo = type { i32* } +%foo = type { ptr } %prg = type { i32 } @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %inout = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %deref = load i32*, i32** %inout, align 8 - %deref1 = load i32*, i32** %inout, align 8 - %load_inout = load i32, i32* %deref1, align 4 + %inout = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %deref = load ptr, ptr %inout, align 8 + %deref1 = load ptr, ptr %inout, align 8 + %load_inout = load i32, ptr %deref1, align 4 %tmpVar = add i32 %load_inout, 1 - store i32 %tmpVar, i32* %deref, align 4 + store i32 %tmpVar, ptr %deref, align 4 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %baz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 7, i32* %baz, align 4 - store i32* %baz, i32** getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 8 - call void @foo(%foo* @foo_instance) + %baz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 7, ptr %baz, align 4 + store ptr %baz, ptr @foo_instance, align 8 + call void @foo(ptr @foo_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_in_program.snap index c297d79ecd5..24ac0795dc4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,19 +13,19 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %buz = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %buz = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %baz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 2, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 4 - call void @foo(%foo* @foo_instance) - %1 = load i8, i8* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 1), align 1 - store i8 %1, i8* %baz, align 1 + %baz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 2, ptr @foo_instance, align 4 + call void @foo(ptr @foo_instance) + %1 = load i8, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 1), align 1 + store i8 %1, ptr %baz, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_mixed_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_mixed_in_program.snap index c297d79ecd5..24ac0795dc4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_mixed_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_var_out_called_mixed_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,19 +13,19 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %bar = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %buz = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %bar = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %buz = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %baz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 2, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 4 - call void @foo(%foo* @foo_instance) - %1 = load i8, i8* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 1), align 1 - store i8 %1, i8* %baz, align 1 + %baz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 2, ptr @foo_instance, align 4 + call void @foo(ptr @foo_instance) + %1 = load i8, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 1), align 1 + store i8 %1, ptr %baz, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_addition_literal_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_addition_literal_generates_void_function_and_struct_and_body.snap index 2bc0788d257..d4c2150afe5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_addition_literal_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_addition_literal_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,10 +11,10 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 7 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_arithmatic_assignment_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_arithmatic_assignment_generates_void_function_and_struct_and_body.snap index 578c4abbad0..0d47dfae223 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_arithmatic_assignment_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_arithmatic_assignment_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,24 +11,24 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 1 - store i32 %tmpVar, i32* %y, align 4 - %load_x1 = load i32, i32* %x, align 4 + store i32 %tmpVar, ptr %y, align 4 + %load_x1 = load i32, ptr %x, align 4 %tmpVar2 = sub i32 %load_x1, 2 - store i32 %tmpVar2, i32* %y, align 4 - %load_x3 = load i32, i32* %x, align 4 + store i32 %tmpVar2, ptr %y, align 4 + %load_x3 = load i32, ptr %x, align 4 %tmpVar4 = mul i32 %load_x3, 3 - store i32 %tmpVar4, i32* %y, align 4 - %load_x5 = load i32, i32* %x, align 4 + store i32 %tmpVar4, ptr %y, align 4 + %load_x5 = load i32, ptr %x, align 4 %tmpVar6 = sdiv i32 %load_x5, 4 - store i32 %tmpVar6, i32* %y, align 4 - %load_x7 = load i32, i32* %x, align 4 + store i32 %tmpVar6, ptr %y, align 4 + %load_x7 = load i32, ptr %x, align 4 %tmpVar8 = srem i32 %load_x7, 5 - store i32 %tmpVar8, i32* %y, align 4 + store i32 %tmpVar8, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_comparison_assignment_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_comparison_assignment_generates_void_function_and_struct_and_body.snap index 1a76e97c33e..fcfe62c2599 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_comparison_assignment_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_and_comparison_assignment_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,33 +11,33 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 %tmpVar = icmp eq i32 %load_x, 1 %1 = zext i1 %tmpVar to i8 - store i8 %1, i8* %y, align 1 - %load_x1 = load i32, i32* %x, align 4 + store i8 %1, ptr %y, align 1 + %load_x1 = load i32, ptr %x, align 4 %tmpVar2 = icmp sgt i32 %load_x1, 2 %2 = zext i1 %tmpVar2 to i8 - store i8 %2, i8* %y, align 1 - %load_x3 = load i32, i32* %x, align 4 + store i8 %2, ptr %y, align 1 + %load_x3 = load i32, ptr %x, align 4 %tmpVar4 = icmp slt i32 %load_x3, 3 %3 = zext i1 %tmpVar4 to i8 - store i8 %3, i8* %y, align 1 - %load_x5 = load i32, i32* %x, align 4 + store i8 %3, ptr %y, align 1 + %load_x5 = load i32, ptr %x, align 4 %tmpVar6 = icmp ne i32 %load_x5, 4 %4 = zext i1 %tmpVar6 to i8 - store i8 %4, i8* %y, align 1 - %load_x7 = load i32, i32* %x, align 4 + store i8 %4, ptr %y, align 1 + %load_x7 = load i32, ptr %x, align 4 %tmpVar8 = icmp sge i32 %load_x7, 5 %5 = zext i1 %tmpVar8 to i8 - store i8 %5, i8* %y, align 1 - %load_x9 = load i32, i32* %x, align 4 + store i8 %5, ptr %y, align 1 + %load_x9 = load i32, ptr %x, align 4 %tmpVar10 = icmp sle i32 %load_x9, 6 %6 = zext i1 %tmpVar10 to i8 - store i8 %6, i8* %y, align 1 + store i8 %6, ptr %y, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_assignment_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_assignment_generates_void_function_and_struct_and_body.snap index 6a424f10d49..59c23721730 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_assignment_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variable_assignment_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,9 +11,9 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 7, i32* %y, align 4 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 7, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_additions_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_additions_generates_void_function_and_struct_and_body.snap index 699e99e7f52..8651e460681 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_additions_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_additions_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 - %load_y = load i32, i32* %y, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 + %load_y = load i32, ptr %y, align 4 %tmpVar = add i32 %load_x, %load_y ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_references_generates_void_function_and_struct_and_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_references_generates_void_function_and_struct_and_body.snap index c581c13ce15..8595d140303 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_references_generates_void_function_and_struct_and_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_and_references_generates_void_function_and_struct_and_body.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 - %load_y = load i32, i32* %y, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 + %load_y = load i32, ptr %y, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_generates_void_function_and_struct.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_generates_void_function_and_struct.snap index aa77ac371ae..b2e6cd30375 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_generates_void_function_and_struct.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_variables_generates_void_function_and_struct.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,9 +11,9 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_xor_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_xor_statement.snap index bb6472a7d36..8f0f9ad1f57 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_xor_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__program_with_xor_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,17 +11,17 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_x = load i8, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_x = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x, 0 - %load_y = load i8, i8* %y, align 1 + %load_y = load i8, ptr %y, align 1 %2 = icmp ne i8 %load_y, 0 %3 = xor i1 %1, %2 %4 = zext i1 %3 to i8 - store i8 %4, i8* %z, align 1 + store i8 %4, ptr %z, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_action_from_fb_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_action_from_fb_called_in_program.snap index dba4041c475..6ca051913ab 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_action_from_fb_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_action_from_fb_called_in_program.snap @@ -13,26 +13,26 @@ target triple = "[filtered]" @bar_instance = global %bar zeroinitializer @__fb__init = unnamed_addr constant %fb zeroinitializer -define void @bar(%bar* %0) { +define void @bar(ptr %0) { entry: - %fb_inst = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - call void @fb__foo(%fb* %fb_inst) + %fb_inst = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + call void @fb__foo(ptr %fb_inst) ret void } -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } -define void @fb__foo(%fb* %0) { +define void @fb__foo(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 - store i32 2, i32* %x, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 + store i32 2, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_foreign_action_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_foreign_action_called_in_program.snap index 7a8417bc545..4ca6976a4c5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_foreign_action_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_foreign_action_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,21 +13,21 @@ target triple = "[filtered]" @bar_instance = global %bar zeroinitializer @prg_instance = global %prg zeroinitializer -define void @bar(%bar* %0) { +define void @bar(ptr %0) { entry: - call void @prg__foo(%prg* @prg_instance) + call void @prg__foo(ptr @prg_instance) ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } -define void @prg__foo(%prg* %0) { +define void @prg__foo(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 2, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 2, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_local_action_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_local_action_called_in_program.snap index fd348dbeca4..bba2ca86a72 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_local_action_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__qualified_local_action_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - call void @prg__foo(%prg* @prg_instance) + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + call void @prg__foo(ptr @prg_instance) ret void } -define void @prg__foo(%prg* %0) { +define void @prg__foo(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 2, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 2, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__real_function_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__real_function_called_in_program.snap index d037f5d808d..c7e77d41472 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__real_function_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__real_function_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,17 +14,17 @@ target triple = "[filtered]" define float @foo() { entry: %foo = alloca float, align 4 - store float 0.000000e+00, float* %foo, align 4 - store float 1.000000e+00, float* %foo, align 4 - %foo_ret = load float, float* %foo, align 4 + store float 0.000000e+00, ptr %foo, align 4 + store float 1.000000e+00, ptr %foo, align 4 + %foo_ret = load float, ptr %foo, align 4 ret float %foo_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %call = call float @foo() %1 = fptosi float %call to i32 - store i32 %1, i32* %x, align 4 + store i32 %1, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_qualified_name.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_qualified_name.snap index 9e0745f30ae..150933348d0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_qualified_name.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_qualified_name.snap @@ -15,30 +15,30 @@ target triple = "[filtered]" @foo_instance = global %foo zeroinitializer @prg_instance = global %prg zeroinitializer -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } -define void @foo(%foo* %0) { +define void @foo(ptr %0) { entry: - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %baz = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %baz = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 ret void } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %load_x = load i32, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 0), align 4 - store i32 %load_x, i32* %x, align 4 - %load_y = load i32, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 1), align 4 - store i32 %load_y, i32* %x, align 4 - %load_x1 = load i32, i32* getelementptr inbounds (%foo, %foo* @foo_instance, i32 0, i32 2, i32 0), align 4 - store i32 %load_x1, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr @foo_instance, align 4 + store i32 %load_x, ptr %x, align 4 + %load_y = load i32, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 1), align 4 + store i32 %load_y, ptr %x, align 4 + %load_x1 = load i32, ptr getelementptr inbounds nuw (%foo, ptr @foo_instance, i32 0, i32 2), align 4 + store i32 %load_x1, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_to_reference_assignments_in_function_arguments.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_to_reference_assignments_in_function_arguments.snap index 5479ae3fafd..ed7f0d03256 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_to_reference_assignments_in_function_arguments.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__reference_to_reference_assignments_in_function_arguments.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -9,7 +8,7 @@ target datalayout = "[filtered]" target triple = "[filtered]" %STRUCT_params = type { i8, i8, i8 } -%prog = type { %STRUCT_params*, %STRUCT_params* } +%prog = type { ptr, ptr } %main = type {} @global1 = global %STRUCT_params zeroinitializer @@ -22,20 +21,20 @@ target triple = "[filtered]" @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %input2 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %input2 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - store %STRUCT_params* @global1, %STRUCT_params** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 8 - store %STRUCT_params* @global2, %STRUCT_params** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 8 - call void @prog(%prog* @prog_instance) - store %STRUCT_params* bitcast (i32* @global4 to %STRUCT_params*), %STRUCT_params** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 8 - store %STRUCT_params* bitcast ([81 x i8]* @global5 to %STRUCT_params*), %STRUCT_params** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 8 - call void @prog(%prog* @prog_instance) + store ptr @global1, ptr @prog_instance, align 8 + store ptr @global2, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 8 + call void @prog(ptr @prog_instance) + store ptr @global4, ptr @prog_instance, align 8 + store ptr @global5, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 8 + call void @prog(ptr @prog_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__repeat_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__repeat_statement.snap index d2fe88fc4b9..f3368246994 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__repeat_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__repeat_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,17 +11,17 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 br label %condition_check condition_check: ; preds = %entry, %continue1 br i1 true, label %while_body, label %continue while_body: ; preds = %condition_check - %load_x = load i8, i8* %x, align 1 - %load_x2 = load i8, i8* %x, align 1 + %load_x = load i8, ptr %x, align 1 + %load_x2 = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x2, 0 br i1 %1, label %condition_body, label %continue1 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function.snap index 96a323b1f3b..72f820d478b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,9 +11,9 @@ define i16 @smaller_than_ten(i8 %0) { entry: %smaller_than_ten = alloca i16, align 2 %n = alloca i8, align 1 - store i8 %0, i8* %n, align 1 - store i16 0, i16* %smaller_than_ten, align 2 - %load_n = load i8, i8* %n, align 1 + store i8 %0, ptr %n, align 1 + store i16 0, ptr %smaller_than_ten, align 2 + %load_n = load i8, ptr %n, align 1 %1 = sext i8 %load_n to i32 %tmpVar = icmp slt i32 %1, 10 %2 = zext i1 %tmpVar to i8 @@ -22,13 +21,13 @@ entry: br i1 %3, label %condition_body, label %continue condition_body: ; preds = %entry - %smaller_than_ten_ret = load i16, i16* %smaller_than_ten, align 2 + %smaller_than_ten_ret = load i16, ptr %smaller_than_ten, align 2 ret i16 %smaller_than_ten_ret buffer_block: ; No predecessors! br label %continue continue: ; preds = %buffer_block, %entry - %smaller_than_ten_ret1 = load i16, i16* %smaller_than_ten, align 2 + %smaller_than_ten_ret1 = load i16, ptr %smaller_than_ten, align 2 ret i16 %smaller_than_ten_ret1 } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function_block.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function_block.snap index 8dd4a9326e7..816450cb582 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function_block.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__returning_early_in_function_block.snap @@ -11,12 +11,12 @@ target triple = "[filtered]" @__abcdef__init = unnamed_addr constant %abcdef zeroinitializer -define void @abcdef(%abcdef* %0) { +define void @abcdef(ptr %0) { entry: - %this = alloca %abcdef*, align 8 - store %abcdef* %0, %abcdef** %this, align 8 - %n = getelementptr inbounds %abcdef, %abcdef* %0, i32 0, i32 0 - %load_n = load i8, i8* %n, align 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %n = getelementptr inbounds nuw %abcdef, ptr %0, i32 0, i32 0 + %load_n = load i8, ptr %n, align 1 %1 = sext i8 %load_n to i32 %tmpVar = icmp slt i32 %1, 10 %2 = zext i1 %tmpVar to i8 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_i8_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_i8_statement.snap index dd1dbba306b..fa7e2931cc1 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_i8_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_i8_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i8, i8* %x, align 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i8, ptr %x, align 1 switch i8 %load_x, label %else [ i8 1, label %case i8 2, label %case1 @@ -24,19 +23,19 @@ entry: ] case: ; preds = %entry - store i8 1, i8* %y, align 1 + store i8 1, ptr %y, align 1 br label %continue case1: ; preds = %entry - store i8 2, i8* %y, align 1 + store i8 2, ptr %y, align 1 br label %continue case2: ; preds = %entry - store i8 3, i8* %y, align 1 + store i8 3, ptr %y, align 1 br label %continue else: ; preds = %entry - store i8 0, i8* %y, align 1 + store i8 0, ptr %y, align 1 br label %continue continue: ; preds = %else, %case2, %case1, %case diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_statement.snap index bda1c655a18..06d1590ecdc 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__simple_case_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i32, ptr %x, align 4 switch i32 %load_x, label %else [ i32 1, label %case i32 2, label %case1 @@ -24,19 +23,19 @@ entry: ] case: ; preds = %entry - store i32 1, i32* %y, align 4 + store i32 1, ptr %y, align 4 br label %continue case1: ; preds = %entry - store i32 2, i32* %y, align 4 + store i32 2, ptr %y, align 4 br label %continue case2: ; preds = %entry - store i32 3, i32* %y, align 4 + store i32 3, ptr %y, align 4 br label %continue else: ; preds = %entry - store i32 -1, i32* %y, align 4 + store i32 -1, ptr %y, align 4 br label %continue continue: ; preds = %else, %case2, %case1, %case diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sizeof_works_in_binary_expression_with_different_size.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sizeof_works_in_binary_expression_with_different_size.snap index 29dffaf5d9f..886d2add759 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sizeof_works_in_binary_expression_with_different_size.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sizeof_works_in_binary_expression_with_different_size.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,16 +12,16 @@ entry: %main = alloca i32, align 4 %i = alloca i32, align 4 %j = alloca i16, align 2 - %arr_ptr = alloca [3 x float]*, align 8 - store i32 0, i32* %i, align 4 - store i16 0, i16* %j, align 2 - store [3 x float]* null, [3 x float]** %arr_ptr, align 8 - store i32 0, i32* %main, align 4 - %load_j = load i16, i16* %j, align 2 + %arr_ptr = alloca ptr, align 8 + store i32 0, ptr %i, align 4 + store i16 0, ptr %j, align 2 + store ptr null, ptr %arr_ptr, align 8 + store i32 0, ptr %main, align 4 + %load_j = load i16, ptr %j, align 2 %0 = zext i16 %load_j to i64 - %tmpVar = sub i64 %0, ptrtoint ([3 x float]** getelementptr ([3 x float]*, [3 x float]** null, i32 1) to i64) + %tmpVar = sub i64 %0, ptrtoint (ptr getelementptr (ptr, ptr null, i32 1) to i64) %1 = trunc i64 %tmpVar to i32 - store i32 %1, i32* %i, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 %1, ptr %i, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__structs_members_can_be_referenced.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__structs_members_can_be_referenced.snap index 748b21e483b..9b71b333a63 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__structs_members_can_be_referenced.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__structs_members_can_be_referenced.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,10 +13,10 @@ target triple = "[filtered]" @MainProg_instance = global %MainProg zeroinitializer @__MyStruct__init = unnamed_addr constant %MyStruct zeroinitializer -define void @MainProg(%MainProg* %0) { +define void @MainProg(ptr %0) { entry: - %Cord = getelementptr inbounds %MainProg, %MainProg* %0, i32 0, i32 0 - %a = getelementptr inbounds %MyStruct, %MyStruct* %Cord, i32 0, i32 0 - store i32 0, i32* %a, align 4 + %Cord = getelementptr inbounds nuw %MainProg, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %MyStruct, ptr %Cord, i32 0, i32 0 + store i32 0, ptr %a, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_check_functions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_check_functions.snap index 2c489f4f792..b859922c9ca 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_check_functions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_check_functions.snap @@ -15,14 +15,14 @@ define i32 @CheckRangeSigned(i32 %0, i32 %1, i32 %2) { entry: %CheckRangeSigned = alloca i32, align 4 %v = alloca i32, align 4 - store i32 %0, i32* %v, align 4 + store i32 %0, ptr %v, align 4 %low = alloca i32, align 4 - store i32 %1, i32* %low, align 4 + store i32 %1, ptr %low, align 4 %up = alloca i32, align 4 - store i32 %2, i32* %up, align 4 - store i32 0, i32* %CheckRangeSigned, align 4 - store i32 -7, i32* %CheckRangeSigned, align 4 - %CheckRangeSigned_ret = load i32, i32* %CheckRangeSigned, align 4 + store i32 %2, ptr %up, align 4 + store i32 0, ptr %CheckRangeSigned, align 4 + store i32 -7, ptr %CheckRangeSigned, align 4 + %CheckRangeSigned_ret = load i32, ptr %CheckRangeSigned, align 4 ret i32 %CheckRangeSigned_ret } @@ -30,14 +30,14 @@ define i32 @CheckRangeUnsigned(i32 %0, i32 %1, i32 %2) { entry: %CheckRangeUnsigned = alloca i32, align 4 %v = alloca i32, align 4 - store i32 %0, i32* %v, align 4 + store i32 %0, ptr %v, align 4 %low = alloca i32, align 4 - store i32 %1, i32* %low, align 4 + store i32 %1, ptr %low, align 4 %up = alloca i32, align 4 - store i32 %2, i32* %up, align 4 - store i32 0, i32* %CheckRangeUnsigned, align 4 - store i32 7, i32* %CheckRangeUnsigned, align 4 - %CheckRangeUnsigned_ret = load i32, i32* %CheckRangeUnsigned, align 4 + store i32 %2, ptr %up, align 4 + store i32 0, ptr %CheckRangeUnsigned, align 4 + store i32 7, ptr %CheckRangeUnsigned, align 4 + %CheckRangeUnsigned_ret = load i32, ptr %CheckRangeUnsigned, align 4 ret i32 %CheckRangeUnsigned_ret } @@ -45,14 +45,14 @@ define i64 @CheckLRangeSigned(i64 %0, i64 %1, i64 %2) { entry: %CheckLRangeSigned = alloca i64, align 8 %v = alloca i64, align 8 - store i64 %0, i64* %v, align 8 + store i64 %0, ptr %v, align 8 %low = alloca i64, align 8 - store i64 %1, i64* %low, align 8 + store i64 %1, ptr %low, align 8 %up = alloca i64, align 8 - store i64 %2, i64* %up, align 8 - store i64 0, i64* %CheckLRangeSigned, align 8 - store i64 -77, i64* %CheckLRangeSigned, align 8 - %CheckLRangeSigned_ret = load i64, i64* %CheckLRangeSigned, align 8 + store i64 %2, ptr %up, align 8 + store i64 0, ptr %CheckLRangeSigned, align 8 + store i64 -77, ptr %CheckLRangeSigned, align 8 + %CheckLRangeSigned_ret = load i64, ptr %CheckLRangeSigned, align 8 ret i64 %CheckLRangeSigned_ret } @@ -60,54 +60,54 @@ define i64 @CheckLRangeUnsigned(i64 %0, i64 %1, i64 %2) { entry: %CheckLRangeUnsigned = alloca i64, align 8 %v = alloca i64, align 8 - store i64 %0, i64* %v, align 8 + store i64 %0, ptr %v, align 8 %low = alloca i64, align 8 - store i64 %1, i64* %low, align 8 + store i64 %1, ptr %low, align 8 %up = alloca i64, align 8 - store i64 %2, i64* %up, align 8 - store i64 0, i64* %CheckLRangeUnsigned, align 8 - store i64 77, i64* %CheckLRangeUnsigned, align 8 - %CheckLRangeUnsigned_ret = load i64, i64* %CheckLRangeUnsigned, align 8 + store i64 %2, ptr %up, align 8 + store i64 0, ptr %CheckLRangeUnsigned, align 8 + store i64 77, ptr %CheckLRangeUnsigned, align 8 + %CheckLRangeUnsigned_ret = load i64, ptr %CheckLRangeUnsigned, align 8 ret i64 %CheckLRangeUnsigned_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %c = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %d = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %e = getelementptr inbounds %main, %main* %0, i32 0, i32 4 - %f = getelementptr inbounds %main, %main* %0, i32 0, i32 5 - %g = getelementptr inbounds %main, %main* %0, i32 0, i32 6 - %h = getelementptr inbounds %main, %main* %0, i32 0, i32 7 - %i = getelementptr inbounds %main, %main* %0, i32 0, i32 8 - %j = getelementptr inbounds %main, %main* %0, i32 0, i32 9 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %d = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %e = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 4 + %f = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 5 + %g = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 6 + %h = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 7 + %i = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 8 + %j = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 9 %call = call i32 @CheckRangeUnsigned(i32 1, i32 0, i32 100) %1 = trunc i32 %call to i8 - store i8 %1, i8* %a, align 1 + store i8 %1, ptr %a, align 1 %call1 = call i32 @CheckRangeSigned(i32 1, i32 -100, i32 100) %2 = trunc i32 %call1 to i8 - store i8 %2, i8* %b, align 1 + store i8 %2, ptr %b, align 1 %call2 = call i32 @CheckRangeUnsigned(i32 1, i32 0, i32 100) %3 = trunc i32 %call2 to i8 - store i8 %3, i8* %c, align 1 + store i8 %3, ptr %c, align 1 %call3 = call i32 @CheckRangeUnsigned(i32 1, i32 0, i32 100) %4 = trunc i32 %call3 to i16 - store i16 %4, i16* %d, align 2 + store i16 %4, ptr %d, align 2 %call4 = call i32 @CheckRangeSigned(i32 1, i32 -100, i32 100) %5 = trunc i32 %call4 to i16 - store i16 %5, i16* %e, align 2 + store i16 %5, ptr %e, align 2 %call5 = call i32 @CheckRangeUnsigned(i32 1, i32 0, i32 100) %6 = trunc i32 %call5 to i16 - store i16 %6, i16* %f, align 2 + store i16 %6, ptr %f, align 2 %call6 = call i32 @CheckRangeSigned(i32 1, i32 -100, i32 100) - store i32 %call6, i32* %g, align 4 + store i32 %call6, ptr %g, align 4 %call7 = call i32 @CheckRangeUnsigned(i32 1, i32 0, i32 100) - store i32 %call7, i32* %h, align 4 + store i32 %call7, ptr %h, align 4 %call8 = call i64 @CheckLRangeSigned(i64 1, i64 -100, i64 100) - store i64 %call8, i64* %i, align 8 + store i64 %call8, ptr %i, align 8 %call9 = call i64 @CheckLRangeUnsigned(i64 1, i64 0, i64 100) - store i64 %call9, i64* %j, align 8 + store i64 %call9, ptr %j, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_missing.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_missing.snap index c24c891f747..adeeabcfa51 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_missing.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_missing.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,21 +15,21 @@ define i16 @Check_XX_RangeSigned(i16 %0, i16 %1, i16 %2) { entry: %Check_XX_RangeSigned = alloca i16, align 2 %value = alloca i16, align 2 - store i16 %0, i16* %value, align 2 + store i16 %0, ptr %value, align 2 %lower = alloca i16, align 2 - store i16 %1, i16* %lower, align 2 + store i16 %1, ptr %lower, align 2 %upper = alloca i16, align 2 - store i16 %2, i16* %upper, align 2 - store i16 0, i16* %Check_XX_RangeSigned, align 2 - %load_value = load i16, i16* %value, align 2 - store i16 %load_value, i16* %Check_XX_RangeSigned, align 2 - %Check_XX_RangeSigned_ret = load i16, i16* %Check_XX_RangeSigned, align 2 + store i16 %2, ptr %upper, align 2 + store i16 0, ptr %Check_XX_RangeSigned, align 2 + %load_value = load i16, ptr %value, align 2 + store i16 %load_value, ptr %Check_XX_RangeSigned, align 2 + %Check_XX_RangeSigned_ret = load i16, ptr %Check_XX_RangeSigned, align 2 ret i16 %Check_XX_RangeSigned_ret } -define void @Main(%Main* %0) { +define void @Main(ptr %0) { entry: - %x = getelementptr inbounds %Main, %Main* %0, i32 0, i32 0 - store i16 7, i16* %x, align 2 + %x = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 0 + store i16 7, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_on_assigment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_on_assigment.snap index d29b80e3bac..8b4efe256bb 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_on_assigment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__sub_range_type_calls_check_function_on_assigment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,22 +15,22 @@ define i16 @CheckRangeSigned(i16 %0, i16 %1, i16 %2) { entry: %CheckRangeSigned = alloca i16, align 2 %value = alloca i16, align 2 - store i16 %0, i16* %value, align 2 + store i16 %0, ptr %value, align 2 %lower = alloca i16, align 2 - store i16 %1, i16* %lower, align 2 + store i16 %1, ptr %lower, align 2 %upper = alloca i16, align 2 - store i16 %2, i16* %upper, align 2 - store i16 0, i16* %CheckRangeSigned, align 2 - %load_value = load i16, i16* %value, align 2 - store i16 %load_value, i16* %CheckRangeSigned, align 2 - %CheckRangeSigned_ret = load i16, i16* %CheckRangeSigned, align 2 + store i16 %2, ptr %upper, align 2 + store i16 0, ptr %CheckRangeSigned, align 2 + %load_value = load i16, ptr %value, align 2 + store i16 %load_value, ptr %CheckRangeSigned, align 2 + %CheckRangeSigned_ret = load i16, ptr %CheckRangeSigned, align 2 ret i16 %CheckRangeSigned_ret } -define void @Main(%Main* %0) { +define void @Main(ptr %0) { entry: - %x = getelementptr inbounds %Main, %Main* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %Main, ptr %0, i32 0, i32 0 %call = call i16 @CheckRangeSigned(i16 7, i16 0, i16 100) - store i16 %call, i16* %x, align 2 + store i16 %call, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__time_variables_have_nano_seconds_resolution.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__time_variables_have_nano_seconds_resolution.snap index 6a058af9ab5..7b61399f925 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__time_variables_have_nano_seconds_resolution.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__time_variables_have_nano_seconds_resolution.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i64 1000000, i64* %y, align 8 - store i64 1000, i64* %y, align 8 - store i64 100, i64* %y, align 8 - store i64 8640000001125000, i64* %y, align 8 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i64 1000000, ptr %y, align 8 + store i64 1000, ptr %y, align 8 + store i64 100, ptr %y, align 8 + store i64 8640000001125000, ptr %y, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__two_global_variables_generates_in_separate_global_variables.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__two_global_variables_generates_in_separate_global_variables.snap index cbfd7cdd5a7..6a0c4228906 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__two_global_variables_generates_in_separate_global_variables.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__two_global_variables_generates_in_separate_global_variables.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,7 +14,7 @@ target triple = "[filtered]" @gA = global i16 0 @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__typed_enums_are_used_properly.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__typed_enums_are_used_properly.snap index 480e6f1d723..a7b294bdd60 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__typed_enums_are_used_properly.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__typed_enums_are_used_properly.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -21,13 +20,13 @@ target triple = "[filtered]" @MyEnum3.yellow = unnamed_addr constant i32 26 @MyEnum3.green = unnamed_addr constant i32 27 -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - store i8 6, i8* %x, align 1 - store i16 16, i16* %y, align 2 - store i32 26, i32* %z, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + store i8 6, ptr %x, align 1 + store i16 16, ptr %y, align 2 + store i32 26, ptr %z, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_cast_statement_as_const_expression.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_cast_statement_as_const_expression.snap index 433758ba012..a545c43fa31 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_cast_statement_as_const_expression.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_cast_statement_as_const_expression.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,8 +11,8 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_const_expression_in_range_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_const_expression_in_range_type.snap index a83b17e002c..157bc9e832b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_const_expression_in_range_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_const_expression_in_range_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,26 +17,26 @@ define i16 @CheckRangeSigned(i16 %0, i16 %1, i16 %2) { entry: %CheckRangeSigned = alloca i16, align 2 %value = alloca i16, align 2 - store i16 %0, i16* %value, align 2 + store i16 %0, ptr %value, align 2 %lower = alloca i16, align 2 - store i16 %1, i16* %lower, align 2 + store i16 %1, ptr %lower, align 2 %upper = alloca i16, align 2 - store i16 %2, i16* %upper, align 2 - store i16 0, i16* %CheckRangeSigned, align 2 - %load_value = load i16, i16* %value, align 2 - store i16 %load_value, i16* %CheckRangeSigned, align 2 - %CheckRangeSigned_ret = load i16, i16* %CheckRangeSigned, align 2 + store i16 %2, ptr %upper, align 2 + store i16 0, ptr %CheckRangeSigned, align 2 + %load_value = load i16, ptr %value, align 2 + store i16 %load_value, ptr %CheckRangeSigned, align 2 + %CheckRangeSigned_ret = load i16, ptr %CheckRangeSigned, align 2 ret i16 %CheckRangeSigned_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %load_MIN = load i16, i16* @MIN, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %load_MIN = load i16, ptr @MIN, align 2 %1 = sext i16 %load_MIN to i32 %tmpVar = add i32 %1, 1 %2 = trunc i32 %tmpVar to i16 %call = call i16 @CheckRangeSigned(i16 5, i16 0, i16 %2) - store i16 %call, i16* %x, align 2 + store i16 %call, ptr %x, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_global_consts_in_expressions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_global_consts_in_expressions.snap index e27b700ecc0..db3008a547a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_global_consts_in_expressions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__using_global_consts_in_expressions.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,9 +14,9 @@ target triple = "[filtered]" @cC = unnamed_addr constant i16 3 @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - store i32 6, i32* %z, align 4 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + store i32 6, ptr %z, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_data_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_data_type.snap index ce3be26b632..d747a3164b0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_data_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_data_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,14 +15,14 @@ define i64 @func() { entry: %func = alloca i64, align 8 %TIME = alloca i64, align 8 - store i64 0, i64* %TIME, align 8 - store i64 0, i64* %func, align 8 - %func_ret = load i64, i64* %func, align 8 + store i64 0, ptr %TIME, align 8 + store i64 0, ptr %func, align 8 + %func_ret = load i64, ptr %func, align 8 ret i64 %func_ret } -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %TIME = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %TIME = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_loop_with_if_exit.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_loop_with_if_exit.snap index b8f56c206f2..bbc4d3de8ce 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_loop_with_if_exit.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_loop_with_if_exit.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 br label %condition_check condition_check: ; preds = %entry, %continue5 br i1 true, label %while_body, label %continue while_body: ; preds = %condition_check - %load_x = load i32, i32* %x, align 4 + %load_x = load i32, ptr %x, align 4 %tmpVar = icmp slt i32 %load_x, 20 %1 = zext i1 %tmpVar to i8 %2 = icmp ne i8 %1, 0 @@ -38,10 +37,10 @@ buffer_block: ; No predecessors! br label %continue1 continue1: ; preds = %buffer_block, %while_body - %load_x3 = load i32, i32* %x, align 4 + %load_x3 = load i32, ptr %x, align 4 %tmpVar4 = add i32 %load_x3, 1 - store i32 %tmpVar4, i32* %x, align 4 - %load_x6 = load i32, i32* %x, align 4 + store i32 %tmpVar4, ptr %x, align 4 + %load_x6 = load i32, ptr %x, align 4 %tmpVar7 = icmp sge i32 %load_x6, 10 %3 = zext i1 %tmpVar7 to i8 %4 = icmp ne i8 %3, 0 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_statement.snap index 0022bddeca4..5ad24f19d7b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 br label %condition_check condition_check: ; preds = %entry, %continue1 br i1 true, label %while_body, label %continue while_body: ; preds = %condition_check - %load_x = load i8, i8* %x, align 1 + %load_x = load i8, ptr %x, align 1 %1 = icmp ne i8 %load_x, 0 %tmpVar = xor i1 %1, true br i1 %tmpVar, label %condition_body, label %continue1 @@ -36,6 +35,6 @@ buffer_block: ; No predecessors! br label %continue1 continue1: ; preds = %buffer_block, %while_body - %load_x2 = load i8, i8* %x, align 1 + %load_x2 = load i8, ptr %x, align 1 br label %condition_check } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_with_expression_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_with_expression_statement.snap index 603410b9b0f..1d819ec341f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_with_expression_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__while_with_expression_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/code_gen_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 br label %condition_check condition_check: ; preds = %entry, %continue1 br i1 true, label %while_body, label %continue while_body: ; preds = %condition_check - %load_x = load i8, i8* %x, align 1 + %load_x = load i8, ptr %x, align 1 %1 = zext i8 %load_x to i32 %tmpVar = icmp eq i32 %1, 0 %2 = zext i1 %tmpVar to i8 @@ -39,6 +38,6 @@ buffer_block: ; No predecessors! br label %continue1 continue1: ; preds = %buffer_block, %while_body - %load_x3 = load i8, i8* %x, align 1 + %load_x3 = load i8, ptr %x, align 1 br label %condition_check } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_number_type_comparing_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_number_type_comparing_test.snap index ebead1266b3..396dc5485ae 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_number_type_comparing_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_number_type_comparing_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,20 +12,20 @@ entry: %baz = alloca i16, align 2 %x = alloca i16, align 2 %y = alloca i16, align 2 - store i16 0, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 0, i16* %baz, align 2 - %load_x = load i16, i16* %x, align 2 + store i16 0, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 0, ptr %baz, align 2 + %load_x = load i16, ptr %x, align 2 %0 = sext i16 %load_x to i32 %tmpVar = icmp eq i32 %0, 3 - %load_x1 = load i16, i16* %x, align 2 + %load_x1 = load i16, ptr %x, align 2 %1 = sext i16 %load_x1 to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %2 = sext i16 %load_y to i32 %tmpVar2 = icmp slt i32 %1, %2 - %load_y3 = load i16, i16* %y, align 2 + %load_y3 = load i16, ptr %y, align 2 %3 = sext i16 %load_y3 to i32 %tmpVar4 = icmp sle i32 %3, 0 - %baz_ret = load i16, i16* %baz, align 2 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_ranged_number_type_comparing_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_ranged_number_type_comparing_test.snap index ebead1266b3..396dc5485ae 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_ranged_number_type_comparing_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__aliased_ranged_number_type_comparing_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,20 +12,20 @@ entry: %baz = alloca i16, align 2 %x = alloca i16, align 2 %y = alloca i16, align 2 - store i16 0, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 0, i16* %baz, align 2 - %load_x = load i16, i16* %x, align 2 + store i16 0, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 0, ptr %baz, align 2 + %load_x = load i16, ptr %x, align 2 %0 = sext i16 %load_x to i32 %tmpVar = icmp eq i32 %0, 3 - %load_x1 = load i16, i16* %x, align 2 + %load_x1 = load i16, ptr %x, align 2 %1 = sext i16 %load_x1 to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %2 = sext i16 %load_y to i32 %tmpVar2 = icmp slt i32 %1, %2 - %load_y3 = load i16, i16* %y, align 2 + %load_y3 = load i16, ptr %y, align 2 %3 = sext i16 %load_y3 to i32 %tmpVar4 = icmp sle i32 %3, 0 - %baz_ret = load i16, i16* %baz, align 2 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_datetime_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_datetime_types.snap index 975f1335adb..ae0152f449b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_datetime_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_datetime_types.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,20 +11,20 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var_time = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var_time_of_day = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var_date = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %var_date_and_time = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %load_var_time = load i64, i64* %var_time, align 8 - %load_var_time_of_day = load i64, i64* %var_time_of_day, align 8 + %var_time = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var_time_of_day = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var_date = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %var_date_and_time = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %load_var_time = load i64, ptr %var_time, align 8 + %load_var_time_of_day = load i64, ptr %var_time_of_day, align 8 %tmpVar = icmp sgt i64 %load_var_time, %load_var_time_of_day br i1 %tmpVar, label %1, label %2 1: ; preds = %entry - %load_var_time_of_day1 = load i64, i64* %var_time_of_day, align 8 - %load_var_date = load i64, i64* %var_date, align 8 + %load_var_time_of_day1 = load i64, ptr %var_time_of_day, align 8 + %load_var_date = load i64, ptr %var_date, align 8 %tmpVar2 = icmp sgt i64 %load_var_time_of_day1, %load_var_date br label %2 @@ -34,8 +33,8 @@ entry: br i1 %3, label %4, label %5 4: ; preds = %2 - %load_var_date3 = load i64, i64* %var_date, align 8 - %load_var_date_and_time = load i64, i64* %var_date_and_time, align 8 + %load_var_date3 = load i64, ptr %var_date, align 8 + %load_var_date_and_time = load i64, ptr %var_date_and_time, align 8 %tmpVar4 = icmp sgt i64 %load_var_date3, %load_var_date_and_time br label %5 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instruction_functions_with_different_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instruction_functions_with_different_types.snap index 98e6587af7e..07701cec589 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instruction_functions_with_different_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instruction_functions_with_different_types.snap @@ -1,128 +1,127 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { float*, i16, i32, float, double, i8, i16, i32, i64, i8, i16, i32, i64 } +%main = type { ptr, i16, i32, float, double, i8, i16, i32, i64, i8, i16, i32, i64 } @main_instance = global %main zeroinitializer define float @foo() { entry: %foo = alloca float, align 4 - store float 0.000000e+00, float* %foo, align 4 - %foo_ret = load float, float* %foo, align 4 + store float 0.000000e+00, ptr %foo, align 4 + %foo_ret = load float, ptr %foo, align 4 ret float %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %ptr_float = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %var_real = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %var_lreal = getelementptr inbounds %main, %main* %0, i32 0, i32 4 - %var_sint = getelementptr inbounds %main, %main* %0, i32 0, i32 5 - %var_int = getelementptr inbounds %main, %main* %0, i32 0, i32 6 - %var_dint = getelementptr inbounds %main, %main* %0, i32 0, i32 7 - %var_lint = getelementptr inbounds %main, %main* %0, i32 0, i32 8 - %var_usint = getelementptr inbounds %main, %main* %0, i32 0, i32 9 - %var_uint = getelementptr inbounds %main, %main* %0, i32 0, i32 10 - %var_udint = getelementptr inbounds %main, %main* %0, i32 0, i32 11 - %var_ulint = getelementptr inbounds %main, %main* %0, i32 0, i32 12 - store float* %var_real, float** %ptr_float, align 8 - %load_var_sint = load i8, i8* %var_sint, align 1 + %ptr_float = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %var_real = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %var_lreal = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 4 + %var_sint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 5 + %var_int = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 6 + %var_dint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 7 + %var_lint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 8 + %var_usint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 9 + %var_uint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 10 + %var_udint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 11 + %var_ulint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 12 + store ptr %var_real, ptr %ptr_float, align 8 + %load_var_sint = load i8, ptr %var_sint, align 1 %1 = sext i8 %load_var_sint to i32 - %load_var_dint = load i32, i32* %var_dint, align 4 + %load_var_dint = load i32, ptr %var_dint, align 4 %tmpVar = icmp eq i32 %1, %load_var_dint %2 = zext i1 %tmpVar to i8 - %load_var_lreal = load double, double* %var_lreal, align 8 + %load_var_lreal = load double, ptr %var_lreal, align 8 %tmpVar1 = fcmp ogt double 1.050000e+01, %load_var_lreal %3 = zext i1 %tmpVar1 to i8 - %load_var_usint = load i8, i8* %var_usint, align 1 + %load_var_usint = load i8, ptr %var_usint, align 1 %4 = zext i8 %load_var_usint to i32 - %load_var_udint = load i32, i32* %var_udint, align 4 + %load_var_udint = load i32, ptr %var_udint, align 4 %tmpVar2 = icmp ne i32 %4, %load_var_udint %5 = zext i1 %tmpVar2 to i8 - %load_var_uint = load i16, i16* %var_uint, align 2 + %load_var_uint = load i16, ptr %var_uint, align 2 %6 = zext i16 %load_var_uint to i32 %tmpVar3 = icmp sle i32 %6, 40 %7 = zext i1 %tmpVar3 to i8 - %load_var_ulint = load i64, i64* %var_ulint, align 8 + %load_var_ulint = load i64, ptr %var_ulint, align 8 %tmpVar4 = icmp sge i64 10, %load_var_ulint %8 = zext i1 %tmpVar4 to i8 - %load_var_sint5 = load i8, i8* %var_sint, align 1 + %load_var_sint5 = load i8, ptr %var_sint, align 1 %9 = sext i8 %load_var_sint5 to i32 - %load_var_usint6 = load i8, i8* %var_usint, align 1 + %load_var_usint6 = load i8, ptr %var_usint, align 1 %10 = zext i8 %load_var_usint6 to i32 %tmpVar7 = icmp eq i32 %9, %10 %11 = zext i1 %tmpVar7 to i8 - %load_var_uint8 = load i16, i16* %var_uint, align 2 + %load_var_uint8 = load i16, ptr %var_uint, align 2 %12 = zext i16 %load_var_uint8 to i64 - %load_var_lint = load i64, i64* %var_lint, align 8 + %load_var_lint = load i64, ptr %var_lint, align 8 %tmpVar9 = icmp sle i64 %12, %load_var_lint %13 = zext i1 %tmpVar9 to i8 - %load_var_dint10 = load i32, i32* %var_dint, align 4 + %load_var_dint10 = load i32, ptr %var_dint, align 4 %14 = sext i32 %load_var_dint10 to i64 - %load_var_ulint11 = load i64, i64* %var_ulint, align 8 + %load_var_ulint11 = load i64, ptr %var_ulint, align 8 %tmpVar12 = icmp sge i64 %14, %load_var_ulint11 %15 = zext i1 %tmpVar12 to i8 - %load_var_lint13 = load i64, i64* %var_lint, align 8 - %load_a = load i16, i16* %a, align 2 + %load_var_lint13 = load i64, ptr %var_lint, align 8 + %load_a = load i16, ptr %a, align 2 %16 = sext i16 %load_a to i64 %tmpVar14 = icmp slt i64 %load_var_lint13, %16 %17 = zext i1 %tmpVar14 to i8 - %load_a15 = load i16, i16* %a, align 2 + %load_a15 = load i16, ptr %a, align 2 %18 = sext i16 %load_a15 to i32 - %load_var_sint16 = load i8, i8* %var_sint, align 1 + %load_var_sint16 = load i8, ptr %var_sint, align 1 %19 = sext i8 %load_var_sint16 to i32 %tmpVar17 = icmp sgt i32 %18, %19 %20 = zext i1 %tmpVar17 to i8 - %load_b = load i32, i32* %b, align 4 + %load_b = load i32, ptr %b, align 4 %21 = sext i32 %load_b to i64 - %load_var_lint18 = load i64, i64* %var_lint, align 8 + %load_var_lint18 = load i64, ptr %var_lint, align 8 %tmpVar19 = icmp slt i64 %21, %load_var_lint18 %22 = zext i1 %tmpVar19 to i8 - %load_b20 = load i32, i32* %b, align 4 + %load_b20 = load i32, ptr %b, align 4 %tmpVar21 = icmp ne i32 5, %load_b20 br i1 %tmpVar21, label %23, label %24 23: ; preds = %entry - %load_b22 = load i32, i32* %b, align 4 + %load_b22 = load i32, ptr %b, align 4 %tmpVar23 = icmp ne i32 %load_b22, 17 br label %24 24: ; preds = %23, %entry %25 = phi i1 [ %tmpVar21, %entry ], [ %tmpVar23, %23 ] %26 = zext i1 %25 to i8 - %load_ptr_float = load float*, float** %ptr_float, align 8 - %load_var_usint24 = load i8, i8* %var_usint, align 1 + %load_ptr_float = load ptr, ptr %ptr_float, align 8 + %load_var_usint24 = load i8, ptr %var_usint, align 1 %27 = zext i8 %load_var_usint24 to i64 - %28 = ptrtoint float* %load_ptr_float to i64 + %28 = ptrtoint ptr %load_ptr_float to i64 %tmpVar25 = icmp sle i64 %28, %27 %29 = zext i1 %tmpVar25 to i8 - %load_a26 = load i16, i16* %a, align 2 + %load_a26 = load i16, ptr %a, align 2 %30 = sext i16 %load_a26 to i64 - %load_ptr_float27 = load float*, float** %ptr_float, align 8 - %31 = ptrtoint float* %load_ptr_float27 to i64 + %load_ptr_float27 = load ptr, ptr %ptr_float, align 8 + %31 = ptrtoint ptr %load_ptr_float27 to i64 %tmpVar28 = icmp eq i64 %30, %31 %32 = zext i1 %tmpVar28 to i8 %call = call float @foo() %tmpVar29 = fcmp one float %call, 4.050000e+01 %33 = zext i1 %tmpVar29 to i8 - %load_var_udint30 = load i32, i32* %var_udint, align 4 + %load_var_udint30 = load i32, ptr %var_udint, align 4 %34 = uitofp i32 %load_var_udint30 to float %call31 = call float @foo() %tmpVar32 = fcmp ole float %34, %call31 %35 = zext i1 %tmpVar32 to i8 %call33 = call float @foo() %36 = fpext float %call33 to double - %load_var_lint34 = load i64, i64* %var_lint, align 8 + %load_var_lint34 = load i64, ptr %var_lint, align 8 %37 = sitofp i64 %load_var_lint34 to double %tmpVar35 = fcmp oeq double %36, %37 %38 = zext i1 %tmpVar35 to i8 diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instructions_with_different_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instructions_with_different_types.snap index 84315f7b567..89352dc91cb 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instructions_with_different_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__compare_instructions_with_different_types.snap @@ -1,103 +1,102 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16*, i16, i32, i8, i16, i32, i64, i8, i16, i32, i64 } +%main = type { ptr, i16, i32, i8, i16, i32, i64, i8, i16, i32, i64 } @main_instance = global %main zeroinitializer define i64 @foo() { entry: %foo = alloca i64, align 8 - store i64 0, i64* %foo, align 8 - %foo_ret = load i64, i64* %foo, align 8 + store i64 0, ptr %foo, align 8 + %foo_ret = load i64, ptr %foo, align 8 ret i64 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %ptr_int = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %var_sint = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %var_int = getelementptr inbounds %main, %main* %0, i32 0, i32 4 - %var_dint = getelementptr inbounds %main, %main* %0, i32 0, i32 5 - %var_lint = getelementptr inbounds %main, %main* %0, i32 0, i32 6 - %var_usint = getelementptr inbounds %main, %main* %0, i32 0, i32 7 - %var_uint = getelementptr inbounds %main, %main* %0, i32 0, i32 8 - %var_udint = getelementptr inbounds %main, %main* %0, i32 0, i32 9 - %var_ulint = getelementptr inbounds %main, %main* %0, i32 0, i32 10 - store i16* %var_int, i16** %ptr_int, align 8 - %load_var_sint = load i8, i8* %var_sint, align 1 + %ptr_int = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %var_sint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %var_int = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 4 + %var_dint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 5 + %var_lint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 6 + %var_usint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 7 + %var_uint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 8 + %var_udint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 9 + %var_ulint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 10 + store ptr %var_int, ptr %ptr_int, align 8 + %load_var_sint = load i8, ptr %var_sint, align 1 %1 = sext i8 %load_var_sint to i32 - %load_var_dint = load i32, i32* %var_dint, align 4 + %load_var_dint = load i32, ptr %var_dint, align 4 %tmpVar = icmp eq i32 %1, %load_var_dint - %load_var_int = load i16, i16* %var_int, align 2 + %load_var_int = load i16, ptr %var_int, align 2 %2 = sext i16 %load_var_int to i32 %tmpVar1 = icmp slt i32 %2, 30 - %load_var_lint = load i64, i64* %var_lint, align 8 + %load_var_lint = load i64, ptr %var_lint, align 8 %tmpVar2 = icmp sgt i64 10, %load_var_lint - %load_var_usint = load i8, i8* %var_usint, align 1 + %load_var_usint = load i8, ptr %var_usint, align 1 %3 = zext i8 %load_var_usint to i32 - %load_var_udint = load i32, i32* %var_udint, align 4 + %load_var_udint = load i32, ptr %var_udint, align 4 %tmpVar3 = icmp ne i32 %3, %load_var_udint - %load_var_uint = load i16, i16* %var_uint, align 2 + %load_var_uint = load i16, ptr %var_uint, align 2 %4 = zext i16 %load_var_uint to i32 %tmpVar4 = icmp sle i32 %4, 40 - %load_var_ulint = load i64, i64* %var_ulint, align 8 + %load_var_ulint = load i64, ptr %var_ulint, align 8 %tmpVar5 = icmp sge i64 10, %load_var_ulint - %load_var_sint6 = load i8, i8* %var_sint, align 1 + %load_var_sint6 = load i8, ptr %var_sint, align 1 %5 = sext i8 %load_var_sint6 to i32 - %load_var_usint7 = load i8, i8* %var_usint, align 1 + %load_var_usint7 = load i8, ptr %var_usint, align 1 %6 = zext i8 %load_var_usint7 to i32 %tmpVar8 = icmp eq i32 %5, %6 - %load_var_uint9 = load i16, i16* %var_uint, align 2 + %load_var_uint9 = load i16, ptr %var_uint, align 2 %7 = zext i16 %load_var_uint9 to i64 - %load_var_lint10 = load i64, i64* %var_lint, align 8 + %load_var_lint10 = load i64, ptr %var_lint, align 8 %tmpVar11 = icmp sle i64 %7, %load_var_lint10 - %load_var_dint12 = load i32, i32* %var_dint, align 4 + %load_var_dint12 = load i32, ptr %var_dint, align 4 %8 = sext i32 %load_var_dint12 to i64 - %load_var_ulint13 = load i64, i64* %var_ulint, align 8 + %load_var_ulint13 = load i64, ptr %var_ulint, align 8 %tmpVar14 = icmp sge i64 %8, %load_var_ulint13 - %load_var_lint15 = load i64, i64* %var_lint, align 8 - %load_a = load i16, i16* %a, align 2 + %load_var_lint15 = load i64, ptr %var_lint, align 8 + %load_a = load i16, ptr %a, align 2 %9 = sext i16 %load_a to i64 %tmpVar16 = icmp slt i64 %load_var_lint15, %9 - %load_a17 = load i16, i16* %a, align 2 + %load_a17 = load i16, ptr %a, align 2 %10 = sext i16 %load_a17 to i32 - %load_var_sint18 = load i8, i8* %var_sint, align 1 + %load_var_sint18 = load i8, ptr %var_sint, align 1 %11 = sext i8 %load_var_sint18 to i32 %tmpVar19 = icmp sgt i32 %10, %11 - %load_b = load i32, i32* %b, align 4 + %load_b = load i32, ptr %b, align 4 %12 = sext i32 %load_b to i64 - %load_var_lint20 = load i64, i64* %var_lint, align 8 + %load_var_lint20 = load i64, ptr %var_lint, align 8 %tmpVar21 = icmp slt i64 %12, %load_var_lint20 - %load_b22 = load i32, i32* %b, align 4 + %load_b22 = load i32, ptr %b, align 4 %tmpVar23 = icmp ne i32 5, %load_b22 - %load_ptr_int = load i16*, i16** %ptr_int, align 8 - %load_var_usint24 = load i8, i8* %var_usint, align 1 + %load_ptr_int = load ptr, ptr %ptr_int, align 8 + %load_var_usint24 = load i8, ptr %var_usint, align 1 %13 = zext i8 %load_var_usint24 to i64 - %14 = ptrtoint i16* %load_ptr_int to i64 + %14 = ptrtoint ptr %load_ptr_int to i64 %tmpVar25 = icmp sle i64 %14, %13 - %load_a26 = load i16, i16* %a, align 2 + %load_a26 = load i16, ptr %a, align 2 %15 = sext i16 %load_a26 to i64 - %load_ptr_int27 = load i16*, i16** %ptr_int, align 8 - %16 = ptrtoint i16* %load_ptr_int27 to i64 + %load_ptr_int27 = load ptr, ptr %ptr_int, align 8 + %16 = ptrtoint ptr %load_ptr_int27 to i64 %tmpVar28 = icmp eq i64 %15, %16 %call = call i64 @foo() %tmpVar29 = icmp ne i64 %call, 40 - %load_var_udint30 = load i32, i32* %var_udint, align 4 + %load_var_udint30 = load i32, ptr %var_udint, align 4 %17 = zext i32 %load_var_udint30 to i64 %call31 = call i64 @foo() %tmpVar32 = icmp sle i64 %17, %call31 %call33 = call i64 @foo() - %load_var_lint34 = load i64, i64* %var_lint, align 8 + %load_var_lint34 = load i64, ptr %var_lint, align 8 %tmpVar35 = icmp eq i64 %call33, %load_var_lint34 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_compare_instructions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_compare_instructions.snap index 2bb84baada0..b71befe20a5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_compare_instructions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_compare_instructions.snap @@ -1,65 +1,64 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16, i16, i16*, i8 } +%main = type { i16, i16, ptr, i8 } -@main_instance = global %main { i16 10, i16 20, i16* null, i8 0 } +@main_instance = global %main { i16 10, i16 20, ptr null, i8 0 } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %pt = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %comp = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - store i16* %x, i16** %pt, align 8 - %load_pt = load i16*, i16** %pt, align 8 - %load_pt1 = load i16*, i16** %pt, align 8 - %1 = ptrtoint i16* %load_pt to i64 - %2 = ptrtoint i16* %load_pt1 to i64 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %pt = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %comp = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + store ptr %x, ptr %pt, align 8 + %load_pt = load ptr, ptr %pt, align 8 + %load_pt1 = load ptr, ptr %pt, align 8 + %1 = ptrtoint ptr %load_pt to i64 + %2 = ptrtoint ptr %load_pt1 to i64 %tmpVar = icmp eq i64 %1, %2 %3 = zext i1 %tmpVar to i8 - store i8 %3, i8* %comp, align 1 - %load_pt2 = load i16*, i16** %pt, align 8 - %load_y = load i16, i16* %y, align 2 + store i8 %3, ptr %comp, align 1 + %load_pt2 = load ptr, ptr %pt, align 8 + %load_y = load i16, ptr %y, align 2 %4 = sext i16 %load_y to i64 - %5 = ptrtoint i16* %load_pt2 to i64 + %5 = ptrtoint ptr %load_pt2 to i64 %tmpVar3 = icmp ne i64 %5, %4 %6 = zext i1 %tmpVar3 to i8 - store i8 %6, i8* %comp, align 1 - %load_pt4 = load i16*, i16** %pt, align 8 - %load_pt5 = load i16*, i16** %pt, align 8 - %7 = ptrtoint i16* %load_pt4 to i64 - %8 = ptrtoint i16* %load_pt5 to i64 + store i8 %6, ptr %comp, align 1 + %load_pt4 = load ptr, ptr %pt, align 8 + %load_pt5 = load ptr, ptr %pt, align 8 + %7 = ptrtoint ptr %load_pt4 to i64 + %8 = ptrtoint ptr %load_pt5 to i64 %tmpVar6 = icmp slt i64 %7, %8 %9 = zext i1 %tmpVar6 to i8 - store i8 %9, i8* %comp, align 1 - %load_pt7 = load i16*, i16** %pt, align 8 - %load_y8 = load i16, i16* %y, align 2 + store i8 %9, ptr %comp, align 1 + %load_pt7 = load ptr, ptr %pt, align 8 + %load_y8 = load i16, ptr %y, align 2 %10 = sext i16 %load_y8 to i64 - %11 = ptrtoint i16* %load_pt7 to i64 + %11 = ptrtoint ptr %load_pt7 to i64 %tmpVar9 = icmp sgt i64 %11, %10 %12 = zext i1 %tmpVar9 to i8 - store i8 %12, i8* %comp, align 1 - %load_pt10 = load i16*, i16** %pt, align 8 - %load_pt11 = load i16*, i16** %pt, align 8 - %13 = ptrtoint i16* %load_pt10 to i64 - %14 = ptrtoint i16* %load_pt11 to i64 + store i8 %12, ptr %comp, align 1 + %load_pt10 = load ptr, ptr %pt, align 8 + %load_pt11 = load ptr, ptr %pt, align 8 + %13 = ptrtoint ptr %load_pt10 to i64 + %14 = ptrtoint ptr %load_pt11 to i64 %tmpVar12 = icmp sle i64 %13, %14 %15 = zext i1 %tmpVar12 to i8 - store i8 %15, i8* %comp, align 1 - %load_y13 = load i16, i16* %y, align 2 + store i8 %15, ptr %comp, align 1 + %load_y13 = load i16, ptr %y, align 2 %16 = sext i16 %load_y13 to i64 - %load_pt14 = load i16*, i16** %pt, align 8 - %17 = ptrtoint i16* %load_pt14 to i64 + %load_pt14 = load ptr, ptr %pt, align 8 + %17 = ptrtoint ptr %load_pt14 to i64 %tmpVar15 = icmp sge i64 %16, %17 %18 = zext i1 %tmpVar15 to i8 - store i8 %18, i8* %comp, align 1 + store i8 %18, ptr %comp, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_function_call_compare_instructions.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_function_call_compare_instructions.snap index 22e8294bc2f..40173222b93 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_function_call_compare_instructions.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__pointer_function_call_compare_instructions.snap @@ -1,66 +1,65 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16*, i16, i8 } +%main = type { ptr, i16, i8 } @main_instance = global %main zeroinitializer define i64 @foo() { entry: %foo = alloca i64, align 8 - store i64 0, i64* %foo, align 8 - %foo_ret = load i64, i64* %foo, align 8 + store i64 0, ptr %foo, align 8 + %foo_ret = load i64, ptr %foo, align 8 ret i64 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %pt = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %comp = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - store i16* %x, i16** %pt, align 8 - %load_pt = load i16*, i16** %pt, align 8 + %pt = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %comp = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + store ptr %x, ptr %pt, align 8 + %load_pt = load ptr, ptr %pt, align 8 %call = call i64 @foo() - %1 = ptrtoint i16* %load_pt to i64 + %1 = ptrtoint ptr %load_pt to i64 %tmpVar = icmp eq i64 %1, %call %2 = zext i1 %tmpVar to i8 - store i8 %2, i8* %comp, align 1 - %load_pt1 = load i16*, i16** %pt, align 8 + store i8 %2, ptr %comp, align 1 + %load_pt1 = load ptr, ptr %pt, align 8 %call2 = call i64 @foo() - %3 = ptrtoint i16* %load_pt1 to i64 + %3 = ptrtoint ptr %load_pt1 to i64 %tmpVar3 = icmp ne i64 %3, %call2 %4 = zext i1 %tmpVar3 to i8 - store i8 %4, i8* %comp, align 1 - %load_pt4 = load i16*, i16** %pt, align 8 + store i8 %4, ptr %comp, align 1 + %load_pt4 = load ptr, ptr %pt, align 8 %call5 = call i64 @foo() - %5 = ptrtoint i16* %load_pt4 to i64 + %5 = ptrtoint ptr %load_pt4 to i64 %tmpVar6 = icmp slt i64 %5, %call5 %6 = zext i1 %tmpVar6 to i8 - store i8 %6, i8* %comp, align 1 - %load_pt7 = load i16*, i16** %pt, align 8 + store i8 %6, ptr %comp, align 1 + %load_pt7 = load ptr, ptr %pt, align 8 %call8 = call i64 @foo() - %7 = ptrtoint i16* %load_pt7 to i64 + %7 = ptrtoint ptr %load_pt7 to i64 %tmpVar9 = icmp sgt i64 %7, %call8 %8 = zext i1 %tmpVar9 to i8 - store i8 %8, i8* %comp, align 1 - %load_pt10 = load i16*, i16** %pt, align 8 + store i8 %8, ptr %comp, align 1 + %load_pt10 = load ptr, ptr %pt, align 8 %call11 = call i64 @foo() - %9 = ptrtoint i16* %load_pt10 to i64 + %9 = ptrtoint ptr %load_pt10 to i64 %tmpVar12 = icmp sle i64 %9, %call11 %10 = zext i1 %tmpVar12 to i8 - store i8 %10, i8* %comp, align 1 - %load_pt13 = load i16*, i16** %pt, align 8 + store i8 %10, ptr %comp, align 1 + %load_pt13 = load ptr, ptr %pt, align 8 %call14 = call i64 @foo() - %11 = ptrtoint i16* %load_pt13 to i64 + %11 = ptrtoint ptr %load_pt13 to i64 %tmpVar15 = icmp sge i64 %11, %call14 %12 = zext i1 %tmpVar15 to i8 - store i8 %12, i8* %comp, align 1 + store i8 %12, ptr %comp, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__ranged_number_type_comparing_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__ranged_number_type_comparing_test.snap index ebead1266b3..396dc5485ae 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__ranged_number_type_comparing_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__ranged_number_type_comparing_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,20 +12,20 @@ entry: %baz = alloca i16, align 2 %x = alloca i16, align 2 %y = alloca i16, align 2 - store i16 0, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 0, i16* %baz, align 2 - %load_x = load i16, i16* %x, align 2 + store i16 0, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 0, ptr %baz, align 2 + %load_x = load i16, ptr %x, align 2 %0 = sext i16 %load_x to i32 %tmpVar = icmp eq i32 %0, 3 - %load_x1 = load i16, i16* %x, align 2 + %load_x1 = load i16, ptr %x, align 2 %1 = sext i16 %load_x1 to i32 - %load_y = load i16, i16* %y, align 2 + %load_y = load i16, ptr %y, align 2 %2 = sext i16 %load_y to i32 %tmpVar2 = icmp slt i32 %1, %2 - %load_y3 = load i16, i16* %y, align 2 + %load_y3 = load i16, ptr %y, align 2 %3 = sext i16 %load_y3 to i32 %tmpVar4 = icmp sle i32 %3, 0 - %baz_ret = load i16, i16* %baz, align 2 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_comparison_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_comparison_test.snap index a78c1bb52e8..692037b7127 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_comparison_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_comparison_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,19 +10,17 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"a\00" @utf08_literal_1 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -33,27 +30,23 @@ entry: %a = alloca [81 x i8], align 1 %b = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [81 x i8]* %b to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %call = call i8 @STRING_EQUAL(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_1, i32 0, i32 0)) - store i8 %call, i8* %result, align 1 - %2 = bitcast [81 x i8]* %a to i8* - %3 = bitcast [81 x i8]* %b to i8* - %call1 = call i8 @STRING_EQUAL(i8* %2, i8* %3) - store i8 %call1, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %b, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_EQUAL(ptr @utf08_literal_0, ptr @utf08_literal_1) + store i8 %call, ptr %result, align 1 + %call1 = call i8 @STRING_EQUAL(ptr %a, ptr %b) + store i8 %call1, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_equal_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_equal_with_constant_test.snap index e5b92798c0c..0fa5db8c636 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_equal_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_equal_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,19 +10,17 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"a\00" @utf08_literal_1 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -33,27 +30,23 @@ entry: %a = alloca [81 x i8], align 1 %b = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [81 x i8]* %b to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %2 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_EQUAL(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_1, i32 0, i32 0)) - store i8 %call, i8* %result, align 1 - %3 = bitcast [81 x i8]* %b to i8* - %call1 = call i8 @STRING_EQUAL(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0), i8* %3) - store i8 %call1, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %b, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_EQUAL(ptr %a, ptr @utf08_literal_1) + store i8 %call, ptr %result, align 1 + %call1 = call i8 @STRING_EQUAL(ptr @utf08_literal_0, ptr %b) + store i8 %call1, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_or_equal_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_or_equal_with_constant_test.snap index 5d66343c854..6a4e107170f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_or_equal_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_or_equal_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,35 +9,31 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_GREATER(i8* %0, i8* %1) { +define i8 @STRING_GREATER(ptr %0, ptr %1) { entry: %STRING_GREATER = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_GREATER, align 1 - %STRING_GREATER_ret = load i8, i8* %STRING_GREATER, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_GREATER, align 1 + %STRING_GREATER_ret = load i8, ptr %STRING_GREATER, align 1 ret i8 %STRING_GREATER_ret } -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -48,36 +43,32 @@ entry: %a = alloca [81 x i8], align 1 %b = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [81 x i8]* %b to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %2 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_EQUAL(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - %3 = icmp ne i8 %call, 0 - br i1 %3, label %7, label %4 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %b, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_EQUAL(ptr %a, ptr @utf08_literal_0) + %0 = icmp ne i8 %call, 0 + br i1 %0, label %3, label %1 -4: ; preds = %entry - %5 = bitcast [81 x i8]* %a to i8* - %call1 = call i8 @STRING_GREATER(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - %6 = icmp ne i8 %call1, 0 - br label %7 +1: ; preds = %entry + %call1 = call i8 @STRING_GREATER(ptr %a, ptr @utf08_literal_0) + %2 = icmp ne i8 %call1, 0 + br label %3 -7: ; preds = %4, %entry - %8 = phi i1 [ %3, %entry ], [ %6, %4 ] - %9 = zext i1 %8 to i8 - store i8 %9, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 +3: ; preds = %1, %entry + %4 = phi i1 [ %0, %entry ], [ %2, %1 ] + %5 = zext i1 %4 to i8 + store i8 %5, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_with_constant_test.snap index 5e8888cf23a..50a0c4966b5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_greater_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,19 +9,17 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_GREATER(i8* %0, i8* %1) { +define i8 @STRING_GREATER(ptr %0, ptr %1) { entry: %STRING_GREATER = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_GREATER, align 1 - %STRING_GREATER_ret = load i8, i8* %STRING_GREATER, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_GREATER, align 1 + %STRING_GREATER_ret = load i8, ptr %STRING_GREATER, align 1 ret i8 %STRING_GREATER_ret } @@ -31,22 +28,20 @@ entry: %baz = alloca i16, align 2 %a = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %1 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_GREATER(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - store i8 %call, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_GREATER(ptr %a, ptr @utf08_literal_0) + store i8 %call, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_less_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_less_with_constant_test.snap index d99024bc6f0..7db98a4b82f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_less_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_less_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,19 +9,17 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_LESS(i8* %0, i8* %1) { +define i8 @STRING_LESS(ptr %0, ptr %1) { entry: %STRING_LESS = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_LESS, align 1 - %STRING_LESS_ret = load i8, i8* %STRING_LESS, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_LESS, align 1 + %STRING_LESS_ret = load i8, ptr %STRING_LESS, align 1 ret i8 %STRING_LESS_ret } @@ -31,22 +28,20 @@ entry: %baz = alloca i16, align 2 %a = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %1 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_LESS(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - store i8 %call, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_LESS(ptr %a, ptr @utf08_literal_0) + store i8 %call, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_not_equal_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_not_equal_with_constant_test.snap index 93dc818a6e5..5c87f4609c8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_not_equal_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_not_equal_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,19 +9,17 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -31,25 +28,23 @@ entry: %baz = alloca i16, align 2 %a = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %1 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_EQUAL(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - %2 = icmp ne i8 %call, 0 - %tmpVar = xor i1 %2, true - %3 = zext i1 %tmpVar to i8 - store i8 %3, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_EQUAL(ptr %a, ptr @utf08_literal_0) + %0 = icmp ne i8 %call, 0 + %tmpVar = xor i1 %0, true + %1 = zext i1 %tmpVar to i8 + store i8 %1, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_smaller_or_equal_with_constant_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_smaller_or_equal_with_constant_test.snap index 95e590d5bfc..8ac4588cba5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_smaller_or_equal_with_constant_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__compare_instructions_tests__string_smaller_or_equal_with_constant_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/compare_instructions_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,35 +9,31 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [2 x i8] c"b\00" -define i8 @STRING_LESS(i8* %0, i8* %1) { +define i8 @STRING_LESS(ptr %0, ptr %1) { entry: %STRING_LESS = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_LESS, align 1 - %STRING_LESS_ret = load i8, i8* %STRING_LESS, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_LESS, align 1 + %STRING_LESS_ret = load i8, ptr %STRING_LESS, align 1 ret i8 %STRING_LESS_ret } -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -48,36 +43,32 @@ entry: %a = alloca [81 x i8], align 1 %b = alloca [81 x i8], align 1 %result = alloca i8, align 1 - %0 = bitcast [81 x i8]* %a to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [81 x i8]* %b to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store i8 0, i8* %result, align 1 - store i16 0, i16* %baz, align 2 - %2 = bitcast [81 x i8]* %a to i8* - %call = call i8 @STRING_EQUAL(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - %3 = icmp ne i8 %call, 0 - br i1 %3, label %7, label %4 + call void @llvm.memset.p0.i64(ptr align 1 %a, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %b, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store i8 0, ptr %result, align 1 + store i16 0, ptr %baz, align 2 + %call = call i8 @STRING_EQUAL(ptr %a, ptr @utf08_literal_0) + %0 = icmp ne i8 %call, 0 + br i1 %0, label %3, label %1 -4: ; preds = %entry - %5 = bitcast [81 x i8]* %a to i8* - %call1 = call i8 @STRING_LESS(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0)) - %6 = icmp ne i8 %call1, 0 - br label %7 +1: ; preds = %entry + %call1 = call i8 @STRING_LESS(ptr %a, ptr @utf08_literal_0) + %2 = icmp ne i8 %call1, 0 + br label %3 -7: ; preds = %4, %entry - %8 = phi i1 [ %3, %entry ], [ %6, %4 ] - %9 = zext i1 %8 to i8 - store i8 %9, i8* %result, align 1 - %baz_ret = load i16, i16* %baz, align 2 +3: ; preds = %1, %entry + %4 = phi i1 [ %0, %entry ], [ %2, %1 ] + %5 = zext i1 %4 to i8 + store i8 %5, ptr %result, align 1 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_array_variable.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_array_variable.snap index dc6e405fac6..91cf487b880 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_array_variable.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_array_variable.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/constants_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,15 +12,14 @@ target triple = "[filtered]" @const_arr = unnamed_addr constant [4 x i16] [i16 1, i16 2, i16 3, i16 4] @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %arr = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = bitcast [4 x i16]* %arr to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast ([4 x i16]* @const_arr to i8*), i64 ptrtoint ([4 x i16]* getelementptr ([4 x i16], [4 x i16]* null, i32 1) to i64), i1 false) + %arr = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr, ptr align 1 @const_arr, i64 ptrtoint (ptr getelementptr ([4 x i16], ptr null, i32 1) to i64), i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_string_variable.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_string_variable.snap index 27329fb55ed..ef93b436d36 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_string_variable.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_string_variable.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/constants_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,15 +12,14 @@ target triple = "[filtered]" @const_str = unnamed_addr constant [81 x i8] c"global constant string\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %str = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = bitcast [81 x i8]* %str to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([81 x i8], [81 x i8]* @const_str, i32 0, i32 0), i32 80, i1 false) + %str = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %str, ptr align 1 @const_str, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_struct_variable.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_struct_variable.snap index 21412d7c014..56a5a517329 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_struct_variable.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__constants_tests__assigning_const_struct_variable.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/constants_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,15 +14,14 @@ target triple = "[filtered]" @__Point__init = unnamed_addr constant %Point zeroinitializer @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %strct = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = bitcast %Point* %strct to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 bitcast (%Point* @const_strct to i8*), i64 ptrtoint (%Point* getelementptr (%Point, %Point* null, i32 1) to i64), i1 false) + %strct = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %strct, ptr align 1 @const_strct, i64 ptrtoint (ptr getelementptr (%Point, ptr null, i32 1) to i64), i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_nested_struct_added_to_debug_info.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_nested_struct_added_to_debug_info.snap index ce5f64fa6d0..ea3e1afcccd 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_nested_struct_added_to_debug_info.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_nested_struct_added_to_debug_info.snap @@ -10,49 +10,49 @@ target triple = "[filtered]" %myStruct = type { i32, %myStruct2 } %myStruct2 = type { i32, double } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !0 @__myStruct2__init = unnamed_addr constant %myStruct2 zeroinitializer, !dbg !14 @gStruct = global %myStruct zeroinitializer, !dbg !17 -define void @__init_mystruct(%myStruct* %0) { +define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 - %deref = load %myStruct*, %myStruct** %self, align 8 - %b = getelementptr inbounds %myStruct, %myStruct* %deref, i32 0, i32 1 - call void @__init_mystruct2(%myStruct2* %b) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %myStruct, ptr %deref, i32 0, i32 1 + call void @__init_mystruct2(ptr %b) ret void } -define void @__init_mystruct2(%myStruct2* %0) { +define void @__init_mystruct2(ptr %0) { entry: - %self = alloca %myStruct2*, align 8 - store %myStruct2* %0, %myStruct2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_myStruct(%myStruct* %0) { +define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 - %deref = load %myStruct*, %myStruct** %self, align 8 - %b = getelementptr inbounds %myStruct, %myStruct* %deref, i32 0, i32 1 - call void @__user_init_myStruct2(%myStruct2* %b) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %b = getelementptr inbounds nuw %myStruct, ptr %deref, i32 0, i32 1 + call void @__user_init_myStruct2(ptr %b) ret void } -define void @__user_init_myStruct2(%myStruct2* %0) { +define void @__user_init_myStruct2(ptr %0) { entry: - %self = alloca %myStruct2*, align 8 - store %myStruct2* %0, %myStruct2** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_mystruct(%myStruct* @gStruct) - call void @__user_init_myStruct(%myStruct* @gStruct) + call void @__init_mystruct(ptr @gStruct) + call void @__user_init_myStruct(ptr @gStruct) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_pointer_added_to_debug_info.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_pointer_added_to_debug_info.snap index 9ff4815e4c8..4f08375c019 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_pointer_added_to_debug_info.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_pointer_added_to_debug_info.snap @@ -7,8 +7,8 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -@a = global i32* null, !dbg !0 -@b = global [11 x i32]* null, !dbg !6 +@a = global ptr null, !dbg !0 +@b = global ptr null, !dbg !6 !llvm.module.flags = !{!13, !14} !llvm.dbg.cu = !{!15} diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_struct_added_to_debug_info.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_struct_added_to_debug_info.snap index 3e6044abdc9..3d47d4a9898 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_struct_added_to_debug_info.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__debug_tests__global_var_struct_added_to_debug_info.snap @@ -10,28 +10,28 @@ target triple = "[filtered]" %myStruct = type { i32, double, [11 x i32] } @b = global [11 x %myStruct] zeroinitializer, !dbg !0 -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer, !dbg !14 @gStruct = global %myStruct zeroinitializer, !dbg !17 -define void @__init_mystruct(%myStruct* %0) { +define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_myStruct(%myStruct* %0) { +define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_mystruct(%myStruct* @gStruct) - call void @__user_init_myStruct(%myStruct* @gStruct) + call void @__init_mystruct(ptr @gStruct) + call void @__user_init_myStruct(ptr @gStruct) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__bitaccess_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__bitaccess_assignment.snap index 4b2293d2d98..86e7131da88 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__bitaccess_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__bitaccess_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,26 +12,26 @@ entry: %main = alloca i16, align 2 %a = alloca i8, align 1 %b = alloca i16, align 2 - store i8 0, i8* %a, align 1 - store i16 1, i16* %b, align 2 - store i16 0, i16* %main, align 2 - %0 = load i8, i8* %a, align 1 + store i8 0, ptr %a, align 1 + store i16 1, ptr %b, align 2 + store i16 0, ptr %main, align 2 + %0 = load i8, ptr %a, align 1 %erase = and i8 %0, -3 %or = or i8 %erase, 2 - store i8 %or, i8* %a, align 1 - %1 = load i8, i8* %a, align 1 + store i8 %or, ptr %a, align 1 + %1 = load i8, ptr %a, align 1 %erase1 = and i8 %1, -5 %or2 = or i8 %erase1, 0 - store i8 %or2, i8* %a, align 1 - %2 = load i8, i8* %a, align 1 - %load_b = load i16, i16* %b, align 2 + store i8 %or2, ptr %a, align 1 + %2 = load i8, ptr %a, align 1 + %load_b = load i16, ptr %b, align 2 %3 = trunc i16 %load_b to i8 %shift = shl i8 1, %3 %invert = xor i8 %shift, -1 %erase3 = and i8 %2, %invert %value = shl i8 0, %3 %or4 = or i8 %erase3, %value - store i8 %or4, i8* %a, align 1 - %main_ret = load i16, i16* %main, align 2 + store i8 %or4, ptr %a, align 1 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__byteaccess_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__byteaccess_assignment.snap index e48f28c90a4..9ff6cdd2549 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__byteaccess_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__byteaccess_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ define i16 @main() { entry: %main = alloca i16, align 2 %b = alloca i16, align 2 - store i16 0, i16* %b, align 2 - store i16 0, i16* %main, align 2 - %0 = load i16, i16* %b, align 2 + store i16 0, ptr %b, align 2 + store i16 0, ptr %main, align 2 + %0 = load i16, ptr %b, align 2 %erase = and i16 %0, -256 %or = or i16 %erase, 2 - store i16 %or, i16* %b, align 2 - %main_ret = load i16, i16* %main, align 2 + store i16 %or, ptr %b, align 2 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__chained_bit_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__chained_bit_assignment.snap index 252078d7155..0b9b30cb4bc 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__chained_bit_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__chained_bit_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ define i16 @main() { entry: %main = alloca i16, align 2 %d = alloca i64, align 8 - store i64 0, i64* %d, align 8 - store i16 0, i16* %main, align 2 - %0 = load i64, i64* %d, align 8 + store i64 0, ptr %d, align 8 + store i16 0, ptr %main, align 2 + %0 = load i64, ptr %d, align 8 %erase = and i64 %0, -8589934593 %or = or i64 %erase, 8589934592 - store i64 %or, i64* %d, align 8 - %main_ret = load i16, i16* %main, align 2 + store i64 %or, ptr %d, align 8 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__dwordaccess_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__dwordaccess_assignment.snap index 81a282dc6a2..6572dac4d06 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__dwordaccess_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__dwordaccess_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ define i16 @main() { entry: %main = alloca i16, align 2 %d = alloca i64, align 8 - store i64 0, i64* %d, align 8 - store i16 0, i16* %main, align 2 - %0 = load i64, i64* %d, align 8 + store i64 0, ptr %d, align 8 + store i16 0, ptr %main, align 2 + %0 = load i64, ptr %d, align 8 %erase = and i64 %0, -4294967296 %or = or i64 %erase, 11259375 - store i64 %or, i64* %d, align 8 - %main_ret = load i16, i16* %main, align 2 + store i64 %or, ptr %d, align 8 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__lwordaccess_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__lwordaccess_assignment.snap index 5fd655f9cd5..c90668c7ab9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__lwordaccess_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__lwordaccess_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ define i16 @main() { entry: %main = alloca i16, align 2 %d = alloca i64, align 8 - store i64 0, i64* %d, align 8 - store i16 0, i16* %main, align 2 - %0 = load i64, i64* %d, align 8 + store i64 0, ptr %d, align 8 + store i16 0, ptr %main, align 2 + %0 = load i64, ptr %d, align 8 %erase = and i64 %0, poison %or = or i64 %erase, poison - store i64 %or, i64* %d, align 8 - %main_ret = load i16, i16* %main, align 2 + store i64 %or, ptr %d, align 8 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__qualified_reference_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__qualified_reference_assignment.snap index a362bf19fa5..f82921b95fd 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__qualified_reference_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__qualified_reference_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,24 +15,23 @@ define i16 @main() { entry: %main = alloca i16, align 2 %str = alloca %myStruct, align 8 - %0 = bitcast %myStruct* %str to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds (%myStruct, %myStruct* @__myStruct__init, i32 0, i32 0), i64 ptrtoint (%myStruct* getelementptr (%myStruct, %myStruct* null, i32 1) to i64), i1 false) - store i16 0, i16* %main, align 2 - %x = getelementptr inbounds %myStruct, %myStruct* %str, i32 0, i32 0 - %1 = load i8, i8* %x, align 1 - %erase = and i8 %1, -2 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %str, ptr align 1 @__myStruct__init, i64 ptrtoint (ptr getelementptr (%myStruct, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %main, align 2 + %x = getelementptr inbounds nuw %myStruct, ptr %str, i32 0, i32 0 + %0 = load i8, ptr %x, align 1 + %erase = and i8 %0, -2 %or = or i8 %erase, 0 - store i8 %or, i8* %x, align 1 - %x1 = getelementptr inbounds %myStruct, %myStruct* %str, i32 0, i32 0 - %2 = load i8, i8* %x1, align 1 - %erase2 = and i8 %2, -3 + store i8 %or, ptr %x, align 1 + %x1 = getelementptr inbounds nuw %myStruct, ptr %str, i32 0, i32 0 + %1 = load i8, ptr %x1, align 1 + %erase2 = and i8 %1, -3 %or3 = or i8 %erase2, 2 - store i8 %or3, i8* %x1, align 1 - %main_ret = load i16, i16* %main, align 2 + store i8 %or3, ptr %x1, align 1 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__wordaccess_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__wordaccess_assignment.snap index 2e9a2e79209..89477c17cde 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__wordaccess_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__directaccess_test__wordaccess_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/directaccess_test.rs expression: prog -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ define i16 @main() { entry: %main = alloca i16, align 2 %c = alloca i32, align 4 - store i32 0, i32* %c, align 4 - store i16 0, i16* %main, align 2 - %0 = load i32, i32* %c, align 4 + store i32 0, ptr %c, align 4 + store i16 0, ptr %main, align 2 + %0 = load i32, ptr %c, align 4 %erase = and i32 %0, -65536 %or = or i32 %erase, 256 - store i32 %or, i32* %c, align 4 - %main_ret = load i16, i16* %main, align 2 + store i32 %or, ptr %c, align 4 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__access_string_via_byte_array.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__access_string_via_byte_array.snap index dc00a25e2ca..31259066bce 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__access_string_via_byte_array.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__access_string_via_byte_array.snap @@ -1,25 +1,22 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%baz = type { [11 x i8], i8*, [10 x i8]* } +%baz = type { [11 x i8], ptr, ptr } @baz_instance = global %baz zeroinitializer -define void @baz(%baz* %0) { +define void @baz(ptr %0) { entry: - %str = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 - %ptr = getelementptr inbounds %baz, %baz* %0, i32 0, i32 1 - %bytes = getelementptr inbounds %baz, %baz* %0, i32 0, i32 2 - %1 = bitcast [11 x i8]* %str to i8* - store i8* %1, i8** %ptr, align 8 - %2 = bitcast [11 x i8]* %str to [10 x i8]* - store [10 x i8]* %2, [10 x i8]** %bytes, align 8 + %str = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 + %ptr = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 1 + %bytes = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 2 + store ptr %str, ptr %ptr, align 8 + store ptr %str, ptr %bytes, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__allowed_assignable_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__allowed_assignable_types.snap index 8e5bdf249c9..6df048d6c79 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__allowed_assignable_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__allowed_assignable_types.snap @@ -1,41 +1,40 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16, [2 x i16], i16*, [2 x i16]* } +%main = type { i16, [2 x i16], ptr, ptr } @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %v = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %z = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - store i16 0, i16* %v, align 2 - %tmpVar = getelementptr inbounds [2 x i16], [2 x i16]* %x, i32 0, i32 0 - store i16 1, i16* %tmpVar, align 2 - %deref = load i16*, i16** %y, align 8 - store i16 2, i16* %deref, align 2 - %deref1 = load i16*, i16** %y, align 8 - %1 = load i16, i16* %deref1, align 2 + %v = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %z = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + store i16 0, ptr %v, align 2 + %tmpVar = getelementptr inbounds [2 x i16], ptr %x, i32 0, i32 0 + store i16 1, ptr %tmpVar, align 2 + %deref = load ptr, ptr %y, align 8 + store i16 2, ptr %deref, align 2 + %deref1 = load ptr, ptr %y, align 8 + %1 = load i16, ptr %deref1, align 2 %erase = and i16 %1, -3 %or = or i16 %erase, 6 - store i16 %or, i16* %deref1, align 2 - %deref2 = load [2 x i16]*, [2 x i16]** %z, align 8 - %tmpVar3 = getelementptr inbounds [2 x i16], [2 x i16]* %deref2, i32 0, i32 0 - store i16 4, i16* %tmpVar3, align 2 - %deref4 = load [2 x i16]*, [2 x i16]** %z, align 8 - %tmpVar5 = getelementptr inbounds [2 x i16], [2 x i16]* %deref4, i32 0, i32 1 - %2 = load i16, i16* %tmpVar5, align 2 + store i16 %or, ptr %deref1, align 2 + %deref2 = load ptr, ptr %z, align 8 + %tmpVar3 = getelementptr inbounds [2 x i16], ptr %deref2, i32 0, i32 0 + store i16 4, ptr %tmpVar3, align 2 + %deref4 = load ptr, ptr %z, align 8 + %tmpVar5 = getelementptr inbounds [2 x i16], ptr %deref4, i32 0, i32 1 + %2 = load i16, ptr %tmpVar5, align 2 %erase6 = and i16 %2, -3 %or7 = or i16 %erase6, 10 - store i16 %or7, i16* %tmpVar5, align 2 + store i16 %or7, ptr %tmpVar5, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_float.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_float.snap index 2701661b9b0..02761f41816 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_float.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_float.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,19 +14,19 @@ entry: %x2 = alloca float, align 4 %x3 = alloca float, align 4 %l1 = alloca double, align 8 - store float 0.000000e+00, float* %x1, align 4 - store float 0.000000e+00, float* %x2, align 4 - store float 0.000000e+00, float* %x3, align 4 - store double 0.000000e+00, double* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 - %load_x2 = load float, float* %x2, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store float 0.000000e+00, ptr %x2, align 4 + store float 0.000000e+00, ptr %x3, align 4 + store double 0.000000e+00, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 + %load_x2 = load float, ptr %x2, align 4 %tmpVar = fadd float %load_x1, %load_x2 - %load_x3 = load float, float* %x3, align 4 + %load_x3 = load float, ptr %x3, align 4 %tmpVar1 = fadd float %tmpVar, %load_x3 %0 = fpext float %tmpVar1 to double - %load_l1 = load double, double* %l1, align 8 + %load_l1 = load double, ptr %l1, align 8 %tmpVar2 = fadd double %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_ints.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_ints.snap index 59b07c00168..84e2b314b28 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_ints.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_ints.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,23 +15,23 @@ entry: %x3 = alloca i32, align 4 %l1 = alloca i64, align 8 %s1 = alloca i8, align 1 - store i32 0, i32* %x1, align 4 - store i32 0, i32* %x2, align 4 - store i32 0, i32* %x3, align 4 - store i64 0, i64* %l1, align 8 - store i8 0, i8* %s1, align 1 - store i32 0, i32* %main, align 4 - %load_x1 = load i32, i32* %x1, align 4 - %load_x2 = load i32, i32* %x2, align 4 + store i32 0, ptr %x1, align 4 + store i32 0, ptr %x2, align 4 + store i32 0, ptr %x3, align 4 + store i64 0, ptr %l1, align 8 + store i8 0, ptr %s1, align 1 + store i32 0, ptr %main, align 4 + %load_x1 = load i32, ptr %x1, align 4 + %load_x2 = load i32, ptr %x2, align 4 %tmpVar = add i32 %load_x1, %load_x2 - %load_x3 = load i32, i32* %x3, align 4 + %load_x3 = load i32, ptr %x3, align 4 %tmpVar1 = add i32 %tmpVar, %load_x3 %0 = sext i32 %tmpVar1 to i64 - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %tmpVar2 = add i64 %0, %load_l1 - %load_s1 = load i8, i8* %s1, align 1 + %load_s1 = load i8, ptr %s1, align 1 %1 = sext i8 %load_s1 to i64 %tmpVar3 = add i64 %tmpVar2, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_mixed.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_mixed.snap index 16a32739060..6b282d5b7df 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_mixed.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_add_mixed.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,20 +14,20 @@ entry: %x2 = alloca float, align 4 %x3 = alloca float, align 4 %l1 = alloca i64, align 8 - store float 0.000000e+00, float* %x1, align 4 - store float 0.000000e+00, float* %x2, align 4 - store float 0.000000e+00, float* %x3, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 - %load_x2 = load float, float* %x2, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store float 0.000000e+00, ptr %x2, align 4 + store float 0.000000e+00, ptr %x3, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 + %load_x2 = load float, ptr %x2, align 4 %tmpVar = fadd float %load_x1, %load_x2 - %load_x3 = load float, float* %x3, align 4 + %load_x3 = load float, ptr %x3, align 4 %tmpVar1 = fadd float %tmpVar, %load_x3 %0 = fpext float %tmpVar1 to double - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %1 = sitofp i64 %load_l1 to double %tmpVar2 = fadd double %0, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_float.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_float.snap index 1a160e40127..cb27c152a2c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_float.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_float.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,13 +12,13 @@ entry: %main = alloca i32, align 4 %x1 = alloca float, align 4 %l1 = alloca double, align 8 - store float 0.000000e+00, float* %x1, align 4 - store double 0.000000e+00, double* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store double 0.000000e+00, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 %0 = fpext float %load_x1 to double - %load_l1 = load double, double* %l1, align 8 + %load_l1 = load double, ptr %l1, align 8 %tmpVar = fdiv double %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_ints.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_ints.snap index c69b0880467..27f14efcdf3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_ints.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_ints.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,13 +12,13 @@ entry: %main = alloca i32, align 4 %x1 = alloca i32, align 4 %l1 = alloca i64, align 8 - store i32 0, i32* %x1, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load i32, i32* %x1, align 4 + store i32 0, ptr %x1, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load i32, ptr %x1, align 4 %0 = sext i32 %load_x1 to i64 - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %tmpVar = sdiv i64 %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_mixed.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_mixed.snap index eaf59af3bfd..839cc6c7958 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_mixed.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_div_mixed.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,14 +12,14 @@ entry: %main = alloca i32, align 4 %x1 = alloca float, align 4 %l1 = alloca i64, align 8 - store float 0.000000e+00, float* %x1, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 %0 = fpext float %load_x1 to double - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %1 = sitofp i64 %load_l1 to double %tmpVar = fdiv double %0, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux.snap index 54bbdcdd388..452d4345e5f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,13 +11,13 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %c = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %d = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %e = getelementptr inbounds %main, %main* %0, i32 0, i32 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %d = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %e = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 4 %1 = alloca i32, align 4 switch i32 3, label %continue_block [ i32 0, label %2 @@ -28,27 +27,27 @@ entry: ] 2: ; preds = %entry - %load_b = load i32, i32* %b, align 4 - store i32 %load_b, i32* %1, align 4 + %load_b = load i32, ptr %b, align 4 + store i32 %load_b, ptr %1, align 4 br label %continue_block 3: ; preds = %entry - %load_c = load i32, i32* %c, align 4 - store i32 %load_c, i32* %1, align 4 + %load_c = load i32, ptr %c, align 4 + store i32 %load_c, ptr %1, align 4 br label %continue_block 4: ; preds = %entry - %load_d = load i32, i32* %d, align 4 - store i32 %load_d, i32* %1, align 4 + %load_d = load i32, ptr %d, align 4 + store i32 %load_d, ptr %1, align 4 br label %continue_block 5: ; preds = %entry - %load_e = load i32, i32* %e, align 4 - store i32 %load_e, i32* %1, align 4 + %load_e = load i32, ptr %e, align 4 + store i32 %load_e, ptr %1, align 4 br label %continue_block continue_block: ; preds = %entry, %5, %4, %3, %2 - %6 = load i32, i32* %1, align 4 - store i32 %6, i32* %a, align 4 + %6 = load i32, ptr %1, align 4 + store i32 %6, ptr %a, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux_with_aggregate_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux_with_aggregate_type.snap index fafbbbb858f..5485220b844 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux_with_aggregate_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_mux_with_aggregate_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,45 +15,39 @@ target triple = "[filtered]" @utf08_literal_2 = private unnamed_addr constant [6 x i8] c"lorem\00" @utf08_literal_3 = private unnamed_addr constant [4 x i8] c"sit\00" -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %str1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %str1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %1 = alloca [81 x i8], align 1 switch i32 3, label %continue_block [ i32 0, label %2 - i32 1, label %4 - i32 2, label %6 - i32 3, label %8 + i32 1, label %3 + i32 2, label %4 + i32 3, label %5 ] 2: ; preds = %entry - %3 = bitcast [81 x i8]* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_2, i32 0, i32 0), i32 6, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %1, ptr align 1 @utf08_literal_2, i32 6, i1 false) br label %continue_block -4: ; preds = %entry - %5 = bitcast [81 x i8]* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %5, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) +3: ; preds = %entry + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %1, ptr align 1 @utf08_literal_1, i32 6, i1 false) br label %continue_block -6: ; preds = %entry - %7 = bitcast [81 x i8]* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %7, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) +4: ; preds = %entry + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %1, ptr align 1 @utf08_literal_0, i32 6, i1 false) br label %continue_block -8: ; preds = %entry - %9 = bitcast [81 x i8]* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %9, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_3, i32 0, i32 0), i32 4, i1 false) +5: ; preds = %entry + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %1, ptr align 1 @utf08_literal_3, i32 4, i1 false) br label %continue_block -continue_block: ; preds = %entry, %8, %6, %4, %2 - %10 = bitcast [81 x i8]* %str1 to i8* - %11 = bitcast [81 x i8]* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %10, i8* align 1 %11, i32 80, i1 false) +continue_block: ; preds = %entry, %5, %4, %3, %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %str1, ptr align 1 %1, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_sel_as_expression.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_sel_as_expression.snap index 8c256a2997d..4737413a878 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_sel_as_expression.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_sel_as_expression.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %c = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_b = load i32, i32* %b, align 4 - %load_c = load i32, i32* %c, align 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_b = load i32, ptr %b, align 4 + %load_c = load i32, ptr %c, align 4 %1 = select i1 true, i32 %load_c, i32 %load_b %tmpVar = add i32 %1, 10 - store i32 %tmpVar, i32* %a, align 4 + store i32 %tmpVar, ptr %a, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_upper_bound_expr.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_upper_bound_expr.snap index 074c65ee680..dd5603dc718 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_upper_bound_expr.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_function_call_upper_bound_expr.snap @@ -8,47 +8,47 @@ target datalayout = "[filtered]" target triple = "[filtered]" %main = type { [16 x i32], i32 } -%__foo_vla = type { i32*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @MY_CONST = unnamed_addr constant i32 10 @main_instance = global %main zeroinitializer @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %auto_deref = load [16 x i32], [16 x i32]* %a, align 4 - %outer_arr_gep = getelementptr inbounds [16 x i32], [16 x i32]* %a, i32 0, i32 0 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %auto_deref = load [16 x i32], ptr %a, align 4 + %outer_arr_gep = getelementptr inbounds [16 x i32], ptr %a, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [8 x i32] [i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4], [2 x i32]* %vla_dimensions_gep, align 4 - store i32* %outer_arr_gep, i32** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [8 x i32] [i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %1 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i32 @foo(%__foo_vla* %vla_struct_ptr) - store i32 %call, i32* %b, align 4 + store %__foo_vla %1, ptr %vla_struct_ptr, align 8 + %call = call i32 @foo(ptr %vla_struct_ptr) + store i32 %call, ptr %b, align 4 ret void } -define i32 @foo(%__foo_vla* %0) { +define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %vla = alloca %__foo_vla*, align 8 - store %__foo_vla* %0, %__foo_vla** %vla, align 8 - store i32 0, i32* %foo, align 4 - %deref = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim = getelementptr inbounds %__foo_vla, %__foo_vla* %deref, i32 0, i32 1 - %1 = getelementptr inbounds [2 x i32], [2 x i32]* %dim, i32 0, i32 7 - %2 = load i32, i32* %1, align 4 - store i32 %2, i32* %foo, align 4 - %deref1 = load %__foo_vla*, %__foo_vla** %vla, align 8 - %dim2 = getelementptr inbounds %__foo_vla, %__foo_vla* %deref1, i32 0, i32 1 - %3 = getelementptr inbounds [2 x i32], [2 x i32]* %dim2, i32 0, i32 7 - %4 = load i32, i32* %3, align 4 - store i32 %4, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + %vla = alloca ptr, align 8 + store ptr %0, ptr %vla, align 8 + store i32 0, ptr %foo, align 4 + %deref = load ptr, ptr %vla, align 8 + %dim = getelementptr inbounds nuw %__foo_vla, ptr %deref, i32 0, i32 1 + %1 = getelementptr inbounds [2 x i32], ptr %dim, i32 0, i32 7 + %2 = load i32, ptr %1, align 4 + store i32 %2, ptr %foo, align 4 + %deref1 = load ptr, ptr %vla, align 8 + %dim2 = getelementptr inbounds nuw %__foo_vla, ptr %deref1, i32 0, i32 1 + %3 = getelementptr inbounds [2 x i32], ptr %dim2, i32 0, i32 7 + %4 = load i32, ptr %3, align 4 + store i32 %4, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_float.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_float.snap index 6ddf786f115..92fcb599617 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_float.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_float.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,19 +14,19 @@ entry: %x2 = alloca float, align 4 %x3 = alloca float, align 4 %l1 = alloca double, align 8 - store float 0.000000e+00, float* %x1, align 4 - store float 0.000000e+00, float* %x2, align 4 - store float 0.000000e+00, float* %x3, align 4 - store double 0.000000e+00, double* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 - %load_x2 = load float, float* %x2, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store float 0.000000e+00, ptr %x2, align 4 + store float 0.000000e+00, ptr %x3, align 4 + store double 0.000000e+00, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 + %load_x2 = load float, ptr %x2, align 4 %tmpVar = fmul float %load_x1, %load_x2 - %load_x3 = load float, float* %x3, align 4 + %load_x3 = load float, ptr %x3, align 4 %tmpVar1 = fmul float %tmpVar, %load_x3 %0 = fpext float %tmpVar1 to double - %load_l1 = load double, double* %l1, align 8 + %load_l1 = load double, ptr %l1, align 8 %tmpVar2 = fmul double %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_ints.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_ints.snap index cfd9cb9b506..232d4d134ca 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_ints.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_ints.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,23 +15,23 @@ entry: %x3 = alloca i32, align 4 %l1 = alloca i64, align 8 %s1 = alloca i8, align 1 - store i32 0, i32* %x1, align 4 - store i32 0, i32* %x2, align 4 - store i32 0, i32* %x3, align 4 - store i64 0, i64* %l1, align 8 - store i8 0, i8* %s1, align 1 - store i32 0, i32* %main, align 4 - %load_x1 = load i32, i32* %x1, align 4 - %load_x2 = load i32, i32* %x2, align 4 + store i32 0, ptr %x1, align 4 + store i32 0, ptr %x2, align 4 + store i32 0, ptr %x3, align 4 + store i64 0, ptr %l1, align 8 + store i8 0, ptr %s1, align 1 + store i32 0, ptr %main, align 4 + %load_x1 = load i32, ptr %x1, align 4 + %load_x2 = load i32, ptr %x2, align 4 %tmpVar = mul i32 %load_x1, %load_x2 - %load_x3 = load i32, i32* %x3, align 4 + %load_x3 = load i32, ptr %x3, align 4 %tmpVar1 = mul i32 %tmpVar, %load_x3 %0 = sext i32 %tmpVar1 to i64 - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %tmpVar2 = mul i64 %0, %load_l1 - %load_s1 = load i8, i8* %s1, align 1 + %load_s1 = load i8, ptr %s1, align 1 %1 = sext i8 %load_s1 to i64 %tmpVar3 = mul i64 %tmpVar2, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_mixed.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_mixed.snap index 3dca5426871..aaee9aee6f1 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_mixed.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_mul_mixed.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,20 +14,20 @@ entry: %x2 = alloca float, align 4 %x3 = alloca float, align 4 %l1 = alloca i64, align 8 - store float 0.000000e+00, float* %x1, align 4 - store float 0.000000e+00, float* %x2, align 4 - store float 0.000000e+00, float* %x3, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 - %load_x2 = load float, float* %x2, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store float 0.000000e+00, ptr %x2, align 4 + store float 0.000000e+00, ptr %x3, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 + %load_x2 = load float, ptr %x2, align 4 %tmpVar = fmul float %load_x1, %load_x2 - %load_x3 = load float, float* %x3, align 4 + %load_x3 = load float, ptr %x3, align 4 %tmpVar1 = fmul float %tmpVar, %load_x3 %0 = fpext float %tmpVar1 to double - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %1 = sitofp i64 %load_l1 to double %tmpVar2 = fmul double %0, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_float.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_float.snap index 3f77b3c1b28..22c457efa39 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_float.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_float.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,13 +12,13 @@ entry: %main = alloca i32, align 4 %x1 = alloca float, align 4 %l1 = alloca double, align 8 - store float 0.000000e+00, float* %x1, align 4 - store double 0.000000e+00, double* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store double 0.000000e+00, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 %0 = fpext float %load_x1 to double - %load_l1 = load double, double* %l1, align 8 + %load_l1 = load double, ptr %l1, align 8 %tmpVar = fsub double %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_ints.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_ints.snap index 53dbc27765f..cb3e72b025c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_ints.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_ints.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,13 +12,13 @@ entry: %main = alloca i32, align 4 %x1 = alloca i32, align 4 %l1 = alloca i64, align 8 - store i32 0, i32* %x1, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load i32, i32* %x1, align 4 + store i32 0, ptr %x1, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load i32, ptr %x1, align 4 %0 = sext i32 %load_x1 to i64 - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %tmpVar = sub i64 %0, %load_l1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_mixed.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_mixed.snap index 474d64aae76..4bac2c6a4e5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_mixed.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__builtin_sub_mixed.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,14 +12,14 @@ entry: %main = alloca i32, align 4 %x1 = alloca float, align 4 %l1 = alloca i64, align 8 - store float 0.000000e+00, float* %x1, align 4 - store i64 0, i64* %l1, align 8 - store i32 0, i32* %main, align 4 - %load_x1 = load float, float* %x1, align 4 + store float 0.000000e+00, ptr %x1, align 4 + store i64 0, ptr %l1, align 8 + store i32 0, ptr %main, align 4 + %load_x1 = load float, ptr %x1, align 4 %0 = fpext float %load_x1 to double - %load_l1 = load i64, i64* %l1, align 8 + %load_l1 = load i64, ptr %l1, align 8 %1 = sitofp i64 %load_l1 to double %tmpVar = fsub double %0, %1 - %main_ret = load i32, i32* %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__calling_strings_in_function_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__calling_strings_in_function_return.snap index e66c9de1046..34e828ce53c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__calling_strings_in_function_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__calling_strings_in_function_return.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,34 +12,30 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -define void @func(i8* %0) { +define void @func(ptr %0) { entry: - %func = alloca i8*, align 8 - store i8* %0, i8** %func, align 8 - %deref = load i8*, i8** %func, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %func = alloca ptr, align 8 + store ptr %0, ptr %func, align 8 + %deref = load ptr, ptr %func, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %__func0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__func0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__func0 to i8* - call void @func(i8* %2) - %3 = bitcast [81 x i8]* %x to i8* - %4 = bitcast [81 x i8]* %__func0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__func0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @func(ptr %__func0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %x, ptr align 1 %__func0, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_between_pointer_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_between_pointer_types.snap index 65efa9a8b22..5d6e6bd2964 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_between_pointer_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_between_pointer_types.snap @@ -1,22 +1,20 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%baz = type { i8*, i16 } +%baz = type { ptr, i16 } @baz_instance = global %baz zeroinitializer -define void @baz(%baz* %0) { +define void @baz(ptr %0) { entry: - %ptr_x = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 - %y = getelementptr inbounds %baz, %baz* %0, i32 0, i32 1 - %1 = bitcast i16* %y to i8* - store i8* %1, i8** %ptr_x, align 8 + %ptr_x = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 1 + store ptr %y, ptr %ptr_x, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_lword_to_pointer.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_lword_to_pointer.snap index f5abb26bb98..ea252191961 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_lword_to_pointer.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_lword_to_pointer.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,14 +10,14 @@ target triple = "[filtered]" define i16 @baz() { entry: %baz = alloca i16, align 2 - %ptr_x = alloca i16*, align 8 + %ptr_x = alloca ptr, align 8 %y = alloca i64, align 8 - store i16* null, i16** %ptr_x, align 8 - store i64 0, i64* %y, align 8 - store i16 0, i16* %baz, align 2 - %load_y = load i64, i64* %y, align 8 - %0 = inttoptr i64 %load_y to i16* - store i16* %0, i16** %ptr_x, align 8 - %baz_ret = load i16, i16* %baz, align 2 + store ptr null, ptr %ptr_x, align 8 + store i64 0, ptr %y, align 8 + store i16 0, ptr %baz, align 2 + %load_y = load i64, ptr %y, align 8 + %0 = inttoptr i64 %load_y to ptr + store ptr %0, ptr %ptr_x, align 8 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_pointer_to_lword.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_pointer_to_lword.snap index b3924c389a9..314df566476 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_pointer_to_lword.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__cast_pointer_to_lword.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,14 +10,14 @@ target triple = "[filtered]" define i16 @baz() { entry: %baz = alloca i16, align 2 - %ptr_x = alloca i16*, align 8 + %ptr_x = alloca ptr, align 8 %y = alloca i64, align 8 - store i16* null, i16** %ptr_x, align 8 - store i64 0, i64* %y, align 8 - store i16 0, i16* %baz, align 2 - %load_ptr_x = load i16*, i16** %ptr_x, align 8 - %0 = ptrtoint i16* %load_ptr_x to i64 - store i64 %0, i64* %y, align 8 - %baz_ret = load i16, i16* %baz, align 2 + store ptr null, ptr %ptr_x, align 8 + store i64 0, ptr %y, align 8 + store i16 0, ptr %baz, align 2 + %load_ptr_x = load ptr, ptr %ptr_x, align 8 + %0 = ptrtoint ptr %load_ptr_x to i64 + store i64 %0, ptr %y, align 8 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__compare_date_time_literals.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__compare_date_time_literals.snap index d2434cc9bd2..d0b9517de9c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__compare_date_time_literals.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__compare_date_time_literals.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,7 +11,7 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %cmp1 = alloca i8, align 1 %cmp2 = alloca i8, align 1 @@ -22,21 +21,21 @@ entry: %cmp6 = alloca i8, align 1 %cmp7 = alloca i8, align 1 %cmp8 = alloca i8, align 1 - store i8 0, i8* %cmp1, align 1 - store i8 0, i8* %cmp2, align 1 - store i8 0, i8* %cmp3, align 1 - store i8 0, i8* %cmp4, align 1 - store i8 0, i8* %cmp5, align 1 - store i8 0, i8* %cmp6, align 1 - store i8 0, i8* %cmp7, align 1 - store i8 0, i8* %cmp8, align 1 - store i8 0, i8* %cmp1, align 1 - store i8 1, i8* %cmp2, align 1 - store i8 0, i8* %cmp3, align 1 - store i8 1, i8* %cmp4, align 1 - store i8 0, i8* %cmp5, align 1 - store i8 1, i8* %cmp6, align 1 - store i8 0, i8* %cmp7, align 1 - store i8 1, i8* %cmp8, align 1 + store i8 0, ptr %cmp1, align 1 + store i8 0, ptr %cmp2, align 1 + store i8 0, ptr %cmp3, align 1 + store i8 0, ptr %cmp4, align 1 + store i8 0, ptr %cmp5, align 1 + store i8 0, ptr %cmp6, align 1 + store i8 0, ptr %cmp7, align 1 + store i8 0, ptr %cmp8, align 1 + store i8 0, ptr %cmp1, align 1 + store i8 1, ptr %cmp2, align 1 + store i8 0, ptr %cmp3, align 1 + store i8 1, ptr %cmp4, align 1 + store i8 0, ptr %cmp5, align 1 + store i8 1, ptr %cmp6, align 1 + store i8 0, ptr %cmp7, align 1 + store i8 1, ptr %cmp8, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__max_int.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__max_int.snap index 72e6e9d7f07..c1772539b58 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__max_int.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__max_int.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,27 +10,26 @@ target triple = "[filtered]" define i16 @main() { entry: %main = alloca i16, align 2 - store i16 0, i16* %main, align 2 + store i16 0, ptr %main, align 2 %0 = alloca [7 x i16], align 2 - %1 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 0 - store i16 5, i16* %1, align 2 - %2 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 1 - store i16 2, i16* %2, align 2 - %3 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 2 - store i16 1, i16* %3, align 2 - %4 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 3 - store i16 3, i16* %4, align 2 - %5 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 4 - store i16 4, i16* %5, align 2 - %6 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 5 - store i16 7, i16* %6, align 2 - %7 = getelementptr inbounds [7 x i16], [7 x i16]* %0, i32 0, i32 6 - store i16 -1, i16* %7, align 2 - %8 = bitcast [7 x i16]* %0 to i16* - %call = call i16 @MAX__INT(i32 7, i16* %8) - store i16 %call, i16* %main, align 2 - %main_ret = load i16, i16* %main, align 2 + %1 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 0 + store i16 5, ptr %1, align 2 + %2 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 1 + store i16 2, ptr %2, align 2 + %3 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 2 + store i16 1, ptr %3, align 2 + %4 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 3 + store i16 3, ptr %4, align 2 + %5 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 4 + store i16 4, ptr %5, align 2 + %6 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 5 + store i16 7, ptr %6, align 2 + %7 = getelementptr inbounds [7 x i16], ptr %0, i32 0, i32 6 + store i16 -1, ptr %7, align 2 + %call = call i16 @MAX__INT(i32 7, ptr %0) + store i16 %call, ptr %main, align 2 + %main_ret = load i16, ptr %main, align 2 ret i16 %main_ret } -declare i16 @MAX__INT(i32, i16*) +declare i16 @MAX__INT(i32, ptr) diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__nested_call_statements.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__nested_call_statements.snap index eec1c96c3a5..3c17b0636e0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__nested_call_statements.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__nested_call_statements.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,13 +15,13 @@ define i32 @foo(i32 %0) { entry: %foo = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %0, i32* %a, align 4 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %a, align 4 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %call = call i32 @foo(i32 2) %call1 = call i32 @foo(i32 %call) diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics.snap index 9c16959f23a..370cab433c8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics.snap @@ -1,65 +1,64 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16, i16, i16* } +%main = type { i16, i16, ptr } -@main_instance = global %main { i16 10, i16 20, i16* null } +@main_instance = global %main { i16 10, i16 20, ptr null } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %pt = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - store i16* %x, i16** %pt, align 8 - %load_pt = load i16*, i16** %pt, align 8 - %access___main_pt = getelementptr inbounds i16, i16* %load_pt, i32 1 - store i16* %access___main_pt, i16** %pt, align 8 - %load_pt1 = load i16*, i16** %pt, align 8 - %access___main_pt2 = getelementptr inbounds i16, i16* %load_pt1, i32 1 - %access___main_pt3 = getelementptr inbounds i16, i16* %access___main_pt2, i32 1 - store i16* %access___main_pt3, i16** %pt, align 8 - %load_pt4 = load i16*, i16** %pt, align 8 - %access___main_pt5 = getelementptr inbounds i16, i16* %load_pt4, i32 1 - store i16* %access___main_pt5, i16** %pt, align 8 - %load_pt6 = load i16*, i16** %pt, align 8 - %load_y = load i16, i16* %y, align 2 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %pt = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + store ptr %x, ptr %pt, align 8 + %load_pt = load ptr, ptr %pt, align 8 + %access___main_pt = getelementptr inbounds i16, ptr %load_pt, i32 1 + store ptr %access___main_pt, ptr %pt, align 8 + %load_pt1 = load ptr, ptr %pt, align 8 + %access___main_pt2 = getelementptr inbounds i16, ptr %load_pt1, i32 1 + %access___main_pt3 = getelementptr inbounds i16, ptr %access___main_pt2, i32 1 + store ptr %access___main_pt3, ptr %pt, align 8 + %load_pt4 = load ptr, ptr %pt, align 8 + %access___main_pt5 = getelementptr inbounds i16, ptr %load_pt4, i32 1 + store ptr %access___main_pt5, ptr %pt, align 8 + %load_pt6 = load ptr, ptr %pt, align 8 + %load_y = load i16, ptr %y, align 2 %1 = sub i16 0, %load_y - %access___main_pt7 = getelementptr inbounds i16, i16* %load_pt6, i16 %1 - store i16* %access___main_pt7, i16** %pt, align 8 - %load_pt8 = load i16*, i16** %pt, align 8 - %access___main_pt9 = getelementptr inbounds i16, i16* %load_pt8, i32 1 - %access___main_pt10 = getelementptr inbounds i16, i16* %access___main_pt9, i32 1 - store i16* %access___main_pt10, i16** %pt, align 8 - %load_pt11 = load i16*, i16** %pt, align 8 - %load_y12 = load i16, i16* %y, align 2 + %access___main_pt7 = getelementptr inbounds i16, ptr %load_pt6, i16 %1 + store ptr %access___main_pt7, ptr %pt, align 8 + %load_pt8 = load ptr, ptr %pt, align 8 + %access___main_pt9 = getelementptr inbounds i16, ptr %load_pt8, i32 1 + %access___main_pt10 = getelementptr inbounds i16, ptr %access___main_pt9, i32 1 + store ptr %access___main_pt10, ptr %pt, align 8 + %load_pt11 = load ptr, ptr %pt, align 8 + %load_y12 = load i16, ptr %y, align 2 %2 = sub i16 0, %load_y12 - %access___main_pt13 = getelementptr inbounds i16, i16* %load_pt11, i16 %2 - %access___main_pt14 = getelementptr inbounds i16, i16* %access___main_pt13, i32 -1 - store i16* %access___main_pt14, i16** %pt, align 8 - %load_pt15 = load i16*, i16** %pt, align 8 - %access___main_pt16 = getelementptr inbounds i16, i16* %load_pt15, i32 2 - store i16* %access___main_pt16, i16** %pt, align 8 - %load_y17 = load i16, i16* %y, align 2 - %load_pt18 = load i16*, i16** %pt, align 8 - %access___main_pt19 = getelementptr inbounds i16, i16* %load_pt18, i16 %load_y17 - %load_y20 = load i16, i16* %y, align 2 + %access___main_pt13 = getelementptr inbounds i16, ptr %load_pt11, i16 %2 + %access___main_pt14 = getelementptr inbounds i16, ptr %access___main_pt13, i32 -1 + store ptr %access___main_pt14, ptr %pt, align 8 + %load_pt15 = load ptr, ptr %pt, align 8 + %access___main_pt16 = getelementptr inbounds i16, ptr %load_pt15, i32 2 + store ptr %access___main_pt16, ptr %pt, align 8 + %load_y17 = load i16, ptr %y, align 2 + %load_pt18 = load ptr, ptr %pt, align 8 + %access___main_pt19 = getelementptr inbounds i16, ptr %load_pt18, i16 %load_y17 + %load_y20 = load i16, ptr %y, align 2 %3 = sub i16 0, %load_y20 - %access___main_pt21 = getelementptr inbounds i16, i16* %access___main_pt19, i16 %3 - store i16* %access___main_pt21, i16** %pt, align 8 - %load_y22 = load i16, i16* %y, align 2 + %access___main_pt21 = getelementptr inbounds i16, ptr %access___main_pt19, i16 %3 + store ptr %access___main_pt21, ptr %pt, align 8 + %load_y22 = load i16, ptr %y, align 2 %4 = sext i16 %load_y22 to i32 - %load_y23 = load i16, i16* %y, align 2 + %load_y23 = load i16, ptr %y, align 2 %5 = sext i16 %load_y23 to i32 %tmpVar = add i32 %4, %5 - %load_pt24 = load i16*, i16** %pt, align 8 - %access___main_pt25 = getelementptr inbounds i16, i16* %load_pt24, i32 %tmpVar - store i16* %access___main_pt25, i16** %pt, align 8 + %load_pt24 = load ptr, ptr %pt, align 8 + %access___main_pt25 = getelementptr inbounds i16, ptr %load_pt24, i32 %tmpVar + store ptr %access___main_pt25, ptr %pt, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics_function_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics_function_call.snap index c629ccd91b6..65cf973c13a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics_function_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointer_arithmetics_function_call.snap @@ -1,33 +1,32 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { i16*, i16 } +%main = type { ptr, i16 } @main_instance = global %main zeroinitializer define i64 @foo() { entry: %foo = alloca i64, align 8 - store i64 0, i64* %foo, align 8 - %foo_ret = load i64, i64* %foo, align 8 + store i64 0, ptr %foo, align 8 + %foo_ret = load i64, ptr %foo, align 8 ret i64 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %pt = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store i16* %x, i16** %pt, align 8 - %load_pt = load i16*, i16** %pt, align 8 + %pt = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store ptr %x, ptr %pt, align 8 + %load_pt = load ptr, ptr %pt, align 8 %call = call i64 @foo() - %access___main_pt = getelementptr inbounds i16, i16* %load_pt, i64 %call - store i16* %access___main_pt, i16** %pt, align 8 + %access___main_pt = getelementptr inbounds i16, ptr %load_pt, i64 %call + store ptr %access___main_pt, ptr %pt, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointers_in_function_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointers_in_function_return.snap index 8df22cc5ee0..b288716ad3f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointers_in_function_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__pointers_in_function_return.snap @@ -1,17 +1,16 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i16* @func() { +define ptr @func() { entry: - %func = alloca i16*, align 8 - store i16* null, i16** %func, align 8 - %func_ret = load i16*, i16** %func, align 8 - ret i16* %func_ret + %func = alloca ptr, align 8 + store ptr null, ptr %func, align 8 + %func_ret = load ptr, ptr %func, align 8 + ret ptr %func_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__strings_in_function_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__strings_in_function_return.snap index 8c555e4de0f..b7ee42c2a5f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__strings_in_function_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__strings_in_function_return.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,21 +9,20 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -define void @func(i8* %0, [81 x i8]* %1) { +define void @func(ptr %0, ptr %1) { entry: - %func = alloca i8*, align 8 - store i8* %0, i8** %func, align 8 - %myout = alloca [81 x i8]*, align 8 - store [81 x i8]* %1, [81 x i8]** %myout, align 8 - %deref = load i8*, i8** %func, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %deref1 = load [81 x i8]*, [81 x i8]** %myout, align 8 - %2 = bitcast [81 x i8]* %deref1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %func = alloca ptr, align 8 + store ptr %0, ptr %func, align 8 + %myout = alloca ptr, align 8 + store ptr %1, ptr %myout, align 8 + %deref = load ptr, ptr %func, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %deref1 = load ptr, ptr %myout, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref1, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__structs_in_function_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__structs_in_function_return.snap index d77b542920f..f1cea470b92 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__structs_in_function_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__structs_in_function_return.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer -define void @func(%myStruct* %0, %myStruct* %1) { +define void @func(ptr %0, ptr %1) { entry: - %func = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %func, align 8 - %xxx = alloca %myStruct*, align 8 - store %myStruct* %1, %myStruct** %xxx, align 8 + %func = alloca ptr, align 8 + store ptr %0, ptr %func, align 8 + %xxx = alloca ptr, align 8 + store ptr %1, ptr %xxx, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__type_mix_in_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__type_mix_in_call.snap index 043ac4293ac..ecb9bc5fc75 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__type_mix_in_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__type_mix_in_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,17 +11,17 @@ define i16 @foo(i16 %0) { entry: %foo = alloca i16, align 2 %in = alloca i16, align 2 - store i16 %0, i16* %in, align 2 - store i16 0, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + store i16 %0, ptr %in, align 2 + store i16 0, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } define i16 @baz() { entry: %baz = alloca i16, align 2 - store i16 0, i16* %baz, align 2 + store i16 0, ptr %baz, align 2 %call = call i16 @foo(i16 1) - %baz_ret = load i16, i16* %baz, align 2 + %baz_ret = load i16, ptr %baz, align 2 ret i16 %baz_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unary_expressions_can_be_real.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unary_expressions_can_be_real.snap index 86debc2c1cf..7584eee7ca0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unary_expressions_can_be_real.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unary_expressions_can_be_real.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,13 +11,13 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - store float -2.000000e+00, float* %b, align 4 - %load_b = load float, float* %b, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + store float -2.000000e+00, ptr %b, align 4 + %load_b = load float, ptr %b, align 4 %tmpVar = fneg float %load_b - store float %tmpVar, float* %a, align 4 + store float %tmpVar, ptr %a, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unnecessary_casts_between_pointer_types.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unnecessary_casts_between_pointer_types.snap index f79941fd0f1..86c97c3c089 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unnecessary_casts_between_pointer_types.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__expression_tests__unnecessary_casts_between_pointer_types.snap @@ -1,25 +1,24 @@ --- source: src/codegen/tests/expression_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%baz = type { i8*, i8, i8, i8 } +%baz = type { ptr, i8, i8, i8 } @baz_instance = global %baz zeroinitializer -define void @baz(%baz* %0) { +define void @baz(ptr %0) { entry: - %ptr = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 - %b = getelementptr inbounds %baz, %baz* %0, i32 0, i32 1 - %si = getelementptr inbounds %baz, %baz* %0, i32 0, i32 2 - %mb = getelementptr inbounds %baz, %baz* %0, i32 0, i32 3 - store i8* %b, i8** %ptr, align 8 - store i8* %si, i8** %ptr, align 8 - store i8* %mb, i8** %ptr, align 8 + %ptr = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 1 + %si = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 2 + %mb = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 3 + store ptr %b, ptr %ptr, align 8 + store ptr %si, ptr %ptr, align 8 + store ptr %mb, ptr %ptr, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__argument_fed_by_ref_then_by_val.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__argument_fed_by_ref_then_by_val.snap index feada78fd27..c02bee2c95e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__argument_fed_by_ref_then_by_val.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__argument_fed_by_ref_then_by_val.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,45 +11,40 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [5 x i32], align 4 - %0 = bitcast [5 x i32]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([5 x i32]* getelementptr ([5 x i32], [5 x i32]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %1 = bitcast [5 x i32]* %arr to i32* - %call = call i32 @fn_by_ref(i32* %1) - %main_ret = load i32, i32* %main, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([5 x i32], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %call = call i32 @fn_by_ref(ptr %arr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -define i32 @fn_by_ref(i32* %0) { +define i32 @fn_by_ref(ptr %0) { entry: %fn_by_ref = alloca i32, align 4 - %arg_by_ref = alloca i32*, align 8 - store i32* %0, i32** %arg_by_ref, align 8 - store i32 0, i32* %fn_by_ref, align 4 - %deref = load i32*, i32** %arg_by_ref, align 8 - %call = call i32 @fn_by_val(i32* %deref) - %fn_by_ref_ret = load i32, i32* %fn_by_ref, align 4 + %arg_by_ref = alloca ptr, align 8 + store ptr %0, ptr %arg_by_ref, align 8 + store i32 0, ptr %fn_by_ref, align 4 + %deref = load ptr, ptr %arg_by_ref, align 8 + %call = call i32 @fn_by_val(ptr %deref) + %fn_by_ref_ret = load i32, ptr %fn_by_ref, align 4 ret i32 %fn_by_ref_ret } -define i32 @fn_by_val(i32* %0) { +define i32 @fn_by_val(ptr %0) { entry: %fn_by_val = alloca i32, align 4 %arg_by_val = alloca [5 x i32], align 4 - %bitcast = bitcast [5 x i32]* %arg_by_val to i32* - %1 = bitcast i32* %bitcast to i8* - %2 = bitcast i32* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint ([5 x i32]* getelementptr ([5 x i32], [5 x i32]* null, i32 1) to i64), i1 false) - store i32 0, i32* %fn_by_val, align 4 - %fn_by_val_ret = load i32, i32* %fn_by_val, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arg_by_val, ptr align 1 %0, i64 ptrtoint (ptr getelementptr ([5 x i32], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %fn_by_val, align 4 + %fn_by_val_ret = load i32, ptr %fn_by_val, align 4 ret i32 %fn_by_val_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__autocast_argument_literals_for_function_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__autocast_argument_literals_for_function_call.snap index 525fbc99b66..37650f38ed8 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__autocast_argument_literals_for_function_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__autocast_argument_literals_for_function_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,41 +11,41 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @func(i8* %0, i16* %1, i32* %2, i64* %3, float* %4, double* %5) { +define i32 @func(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5) { entry: %func = alloca i32, align 4 - %byInt1 = alloca i8*, align 8 - store i8* %0, i8** %byInt1, align 8 - %byInt2 = alloca i16*, align 8 - store i16* %1, i16** %byInt2, align 8 - %byInt3 = alloca i32*, align 8 - store i32* %2, i32** %byInt3, align 8 - %byInt4 = alloca i64*, align 8 - store i64* %3, i64** %byInt4, align 8 - %byReal1 = alloca float*, align 8 - store float* %4, float** %byReal1, align 8 - %byReal2 = alloca double*, align 8 - store double* %5, double** %byReal2, align 8 - store i32 0, i32* %func, align 4 - store i32 1, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + %byInt1 = alloca ptr, align 8 + store ptr %0, ptr %byInt1, align 8 + %byInt2 = alloca ptr, align 8 + store ptr %1, ptr %byInt2, align 8 + %byInt3 = alloca ptr, align 8 + store ptr %2, ptr %byInt3, align 8 + %byInt4 = alloca ptr, align 8 + store ptr %3, ptr %byInt4, align 8 + %byReal1 = alloca ptr, align 8 + store ptr %4, ptr %byReal1, align 8 + %byReal2 = alloca ptr, align 8 + store ptr %5, ptr %byReal2, align 8 + store i32 0, ptr %func, align 4 + store i32 1, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %1 = alloca i8, align 1 - store i8 1, i8* %1, align 1 + store i8 1, ptr %1, align 1 %2 = alloca i16, align 2 - store i16 2, i16* %2, align 2 + store i16 2, ptr %2, align 2 %3 = alloca i32, align 4 - store i32 3, i32* %3, align 4 + store i32 3, ptr %3, align 4 %4 = alloca i64, align 8 - store i64 4, i64* %4, align 8 + store i64 4, ptr %4, align 8 %5 = alloca float, align 4 - store float 5.000000e+00, float* %5, align 4 + store float 5.000000e+00, ptr %5, align 4 %6 = alloca double, align 8 - store double 6.000000e+00, double* %6, align 8 - %call = call i32 @func(i8* %1, i16* %2, i32* %3, i64* %4, float* %5, double* %6) + store double 6.000000e+00, ptr %6, align 8 + %call = call i32 @func(ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__bitcast_argument_references_for_function_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__bitcast_argument_references_for_function_call.snap index 90a480f3f89..6bdcf2f13ea 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__bitcast_argument_references_for_function_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__bitcast_argument_references_for_function_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,95 +11,79 @@ target triple = "[filtered]" @main_instance = global %main { i8 1, i8 1, i16 2, i16 2, i32 3, i32 3, i64 4, i64 4, float 5.000000e+00, float 5.000000e+00, double 6.000000e+00, double 6.000000e+00 } -define i8 @fn_sint(i8* %0, i8* %1) { +define i8 @fn_sint(ptr %0, ptr %1) { entry: %fn_sint = alloca i8, align 1 - %in_ref = alloca i8*, align 8 - store i8* %0, i8** %in_ref, align 8 - %in_out = alloca i8*, align 8 - store i8* %1, i8** %in_out, align 8 - store i8 0, i8* %fn_sint, align 1 - %fn_sint_ret = load i8, i8* %fn_sint, align 1 + %in_ref = alloca ptr, align 8 + store ptr %0, ptr %in_ref, align 8 + %in_out = alloca ptr, align 8 + store ptr %1, ptr %in_out, align 8 + store i8 0, ptr %fn_sint, align 1 + %fn_sint_ret = load i8, ptr %fn_sint, align 1 ret i8 %fn_sint_ret } -define i64 @fn_lint(i64* %0, i64* %1) { +define i64 @fn_lint(ptr %0, ptr %1) { entry: %fn_lint = alloca i64, align 8 - %in_ref = alloca i64*, align 8 - store i64* %0, i64** %in_ref, align 8 - %in_out = alloca i64*, align 8 - store i64* %1, i64** %in_out, align 8 - store i64 0, i64* %fn_lint, align 8 - %fn_lint_ret = load i64, i64* %fn_lint, align 8 + %in_ref = alloca ptr, align 8 + store ptr %0, ptr %in_ref, align 8 + %in_out = alloca ptr, align 8 + store ptr %1, ptr %in_out, align 8 + store i64 0, ptr %fn_lint, align 8 + %fn_lint_ret = load i64, ptr %fn_lint, align 8 ret i64 %fn_lint_ret } -define i64 @fn_real(float* %0, float* %1) { +define i64 @fn_real(ptr %0, ptr %1) { entry: %fn_real = alloca i64, align 8 - %in_ref = alloca float*, align 8 - store float* %0, float** %in_ref, align 8 - %in_out = alloca float*, align 8 - store float* %1, float** %in_out, align 8 - store i64 0, i64* %fn_real, align 8 - %fn_real_ret = load i64, i64* %fn_real, align 8 + %in_ref = alloca ptr, align 8 + store ptr %0, ptr %in_ref, align 8 + %in_out = alloca ptr, align 8 + store ptr %1, ptr %in_out, align 8 + store i64 0, ptr %fn_real, align 8 + %fn_real_ret = load i64, ptr %fn_real, align 8 ret i64 %fn_real_ret } -define i64 @fn_lreal(double* %0, double* %1) { +define i64 @fn_lreal(ptr %0, ptr %1) { entry: %fn_lreal = alloca i64, align 8 - %in_ref = alloca double*, align 8 - store double* %0, double** %in_ref, align 8 - %in_out = alloca double*, align 8 - store double* %1, double** %in_out, align 8 - store i64 0, i64* %fn_lreal, align 8 - %fn_lreal_ret = load i64, i64* %fn_lreal, align 8 + %in_ref = alloca ptr, align 8 + store ptr %0, ptr %in_ref, align 8 + %in_out = alloca ptr, align 8 + store ptr %1, ptr %in_out, align 8 + store i64 0, ptr %fn_lreal, align 8 + %fn_lreal_ret = load i64, ptr %fn_lreal, align 8 ret i64 %fn_lreal_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1_sint = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2_sint = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var1_int = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %var2_int = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %var1_dint = getelementptr inbounds %main, %main* %0, i32 0, i32 4 - %var2_dint = getelementptr inbounds %main, %main* %0, i32 0, i32 5 - %var1_lint = getelementptr inbounds %main, %main* %0, i32 0, i32 6 - %var2_lint = getelementptr inbounds %main, %main* %0, i32 0, i32 7 - %var1_real = getelementptr inbounds %main, %main* %0, i32 0, i32 8 - %var2_real = getelementptr inbounds %main, %main* %0, i32 0, i32 9 - %var1_lreal = getelementptr inbounds %main, %main* %0, i32 0, i32 10 - %var2_lreal = getelementptr inbounds %main, %main* %0, i32 0, i32 11 - %call = call i8 @fn_sint(i8* %var1_sint, i8* %var2_sint) - %1 = bitcast i16* %var1_int to i8* - %2 = bitcast i16* %var2_int to i8* - %call1 = call i8 @fn_sint(i8* %1, i8* %2) - %3 = bitcast i32* %var1_dint to i8* - %4 = bitcast i32* %var2_dint to i8* - %call2 = call i8 @fn_sint(i8* %3, i8* %4) - %5 = bitcast i64* %var1_lint to i8* - %6 = bitcast i64* %var2_lint to i8* - %call3 = call i8 @fn_sint(i8* %5, i8* %6) - %7 = bitcast i8* %var1_sint to i64* - %8 = bitcast i8* %var2_sint to i64* - %call4 = call i64 @fn_lint(i64* %7, i64* %8) - %9 = bitcast i16* %var1_int to i64* - %10 = bitcast i16* %var2_int to i64* - %call5 = call i64 @fn_lint(i64* %9, i64* %10) - %11 = bitcast i32* %var1_dint to i64* - %12 = bitcast i32* %var2_dint to i64* - %call6 = call i64 @fn_lint(i64* %11, i64* %12) - %call7 = call i64 @fn_lint(i64* %var1_lint, i64* %var2_lint) - %call8 = call i64 @fn_real(float* %var1_real, float* %var2_real) - %13 = bitcast double* %var1_lreal to float* - %14 = bitcast double* %var2_lreal to float* - %call9 = call i64 @fn_real(float* %13, float* %14) - %15 = bitcast float* %var1_real to double* - %16 = bitcast float* %var2_real to double* - %call10 = call i64 @fn_lreal(double* %15, double* %16) - %call11 = call i64 @fn_lreal(double* %var1_lreal, double* %var2_lreal) + %var1_sint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2_sint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var1_int = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %var2_int = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + %var1_dint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 4 + %var2_dint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 5 + %var1_lint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 6 + %var2_lint = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 7 + %var1_real = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 8 + %var2_real = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 9 + %var1_lreal = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 10 + %var2_lreal = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 11 + %call = call i8 @fn_sint(ptr %var1_sint, ptr %var2_sint) + %call1 = call i8 @fn_sint(ptr %var1_int, ptr %var2_int) + %call2 = call i8 @fn_sint(ptr %var1_dint, ptr %var2_dint) + %call3 = call i8 @fn_sint(ptr %var1_lint, ptr %var2_lint) + %call4 = call i64 @fn_lint(ptr %var1_sint, ptr %var2_sint) + %call5 = call i64 @fn_lint(ptr %var1_int, ptr %var2_int) + %call6 = call i64 @fn_lint(ptr %var1_dint, ptr %var2_dint) + %call7 = call i64 @fn_lint(ptr %var1_lint, ptr %var2_lint) + %call8 = call i64 @fn_real(ptr %var1_real, ptr %var2_real) + %call9 = call i64 @fn_real(ptr %var1_lreal, ptr %var2_lreal) + %call10 = call i64 @fn_lreal(ptr %var1_real, ptr %var2_real) + %call11 = call i64 @fn_lreal(ptr %var1_lreal, ptr %var2_lreal) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_call_with_array_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_call_with_array_access.snap index 0dec905aa79..77312918ed3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_call_with_array_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_call_with_array_access.snap @@ -1,38 +1,35 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define void @foo(i32* %0) { +define void @foo(ptr %0) { entry: - %foo = alloca i32*, align 8 - store i32* %0, i32** %foo, align 8 - %deref = load i32*, i32** %foo, align 8 - store [5 x i32] [i32 5, i32 4, i32 3, i32 2, i32 1], i32* %deref, align 4 + %foo = alloca ptr, align 8 + store ptr %0, ptr %foo, align 8 + %deref = load ptr, ptr %foo, align 8 + store [5 x i32] [i32 5, i32 4, i32 3, i32 2, i32 1], ptr %deref, align 4 ret void } define void @main() { entry: %value = alloca i32, align 4 - store i32 0, i32* %value, align 4 + store i32 0, ptr %value, align 4 %__foo0 = alloca [5 x i32], align 4 - %0 = bitcast [5 x i32]* %__foo0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([5 x i32]* getelementptr ([5 x i32], [5 x i32]* null, i32 1) to i64), i1 false) - %1 = bitcast [5 x i32]* %__foo0 to i32* - call void @foo(i32* %1) - %tmpVar = getelementptr inbounds [5 x i32], [5 x i32]* %__foo0, i32 0, i32 2 - %load_tmpVar = load i32, i32* %tmpVar, align 4 - store i32 %load_tmpVar, i32* %value, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %__foo0, i8 0, i64 ptrtoint (ptr getelementptr ([5 x i32], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %__foo0) + %tmpVar = getelementptr inbounds [5 x i32], ptr %__foo0, i32 0, i32 2 + %load_tmpVar = load i32, ptr %tmpVar, align 4 + store i32 %load_tmpVar, ptr %value, align 4 ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_ref_sized_string_varargs_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_ref_sized_string_varargs_called_in_program.snap index 1fa8f783e47..029efb4a32e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_ref_sized_string_varargs_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_ref_sized_string_varargs_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,20 +14,19 @@ target triple = "[filtered]" @utf08_literal_1 = private unnamed_addr constant [4 x i8] c"abc\00" @utf08_literal_2 = private unnamed_addr constant [7 x i8] c"abcdef\00" -declare i32 @foo(i32, i8**) +declare i32 @foo(i32, ptr) -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %1 = alloca [3 x i8*], align 8 - %2 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i32 0, i32 0 - store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0), i8** %2, align 8 - %3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i32 0, i32 1 - store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_1, i32 0, i32 0), i8** %3, align 8 - %4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i32 0, i32 2 - store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @utf08_literal_2, i32 0, i32 0), i8** %4, align 8 - %5 = bitcast [3 x i8*]* %1 to i8** - %call = call i32 @foo(i32 3, i8** %5) - store i32 %call, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %1 = alloca [3 x ptr], align 8 + %2 = getelementptr inbounds [3 x ptr], ptr %1, i32 0, i32 0 + store ptr @utf08_literal_0, ptr %2, align 8 + %3 = getelementptr inbounds [3 x ptr], ptr %1, i32 0, i32 1 + store ptr @utf08_literal_1, ptr %3, align 8 + %4 = getelementptr inbounds [3 x ptr], ptr %1, i32 0, i32 2 + store ptr @utf08_literal_2, ptr %4, align 8 + %call = call i32 @foo(i32 3, ptr %1) + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_sized_varargs_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_sized_varargs_called_in_program.snap index 5d9d1419644..bd1a51a9ffe 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_sized_varargs_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_sized_varargs_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,22 +11,21 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -declare i32 @foo(i32, i32*) +declare i32 @foo(i32, ptr) -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 1 %1 = alloca [3 x i32], align 4 - %2 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i32 0, i32 0 - store i32 0, i32* %2, align 4 - %3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i32 0, i32 1 - store i32 3, i32* %3, align 4 - %4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i32 0, i32 2 - store i32 %tmpVar, i32* %4, align 4 - %5 = bitcast [3 x i32]* %1 to i32* - %call = call i32 @foo(i32 3, i32* %5) - store i32 %call, i32* %x, align 4 + %2 = getelementptr inbounds [3 x i32], ptr %1, i32 0, i32 0 + store i32 0, ptr %2, align 4 + %3 = getelementptr inbounds [3 x i32], ptr %1, i32 0, i32 1 + store i32 3, ptr %3, align 4 + %4 = getelementptr inbounds [3 x i32], ptr %1, i32 0, i32 2 + store i32 %tmpVar, ptr %4, align 4 + %call = call i32 @foo(i32 3, ptr %1) + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_varargs_called_in_program.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_varargs_called_in_program.snap index e4704070640..f3605460f03 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_varargs_called_in_program.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__function_with_varargs_called_in_program.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,12 +13,12 @@ target triple = "[filtered]" declare i32 @foo(...) -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %load_x = load i32, i32* %x, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %load_x = load i32, ptr %x, align 4 %tmpVar = add i32 %load_x, 1 %call = call i32 (...) @foo(i1 false, i32 3, i32 %tmpVar) - store i32 %call, i32* %x, align 4 + store i32 %call, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__literal_string_argument_passed_by_ref.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__literal_string_argument_passed_by_ref.snap index 9e5bcb70fa6..0d86c7cfad5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__literal_string_argument_passed_by_ref.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__literal_string_argument_passed_by_ref.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,27 +12,23 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -declare void @func(i8*, i8*) +declare void @func(ptr, ptr) -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %res = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %res = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %__func0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__func0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__func0 to i8* - call void @func(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0)) - %3 = bitcast [81 x i8]* %res to i8* - %4 = bitcast [81 x i8]* %__func0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__func0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @func(ptr %__func0, ptr @utf08_literal_0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %res, ptr align 1 %__func0, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__member_variables_in_body.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__member_variables_in_body.snap index 2f802f5e93b..3c57febfb48 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__member_variables_in_body.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__member_variables_in_body.snap @@ -1,46 +1,45 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i32 @func(i16 %0, i8* %1, i64* %2) { +define i32 @func(i16 %0, ptr %1, ptr %2) { entry: %func = alloca i32, align 4 %i = alloca i16, align 2 - store i16 %0, i16* %i, align 2 - %io = alloca i8*, align 8 - store i8* %1, i8** %io, align 8 - %o = alloca i64*, align 8 - store i64* %2, i64** %o, align 8 + store i16 %0, ptr %i, align 2 + %io = alloca ptr, align 8 + store ptr %1, ptr %io, align 8 + %o = alloca ptr, align 8 + store ptr %2, ptr %o, align 8 %v = alloca i16, align 2 %vt = alloca i16, align 2 - store i16 1, i16* %v, align 2 - store i16 2, i16* %vt, align 2 - store i32 0, i32* %func, align 4 - %load_i = load i16, i16* %i, align 2 + store i16 1, ptr %v, align 2 + store i16 2, ptr %vt, align 2 + store i32 0, ptr %func, align 4 + %load_i = load i16, ptr %i, align 2 %3 = sext i16 %load_i to i32 - %deref = load i8*, i8** %io, align 8 - %load_io = load i8, i8* %deref, align 1 + %deref = load ptr, ptr %io, align 8 + %load_io = load i8, ptr %deref, align 1 %4 = sext i8 %load_io to i32 %tmpVar = mul i32 %3, %4 %5 = sext i32 %tmpVar to i64 - %deref1 = load i64*, i64** %o, align 8 - %load_o = load i64, i64* %deref1, align 8 + %deref1 = load ptr, ptr %o, align 8 + %load_o = load i64, ptr %deref1, align 8 %tmpVar2 = sub i64 %5, %load_o - %load_v = load i16, i16* %v, align 2 + %load_v = load i16, ptr %v, align 2 %6 = sext i16 %load_v to i32 - %load_vt = load i16, i16* %vt, align 2 + %load_vt = load i16, ptr %vt, align 2 %7 = sext i16 %load_vt to i32 %tmpVar3 = mul i32 %6, %7 %8 = sext i32 %tmpVar3 to i64 %tmpVar4 = add i64 %tmpVar2, %8 %9 = trunc i64 %tmpVar4 to i32 - store i32 %9, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + store i32 %9, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__on_functions_var_output_should_be_passed_as_a_pointer.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__on_functions_var_output_should_be_passed_as_a_pointer.snap index e934c713561..3aca5b2e084 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__on_functions_var_output_should_be_passed_as_a_pointer.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__on_functions_var_output_should_be_passed_as_a_pointer.snap @@ -1,22 +1,21 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -define i32 @bump(i8* %0) { +define i32 @bump(ptr %0) { entry: %bump = alloca i32, align 4 - %v = alloca i8*, align 8 - store i8* %0, i8** %v, align 8 - store i32 0, i32* %bump, align 4 - store i32 1, i32* %bump, align 4 - %deref = load i8*, i8** %v, align 8 - store i8 2, i8* %deref, align 1 - %bump_ret = load i32, i32* %bump, align 4 + %v = alloca ptr, align 8 + store ptr %0, ptr %v, align 8 + store i32 0, ptr %bump, align 4 + store i32 1, ptr %bump, align 4 + %deref = load ptr, ptr %v, align 8 + store i8 2, ptr %deref, align 1 + %bump_ret = load i32, ptr %bump, align 4 ret i32 %bump_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function.snap index 21477f52bfd..4d4defd9904 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,32 +12,30 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"12345\00" -define i32 @func(i8* %0) { +define i32 @func(ptr %0) { entry: %func = alloca i32, align 4 %x = alloca [6 x i8], align 1 - %bitcast = bitcast [6 x i8]* %x to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 6, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 5, i1 false) - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + call void @llvm.memset.p0.i64(ptr align 1 %x, i8 0, i64 6, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %x, ptr align 1 %0, i64 5, i1 false) + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = bitcast [6 x i8]* %a to i8* - %call = call i32 @func(i8* %1) - %call1 = call i32 @func(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0)) + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %call = call i32 @func(ptr %a) + %call1 = call i32 @func(ptr @utf08_literal_0) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function_as_reference.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function_as_reference.snap index af0187d1e38..9085281213a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function_as_reference.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_a_string_to_a_function_as_reference.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,21 +12,20 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"12345\00" -define i32 @func(i8* %0) { +define i32 @func(ptr %0) { entry: %func = alloca i32, align 4 - %x = alloca i8*, align 8 - store i8* %0, i8** %x, align 8 - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + %x = alloca ptr, align 8 + store ptr %0, ptr %x, align 8 + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = bitcast [6 x i8]* %a to i8* - %call = call i32 @func(i8* %1) - %call1 = call i32 @func(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0)) + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %call = call i32 @func(ptr %a) + %call1 = call i32 @func(ptr @utf08_literal_0) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_arguments_to_functions_by_ref_and_val.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_arguments_to_functions_by_ref_and_val.snap index 65022ed504f..931c910d404 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_arguments_to_functions_by_ref_and_val.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__passing_arguments_to_functions_by_ref_and_val.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,41 +11,41 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @func(i16* %0, i32* %1, i16 %2, i32 %3) { +define i32 @func(ptr %0, ptr %1, i16 %2, i32 %3) { entry: %func = alloca i32, align 4 - %byRef1 = alloca i16*, align 8 - store i16* %0, i16** %byRef1, align 8 - %byRef2 = alloca i32*, align 8 - store i32* %1, i32** %byRef2, align 8 + %byRef1 = alloca ptr, align 8 + store ptr %0, ptr %byRef1, align 8 + %byRef2 = alloca ptr, align 8 + store ptr %1, ptr %byRef2, align 8 %byVal1 = alloca i16, align 2 - store i16 %2, i16* %byVal1, align 2 + store i16 %2, ptr %byVal1, align 2 %byVal2 = alloca i32, align 4 - store i32 %3, i32* %byVal2, align 4 - store i32 0, i32* %func, align 4 - %deref = load i16*, i16** %byRef1, align 8 - %load_byRef1 = load i16, i16* %deref, align 2 + store i32 %3, ptr %byVal2, align 4 + store i32 0, ptr %func, align 4 + %deref = load ptr, ptr %byRef1, align 8 + %load_byRef1 = load i16, ptr %deref, align 2 %4 = sext i16 %load_byRef1 to i32 - %deref1 = load i32*, i32** %byRef2, align 8 - %load_byRef2 = load i32, i32* %deref1, align 4 + %deref1 = load ptr, ptr %byRef2, align 8 + %load_byRef2 = load i32, ptr %deref1, align 4 %tmpVar = mul i32 %4, %load_byRef2 - %load_byVal1 = load i16, i16* %byVal1, align 2 + %load_byVal1 = load i16, ptr %byVal1, align 2 %5 = sext i16 %load_byVal1 to i32 %tmpVar2 = mul i32 %tmpVar, %5 - %deref3 = load i32*, i32** %byRef2, align 8 - %load_byRef24 = load i32, i32* %deref3, align 4 + %deref3 = load ptr, ptr %byRef2, align 8 + %load_byRef24 = load i32, ptr %deref3, align 4 %tmpVar5 = mul i32 %tmpVar2, %load_byRef24 - store i32 %tmpVar5, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + store i32 %tmpVar5, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %1 = alloca i16, align 2 - store i16 1, i16* %1, align 2 + store i16 1, ptr %1, align 2 %2 = alloca i32, align 4 - store i32 2, i32* %2, align 4 - %call = call i32 @func(i16* %1, i32* %2, i16 3, i32 4) + store i32 2, ptr %2, align 4 + %call = call i32 @func(ptr %1, ptr %2, i16 3, i32 4) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__return_variable_in_nested_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__return_variable_in_nested_call.snap index fac468d1b33..f34bb1ddc47 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__return_variable_in_nested_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__return_variable_in_nested_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: codegen(src) -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,13 +12,13 @@ entry: %main = alloca i32, align 4 %x1 = alloca i32, align 4 %x2 = alloca i32, align 4 - store i32 0, i32* %x1, align 4 - store i32 0, i32* %x2, align 4 - store i32 0, i32* %main, align 4 - %0 = ptrtoint i32* %main to i64 + store i32 0, ptr %x1, align 4 + store i32 0, ptr %x2, align 4 + store i32 0, ptr %main, align 4 + %0 = ptrtoint ptr %main to i64 %call = call i32 @SMC_Read(i64 %0) - store i32 %call, i32* %x1, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 %call, ptr %x1, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } @@ -27,8 +26,8 @@ define i32 @SMC_Read(i64 %0) { entry: %SMC_Read = alloca i32, align 4 %ValAddr = alloca i64, align 8 - store i64 %0, i64* %ValAddr, align 8 - store i32 0, i32* %SMC_Read, align 4 - %SMC_Read_ret = load i32, i32* %SMC_Read, align 4 + store i64 %0, ptr %ValAddr, align 8 + store i32 0, ptr %SMC_Read, align 4 + %SMC_Read_ret = load i32, ptr %SMC_Read, align 4 ret i32 %SMC_Read_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__simple_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__simple_call.snap index 1e6ec2c6f93..cf51f4cac18 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__simple_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__simple_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,19 +15,19 @@ define i32 @func(i32 %0) { entry: %func = alloca i32, align 4 %x = alloca i32, align 4 - store i32 %0, i32* %x, align 4 - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + store i32 %0, ptr %x, align 4 + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %load_a = load i32, i32* %a, align 4 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %load_a = load i32, ptr %a, align 4 %call = call i32 @func(i32 %load_a) %call1 = call i32 @func(i32 1) - %load_a2 = load i32, i32* %a, align 4 + %load_a2 = load i32, ptr %a, align 4 %tmpVar = add i32 1, %load_a2 %call3 = call i32 @func(i32 %tmpVar) ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__var_output_in_function_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__var_output_in_function_call.snap index 102eab2916e..b844ad6ff27 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__var_output_in_function_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__function_tests__var_output_in_function_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/function_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,22 +11,22 @@ target triple = "[filtered]" @main_instance = global %main { i16 4 } -define i32 @func(i16* %0) { +define i32 @func(ptr %0) { entry: %func = alloca i32, align 4 - %o = alloca i16*, align 8 - store i16* %0, i16** %o, align 8 - store i32 0, i32* %func, align 4 - %deref = load i16*, i16** %o, align 8 - store i16 6, i16* %deref, align 2 - store i32 4, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + %o = alloca ptr, align 8 + store ptr %0, ptr %o, align 8 + store i32 0, ptr %func, align 4 + %deref = load ptr, ptr %o, align 8 + store i16 6, ptr %deref, align 2 + store i32 4, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %call = call i32 @func(i16* %x) + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %call = call i32 @func(ptr %x) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__any_real_function_called_with_ints.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__any_real_function_called_with_ints.snap index 75db1b553cf..44708ac0b3a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__any_real_function_called_with_ints.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__any_real_function_called_with_ints.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: codegen(src) -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,46 +15,46 @@ define float @foo__REAL(float %0) { entry: %foo__REAL = alloca float, align 4 %in1 = alloca float, align 4 - store float %0, float* %in1, align 4 - store float 0.000000e+00, float* %foo__REAL, align 4 - %foo__REAL_ret = load float, float* %foo__REAL, align 4 + store float %0, ptr %in1, align 4 + store float 0.000000e+00, ptr %foo__REAL, align 4 + %foo__REAL_ret = load float, ptr %foo__REAL, align 4 ret float %foo__REAL_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %res_sint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %res_int = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %res_dint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %res_lint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %res_usint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 4 - %res_uint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 5 - %res_udint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 6 - %res_ulint = getelementptr inbounds %prg, %prg* %0, i32 0, i32 7 + %res_sint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %res_int = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %res_dint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %res_lint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %res_usint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 4 + %res_uint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 5 + %res_udint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 6 + %res_ulint = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 7 %v_dint = alloca i32, align 4 %v_udint = alloca i32, align 4 - store i32 1, i32* %v_dint, align 4 - store i32 1, i32* %v_udint, align 4 + store i32 1, ptr %v_dint, align 4 + store i32 1, ptr %v_udint, align 4 %call = call float @foo__REAL(float 1.000000e+00) - store float %call, float* %res_sint, align 4 + store float %call, ptr %res_sint, align 4 %call1 = call float @foo__REAL(float 1.000000e+00) - store float %call1, float* %res_int, align 4 - %load_v_dint = load i32, i32* %v_dint, align 4 + store float %call1, ptr %res_int, align 4 + %load_v_dint = load i32, ptr %v_dint, align 4 %1 = sitofp i32 %load_v_dint to float %call2 = call float @foo__REAL(float %1) - store float %call2, float* %res_dint, align 4 + store float %call2, ptr %res_dint, align 4 %call3 = call double @foo__LREAL(double 1.000000e+00) - store double %call3, double* %res_lint, align 8 + store double %call3, ptr %res_lint, align 8 %call4 = call float @foo__REAL(float 1.000000e+00) - store float %call4, float* %res_usint, align 4 + store float %call4, ptr %res_usint, align 4 %call5 = call float @foo__REAL(float 1.000000e+00) - store float %call5, float* %res_uint, align 4 - %load_v_udint = load i32, i32* %v_udint, align 4 + store float %call5, ptr %res_uint, align 4 + %load_v_udint = load i32, ptr %v_udint, align 4 %2 = sitofp i32 %load_v_udint to float %call6 = call float @foo__REAL(float %2) - store float %call6, float* %res_udint, align 4 + store float %call6, ptr %res_udint, align 4 %call7 = call double @foo__LREAL(double 1.000000e+00) - store double %call7, double* %res_ulint, align 8 + store double %call7, ptr %res_ulint, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_call_gets_cast_to_biggest_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_call_gets_cast_to_biggest_type.snap index cb83c6d237d..fb73b1b6ad3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_call_gets_cast_to_biggest_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_call_gets_cast_to_biggest_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: codegen(src) -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,21 +10,20 @@ target triple = "[filtered]" define double @main() { entry: %main = alloca double, align 8 - store double 0.000000e+00, double* %main, align 8 + store double 0.000000e+00, ptr %main, align 8 %0 = alloca [4 x double], align 8 - %1 = getelementptr inbounds [4 x double], [4 x double]* %0, i32 0, i32 0 - store double 5.000000e+00, double* %1, align 8 - %2 = getelementptr inbounds [4 x double], [4 x double]* %0, i32 0, i32 1 - store double 1.000000e+00, double* %2, align 8 - %3 = getelementptr inbounds [4 x double], [4 x double]* %0, i32 0, i32 2 - store double 1.500000e+00, double* %3, align 8 - %4 = getelementptr inbounds [4 x double], [4 x double]* %0, i32 0, i32 3 - store double 1.200000e+00, double* %4, align 8 - %5 = bitcast [4 x double]* %0 to double* - %call = call double @MAX__LREAL(i32 4, double* %5) - store double %call, double* %main, align 8 - %main_ret = load double, double* %main, align 8 + %1 = getelementptr inbounds [4 x double], ptr %0, i32 0, i32 0 + store double 5.000000e+00, ptr %1, align 8 + %2 = getelementptr inbounds [4 x double], ptr %0, i32 0, i32 1 + store double 1.000000e+00, ptr %2, align 8 + %3 = getelementptr inbounds [4 x double], ptr %0, i32 0, i32 2 + store double 1.500000e+00, ptr %3, align 8 + %4 = getelementptr inbounds [4 x double], ptr %0, i32 0, i32 3 + store double 1.200000e+00, ptr %4, align 8 + %call = call double @MAX__LREAL(i32 4, ptr %0) + store double %call, ptr %main, align 8 + %main_ret = load double, ptr %main, align 8 ret double %main_ret } -declare double @MAX__LREAL(i32, double*) +declare double @MAX__LREAL(i32, ptr) diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_codegen_with_aggregate_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_codegen_with_aggregate_return.snap index 378dda5c867..9988c4ce093 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_codegen_with_aggregate_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_codegen_with_aggregate_return.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: prg -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,36 +9,33 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [212 x i8] c" this is a very long sentence with plenty of characters and weird spacing.the same is true for this string.\00" -define void @main(i8* %0) { +define void @main(ptr %0) { entry: - %main = alloca i8*, align 8 - store i8* %0, i8** %main, align 8 + %main = alloca ptr, align 8 + store ptr %0, ptr %main, align 8 %l = alloca i32, align 4 %p = alloca i32, align 4 - store i32 0, i32* %l, align 4 - store i32 0, i32* %p, align 4 - store i32 4, i32* %l, align 4 - store i32 6, i32* %p, align 4 + store i32 0, ptr %l, align 4 + store i32 0, ptr %p, align 4 + store i32 4, ptr %l, align 4 + store i32 6, ptr %p, align 4 %__MID0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__MID0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__MID0 to i8* - %load_l = load i32, i32* %l, align 4 - %load_p = load i32, i32* %p, align 4 - call void @MID__STRING(i8* %2, i8* getelementptr inbounds ([212 x i8], [212 x i8]* @utf08_literal_0, i32 0, i32 0), i32 %load_l, i32 %load_p) - %deref = load i8*, i8** %main, align 8 - %3 = bitcast [81 x i8]* %__MID0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 %3, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__MID0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + %load_l = load i32, ptr %l, align 4 + %load_p = load i32, ptr %p, align 4 + call void @MID__STRING(ptr %__MID0, ptr @utf08_literal_0, i32 %load_l, i32 %load_p) + %deref = load ptr, ptr %main, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 %__MID0, i32 80, i1 false) ret void } -declare void @MID__STRING(i8*, i8*, i32, i32) +declare void @MID__STRING(ptr, ptr, i32, i32) -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_call_generates_real_type_call.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_call_generates_real_type_call.snap index a98d98700e1..1f29b85a1aa 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_call_generates_real_type_call.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_call_generates_real_type_call.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: prg -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,21 +15,21 @@ define i32 @MAX__DINT(i32 %0, i32 %1) { entry: %MAX__DINT = alloca i32, align 4 %in1 = alloca i32, align 4 - store i32 %0, i32* %in1, align 4 + store i32 %0, ptr %in1, align 4 %in2 = alloca i32, align 4 - store i32 %1, i32* %in2, align 4 - store i32 0, i32* %MAX__DINT, align 4 - %MAX__DINT_ret = load i32, i32* %MAX__DINT, align 4 + store i32 %1, ptr %in2, align 4 + store i32 0, ptr %MAX__DINT, align 4 + %MAX__DINT_ret = load i32, ptr %MAX__DINT, align 4 ret i32 %MAX__DINT_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 %call = call i32 @MAX__DINT(i32 1, i32 2) - %load_a = load i16, i16* %a, align 2 - %load_b = load i16, i16* %b, align 2 + %load_a = load i16, ptr %a, align 2 + %load_b = load i16, ptr %b, align 2 %call1 = call i16 @MAX__INT(i16 %load_a, i16 %load_b) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_with_aggregate_return.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_with_aggregate_return.snap index d197ef7cb11..0c80df95074 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_with_aggregate_return.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_function_with_aggregate_return.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: codegen(src) -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -10,20 +9,18 @@ target triple = "[filtered]" @utf16_literal_0 = private unnamed_addr constant [6 x i16] [i16 72, i16 101, i16 108, i16 108, i16 111, i16 0] -declare void @TO_STRING__WSTRING(i8*, i16*) +declare void @TO_STRING__WSTRING(ptr, ptr) define void @main() { entry: %__TO_STRING0 = alloca [1025 x i8], align 1 - %0 = bitcast [1025 x i8]* %__TO_STRING0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([1025 x i8]* getelementptr ([1025 x i8], [1025 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [1025 x i8]* %__TO_STRING0 to i8* - call void @TO_STRING__WSTRING(i8* %1, i16* getelementptr inbounds ([6 x i16], [6 x i16]* @utf16_literal_0, i32 0, i32 0)) - %load___TO_STRING0 = load [1025 x i8], [1025 x i8]* %__TO_STRING0, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %__TO_STRING0, i8 0, i64 ptrtoint (ptr getelementptr ([1025 x i8], ptr null, i32 1) to i64), i1 false) + call void @TO_STRING__WSTRING(ptr %__TO_STRING0, ptr @utf16_literal_0) + %load___TO_STRING0 = load [1025 x i8], ptr %__TO_STRING0, align 1 ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_output_parameter.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_output_parameter.snap index ebf73b64db5..7b3f3c86054 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_output_parameter.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__generics_test__generic_output_parameter.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/generics_test.rs expression: codegen(src) -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,25 +11,25 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define i16 @foo__INT(i64 %0, i16* %1) { +define i16 @foo__INT(i64 %0, ptr %1) { entry: %foo__INT = alloca i16, align 2 %in1 = alloca i64, align 8 - store i64 %0, i64* %in1, align 8 - %out1 = alloca i16*, align 8 - store i16* %1, i16** %out1, align 8 - store i16 0, i16* %foo__INT, align 2 - %foo__INT_ret = load i16, i16* %foo__INT, align 2 + store i64 %0, ptr %in1, align 8 + %out1 = alloca ptr, align 8 + store ptr %1, ptr %out1, align 8 + store i16 0, ptr %foo__INT, align 2 + %foo__INT_ret = load i16, ptr %foo__INT, align 2 ret i16 %foo__INT_ret } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %theInt = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %iResult = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %data = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_data = load i64, i64* %data, align 8 - %call = call i16 @foo__INT(i64 %load_data, i16* %theInt) - store i16 %call, i16* %iResult, align 2 + %theInt = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %iResult = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %data = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_data = load i64, ptr %data, align 8 + %call = call i16 @foo__INT(i64 %load_data, ptr %theInt) + store i16 %call, ptr %iResult, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_in_module.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_in_module.snap index cad6b382099..27314b667b4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_in_module.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_in_module.snap @@ -7,7 +7,7 @@ source_filename = "myStruct.st" target datalayout = "[filtered]" target triple = "[filtered]" -%myStruct = type { i32, i16* } +%myStruct = type { i32, ptr } @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer @@ -17,13 +17,13 @@ target datalayout = "[filtered]" target triple = "[filtered]" %prog = type { %myStruct.1 } -%myStruct.1 = type { i32, i16* } +%myStruct.1 = type { i32, ptr } @prog_instance = global %prog zeroinitializer @__myStruct__init = external unnamed_addr constant %myStruct.1 -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %x = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_no_deps_in_module.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_no_deps_in_module.snap index fd905b2e8e7..202e02dcdf1 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_no_deps_in_module.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_defined_in_external_file_no_deps_in_module.snap @@ -1,16 +1,15 @@ --- source: src/codegen/tests/multifile_codegen_tests.rs expression: "codegen_multi(units, crate::DebugLevel::None).join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'myStruct.st' source_filename = "myStruct.st" target datalayout = "[filtered]" target triple = "[filtered]" -%myStruct = type { i32, i16* } +%myStruct = type { i32, ptr } -@__myStruct__init = unnamed_addr constant %myStruct { i32 20, i16* null } +@__myStruct__init = unnamed_addr constant %myStruct { i32 20, ptr null } ; ModuleID = 'prog.st' source_filename = "prog.st" @@ -21,8 +20,8 @@ target triple = "[filtered]" @prog_instance = global %prog zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %x = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_initialized_in_external_file_in_module.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_initialized_in_external_file_in_module.snap index bf5cb70afeb..4bbe4461a58 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_initialized_in_external_file_in_module.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__datatype_initialized_in_external_file_in_module.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/multifile_codegen_tests.rs expression: "codegen_multi(units, crate::DebugLevel::None).join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'MyInt.st' source_filename = "MyInt.st" @@ -17,8 +16,8 @@ target triple = "[filtered]" @prog_instance = global %prog { i16 5 } -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %x = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__enum_referenced_in_fb_nested.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__enum_referenced_in_fb_nested.snap index 9ebcf75f16a..b230c549b7b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__enum_referenced_in_fb_nested.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__enum_referenced_in_fb_nested.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/multifile_codegen_tests.rs expression: "codegen_multi(units, crate::DebugLevel::None).join(\"\\n\")" -snapshot_kind: text --- ; ModuleID = 'myEnum.st' source_filename = "myEnum.st" @@ -21,11 +20,11 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb { i32 1 } -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 - %x = getelementptr inbounds %fb, %fb* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb, ptr %0, i32 0, i32 0 ret void } @@ -40,7 +39,7 @@ target triple = "[filtered]" @__myStruct__init = unnamed_addr constant %myStruct { %fb.2 { i32 1 } } @__fb__init = external unnamed_addr constant %fb.2 -declare void @fb(%fb.2*) +declare void @fb(ptr) ; ModuleID = 'fb2.st' source_filename = "fb2.st" @@ -55,15 +54,15 @@ target triple = "[filtered]" @__myStruct__init = external unnamed_addr constant %myStruct.4 @__fb__init = external unnamed_addr constant %fb.5 -define void @fb2(%fb2* %0) { +define void @fb2(ptr %0) { entry: - %this = alloca %fb2*, align 8 - store %fb2* %0, %fb2** %this, align 8 - %x = getelementptr inbounds %fb2, %fb2* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %x = getelementptr inbounds nuw %fb2, ptr %0, i32 0, i32 0 ret void } -declare void @fb(%fb.5*) +declare void @fb(ptr) ; ModuleID = 'fb3.st' source_filename = "fb3.st" @@ -74,9 +73,9 @@ target triple = "[filtered]" @__fb3__init = unnamed_addr constant %fb3 zeroinitializer -define void @fb3(%fb3* %0) { +define void @fb3(ptr %0) { entry: - %this = alloca %fb3*, align 8 - store %fb3* %0, %fb3** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__function_defined_in_external_file.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__function_defined_in_external_file.snap index 4cceb85d294..be76a50743f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__function_defined_in_external_file.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__function_defined_in_external_file.snap @@ -10,8 +10,8 @@ target triple = "[filtered]" define i32 @func() { entry: %func = alloca i32, align 4 - store i32 0, i32* %func, align 4 - %func_ret = load i32, i32* %func, align 4 + store i32 0, ptr %func, align 4 + %func_ret = load i32, ptr %func, align 4 ret i32 %func_ret } @@ -24,10 +24,10 @@ target triple = "[filtered]" @__fb__init = unnamed_addr constant %fb zeroinitializer -define void @fb(%fb* %0) { +define void @fb(ptr %0) { entry: - %this = alloca %fb*, align 8 - store %fb* %0, %fb** %this, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 ret void } @@ -40,9 +40,9 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 ret void } @@ -55,9 +55,9 @@ target triple = "[filtered]" @prg2_instance = global %prg2 zeroinitializer -define void @prg2(%prg2* %0) { +define void @prg2(ptr %0) { entry: - %b = getelementptr inbounds %prg2, %prg2* %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg2, ptr %0, i32 0, i32 0 ret void } @@ -76,20 +76,20 @@ target triple = "[filtered]" @prg_instance = external global %prg.5 @prg2_instance = external global %prg2.6 -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %myFb = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %load_a = load i32, i32* getelementptr inbounds (%prg.5, %prg.5* @prg_instance, i32 0, i32 0), align 4 - call void @prg2(%prg2.6* @prg2_instance) + %myFb = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %load_a = load i32, ptr @prg_instance, align 4 + call void @prg2(ptr @prg2_instance) %call = call i32 @func() - call void @fb(%fb.4* %myFb) + call void @fb(ptr %myFb) ret void } -declare void @fb(%fb.4*) +declare void @fb(ptr) -declare void @prg(%prg.5*) +declare void @prg(ptr) -declare void @prg2(%prg2.6*) +declare void @prg2(ptr) declare i32 @func() diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__global_value_from_different_file.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__global_value_from_different_file.snap index 283683de58b..6be38bd9c3a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__global_value_from_different_file.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__global_value_from_different_file.snap @@ -32,8 +32,8 @@ target triple = "[filtered]" @c = external unnamed_addr constant i32 @x = external global i32 -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - store i32 7, i32* @x, align 4 + store i32 7, ptr @x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__struct_with_custom_init_in_different_file.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__struct_with_custom_init_in_different_file.snap index 12e9f5236c0..10fa0eb6bb4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__struct_with_custom_init_in_different_file.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__multifile_codegen_tests__struct_with_custom_init_in_different_file.snap @@ -34,9 +34,9 @@ target triple = "[filtered]" @__myStruct2__init = external unnamed_addr constant %myStruct2.3 @__prog.x__init = unnamed_addr constant %myStruct.2 { i32 5, i16 2 } -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %x = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %y = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_input_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_input_param.snap index 99a636d2243..488508f45f9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_input_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_input_param.snap @@ -13,20 +13,20 @@ target triple = "[filtered]" @__fb_t__init = unnamed_addr constant %fb_t zeroinitializer @main_instance = global %main zeroinitializer -define void @fb_t(%fb_t* %0) { +define void @fb_t(ptr %0) { entry: - %this = alloca %fb_t*, align 8 - store %fb_t* %0, %fb_t** %this, align 8 - %in1 = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 0 - %in2 = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %in1 = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 0 + %in2 = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 1 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fb = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %1 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 0 - store i32 1, i32* %1, align 4 - call void @fb_t(%fb_t* %fb) + %fb = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %1 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 0 + store i32 1, ptr %1, align 4 + call void @fb_t(ptr %fb) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_output_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_output_param.snap index d45989586b9..03aa32f1dc5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_output_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__fb_accepts_empty_statement_as_output_param.snap @@ -13,22 +13,22 @@ target triple = "[filtered]" @__fb_t__init = unnamed_addr constant %fb_t zeroinitializer @main_instance = global %main zeroinitializer -define void @fb_t(%fb_t* %0) { +define void @fb_t(ptr %0) { entry: - %this = alloca %fb_t*, align 8 - store %fb_t* %0, %fb_t** %this, align 8 - %out1 = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 0 - %out2 = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %out1 = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 0 + %out2 = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 1 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fb = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - call void @fb_t(%fb_t* %fb) - %1 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 0 - %2 = load i32, i32* %1, align 4 - store i32 %2, i32* %x, align 4 + %fb = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + call void @fb_t(ptr %fb) + %1 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 0 + %2 = load i32, ptr %1, align 4 + store i32 %2, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_input_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_input_param.snap index 996c6c21621..e176905c620 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_input_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_input_param.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -15,16 +14,16 @@ target triple = "[filtered]" define void @foo(i32 %0, i32 %1) { entry: %in1 = alloca i32, align 4 - store i32 %0, i32* %in1, align 4 + store i32 %0, ptr %in1, align 4 %in2 = alloca i32, align 4 - store i32 %1, i32* %in2, align 4 + store i32 %1, ptr %in2, align 4 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %1 = alloca i32, align 4 - %2 = load i32, i32* %1, align 4 + %2 = load i32, ptr %1, align 4 call void @foo(i32 1, i32 %2) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_output_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_output_param.snap index 2050373d0b1..dcda6a560c9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_output_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_accepts_empty_statement_as_output_param.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,19 +11,19 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define void @foo(i32* %0, i32* %1) { +define void @foo(ptr %0, ptr %1) { entry: - %out1 = alloca i32*, align 8 - store i32* %0, i32** %out1, align 8 - %out2 = alloca i32*, align 8 - store i32* %1, i32** %out2, align 8 + %out1 = alloca ptr, align 8 + store ptr %0, ptr %out1, align 8 + %out2 = alloca ptr, align 8 + store ptr %1, ptr %out2, align 8 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %1 = alloca i32, align 4 - call void @foo(i32* %x, i32* %1) + call void @foo(ptr %x, ptr %1) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_all_parameters_assigned.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_all_parameters_assigned.snap index 21551b4f2d0..2e918285c12 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_all_parameters_assigned.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_all_parameters_assigned.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,30 +11,30 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %var2, i32* %var3) - %load_var11 = load i32, i32* %var1, align 4 - %call2 = call i32 @foo(i32 %load_var11, i32* %var2, i32* %var3) - %load_var13 = load i32, i32* %var1, align 4 - %call4 = call i32 @foo(i32 %load_var13, i32* %var2, i32* %var3) + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 + %call = call i32 @foo(i32 %load_var1, ptr %var2, ptr %var3) + %load_var11 = load i32, ptr %var1, align 4 + %call2 = call i32 @foo(i32 %load_var11, ptr %var2, ptr %var3) + %load_var13 = load i32, ptr %var1, align 4 + %call4 = call i32 @foo(i32 %load_var13, ptr %var2, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_default_value_parameter_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_default_value_parameter_type.snap index e2a53ca6702..d87843f1c5f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_default_value_parameter_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_default_value_parameter_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,31 +11,31 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2, i32* %3) { +define i32 @foo(i32 %0, ptr %1, ptr %2, ptr %3) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %output2 = alloca i32*, align 8 - store i32* %2, i32** %output2, align 8 - %inout1 = alloca i32*, align 8 - store i32* %3, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %output2 = alloca ptr, align 8 + store ptr %2, ptr %output2, align 8 + %inout1 = alloca ptr, align 8 + store ptr %3, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 %1 = alloca i32, align 4 - store i32 20, i32* %1, align 4 + store i32 20, ptr %1, align 4 %2 = alloca i32, align 4 - store i32 20, i32* %2, align 4 - %call = call i32 @foo(i32 20, i32* %2, i32* %1, i32* %var3) + store i32 20, ptr %2, align 4 + %call = call i32 @foo(i32 20, ptr %2, ptr %1, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_inout_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_inout_assignment.snap index 44be2ae9907..aca02d62fcf 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_inout_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_inout_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %var2, i32* %1) + %call = call i32 @foo(i32 %load_var1, ptr %var2, ptr %1) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_input_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_input_assignment.snap index 6d0ed49d4b0..9ff1372d6df 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_input_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_input_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 %1 = alloca i32, align 4 - %2 = load i32, i32* %1, align 4 - %call = call i32 @foo(i32 %2, i32* %var2, i32* %var3) + %2 = load i32, ptr %1, align 4 + %call = call i32 @foo(i32 %2, ptr %var2, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_assignment.snap index 7d28ee1b658..d1ff58ed780 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %1, i32* %var3) + %call = call i32 @foo(i32 %load_var1, ptr %1, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_default_value_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_default_value_assignment.snap index d708f1bac86..094484b6d8d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_default_value_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_empty_output_default_value_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,28 +11,28 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - store i32 3, i32* %1, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %1, i32* %var3) + store i32 3, ptr %1, align 4 + %call = call i32 @foo(i32 %load_var1, ptr %1, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_inout_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_inout_assignment.snap index 44be2ae9907..aca02d62fcf 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_inout_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_inout_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %var2, i32* %1) + %call = call i32 @foo(i32 %load_var1, ptr %var2, ptr %1) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_assignment.snap index 6d0ed49d4b0..9ff1372d6df 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 %1 = alloca i32, align 4 - %2 = load i32, i32* %1, align 4 - %call = call i32 @foo(i32 %2, i32* %var2, i32* %var3) + %2 = load i32, ptr %1, align 4 + %call = call i32 @foo(i32 %2, ptr %var2, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_default_value_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_default_value_assignment.snap index e9d3e257f28..536d5e56488 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_default_value_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_input_default_value_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,25 +11,25 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %call = call i32 @foo(i32 10, i32* %var2, i32* %var3) + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %call = call i32 @foo(i32 10, ptr %var2, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_assignment.snap index 7d28ee1b658..d1ff58ed780 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,27 +11,27 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %1, i32* %var3) + %call = call i32 @foo(i32 %load_var1, ptr %1, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_default_value_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_default_value_assignment.snap index d708f1bac86..094484b6d8d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_default_value_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__function_missing_output_default_value_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,28 +11,28 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer -define i32 @foo(i32 %0, i32* %1, i32* %2) { +define i32 @foo(i32 %0, ptr %1, ptr %2) { entry: %foo = alloca i32, align 4 %input1 = alloca i32, align 4 - store i32 %0, i32* %input1, align 4 - %output1 = alloca i32*, align 8 - store i32* %1, i32** %output1, align 8 - %inout1 = alloca i32*, align 8 - store i32* %2, i32** %inout1, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %0, ptr %input1, align 4 + %output1 = alloca ptr, align 8 + store ptr %1, ptr %output1, align 8 + %inout1 = alloca ptr, align 8 + store ptr %2, ptr %inout1, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 %1 = alloca i32, align 4 - store i32 3, i32* %1, align 4 - %call = call i32 @foo(i32 %load_var1, i32* %1, i32* %var3) + store i32 3, ptr %1, align 4 + %call = call i32 @foo(i32 %load_var1, ptr %1, ptr %var3) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__parameters_behind_function_block_pointer_are_assigned_to.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__parameters_behind_function_block_pointer_are_assigned_to.snap index 51152f767a5..64a043b58e3 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__parameters_behind_function_block_pointer_are_assigned_to.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__parameters_behind_function_block_pointer_are_assigned_to.snap @@ -7,29 +7,29 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%main = type { %file_t, %file_t* } +%main = type { %file_t, ptr } %file_t = type { i8, i8 } @main_instance = global %main zeroinitializer @__file_t__init = unnamed_addr constant %file_t zeroinitializer -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %file = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %FileOpen = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store %file_t* %file, %file_t** %FileOpen, align 8 - %deref = load %file_t*, %file_t** %FileOpen, align 8 - %1 = getelementptr inbounds %file_t, %file_t* %deref, i32 0, i32 1 - store i8 1, i8* %1, align 1 - call void @file_t(%file_t* %deref) + %file = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %FileOpen = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store ptr %file, ptr %FileOpen, align 8 + %deref = load ptr, ptr %FileOpen, align 8 + %1 = getelementptr inbounds nuw %file_t, ptr %deref, i32 0, i32 1 + store i8 1, ptr %1, align 1 + call void @file_t(ptr %deref) ret void } -define void @file_t(%file_t* %0) { +define void @file_t(ptr %0) { entry: - %this = alloca %file_t*, align 8 - store %file_t* %0, %file_t** %this, align 8 - %var1 = getelementptr inbounds %file_t, %file_t* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %file_t, %file_t* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %var1 = getelementptr inbounds nuw %file_t, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %file_t, ptr %0, i32 0, i32 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_input_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_input_param.snap index b5aa9e86e2d..878bba1c687 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_input_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_input_param.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,16 +13,16 @@ target triple = "[filtered]" @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %in1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %in2 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 + %in1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %in2 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - store i32 1, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - call void @prog(%prog* @prog_instance) + store i32 1, ptr @prog_instance, align 4 + call void @prog(ptr @prog_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_output_param.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_output_param.snap index bb95e0d9c9b..85f0eb21cc9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_output_param.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_accepts_empty_statement_as_output_param.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,20 +13,20 @@ target triple = "[filtered]" @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %out1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %out2 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - store i32 1, i32* %out1, align 4 - store i32 2, i32* %out2, align 4 + %out1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %out2 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + store i32 1, ptr %out1, align 4 + store i32 2, ptr %out2, align 4 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - call void @prog(%prog* @prog_instance) - %1 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - store i32 %1, i32* %x, align 4 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + call void @prog(ptr @prog_instance) + %1 = load i32, ptr @prog_instance, align 4 + store i32 %1, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_explicit.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_explicit.snap index b8f45d9250d..037baf314e5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_explicit.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_explicit.snap @@ -1,43 +1,42 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prog = type { i32, i32, i32* } +%prog = type { i32, i32, ptr } %main = type { i32, i32, i32 } @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %inout1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %inout1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 - store i32 %load_var1, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - store i32* %var3, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - call void @prog(%prog* @prog_instance) - %1 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 4 - store i32 %1, i32* %var2, align 4 - store i32* %var3, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - %load_var11 = load i32, i32* %var1, align 4 - store i32 %load_var11, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - call void @prog(%prog* @prog_instance) - %2 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 4 - store i32 %2, i32* %var2, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 + store i32 %load_var1, ptr @prog_instance, align 4 + store ptr %var3, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + call void @prog(ptr @prog_instance) + %1 = load i32, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 4 + store i32 %1, ptr %var2, align 4 + store ptr %var3, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + %load_var11 = load i32, ptr %var1, align 4 + store i32 %load_var11, ptr @prog_instance, align 4 + call void @prog(ptr @prog_instance) + %2 = load i32, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 4 + store i32 %2, ptr %var2, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_implicit.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_implicit.snap index 563aabc17e4..92e00a2c45d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_implicit.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_all_parameters_assigned_implicit.snap @@ -1,37 +1,36 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prog = type { i32, i32, i32* } +%prog = type { i32, i32, ptr } %main = type { i32, i32, i32 } @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %inout1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %inout1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 - store i32 %load_var1, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - store i32* %var3, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - call void @prog(%prog* @prog_instance) - %1 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 4 - store i32 %1, i32* %var2, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 + store i32 %load_var1, ptr @prog_instance, align 4 + store ptr %var3, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + call void @prog(ptr @prog_instance) + %1 = load i32, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 4 + store i32 %1, ptr %var2, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_empty_inout_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_empty_inout_assignment.snap index 69741f706ad..f598444114c 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_empty_inout_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_empty_inout_assignment.snap @@ -1,38 +1,37 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prog = type { i32, i32, i32* } +%prog = type { i32, i32, ptr } %main = type { i32, i32, i32 } @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %inout1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %inout1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 - store i32 %load_var1, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 + store i32 %load_var1, ptr @prog_instance, align 4 %empty_varinout = alloca i32, align 4 - store i32* %empty_varinout, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - call void @prog(%prog* @prog_instance) - %1 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 4 - store i32 %1, i32* %var2, align 4 + store ptr %empty_varinout, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + call void @prog(ptr @prog_instance) + %1 = load i32, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 4 + store i32 %1, ptr %var2, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_input_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_input_assignment.snap index 0382383b7d8..0089dba72f4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_input_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_input_assignment.snap @@ -1,35 +1,34 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prog = type { i32, i32, i32* } +%prog = type { i32, i32, ptr } %main = type { i32, i32, i32 } @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %inout1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %inout1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - store i32* %var3, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - call void @prog(%prog* @prog_instance) - %1 = load i32, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1), align 4 - store i32 %1, i32* %var2, align 4 + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + store ptr %var3, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + call void @prog(ptr @prog_instance) + %1 = load i32, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), align 4 + store i32 %1, ptr %var2, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_output_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_output_assignment.snap index 6993817fdb1..4862d775198 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_output_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__program_missing_output_assignment.snap @@ -1,35 +1,34 @@ --- source: src/codegen/tests/parameters_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%prog = type { i32, i32, i32* } +%prog = type { i32, i32, ptr } %main = type { i32, i32, i32 } @prog_instance = global %prog zeroinitializer @main_instance = global %main zeroinitializer -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %input1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %inout1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 2 + %input1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + %inout1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 2 ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %var1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %var2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %var3 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %load_var1 = load i32, i32* %var1, align 4 - store i32 %load_var1, i32* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0), align 4 - store i32* %var3, i32** getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 2), align 8 - call void @prog(%prog* @prog_instance) + %var1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %var2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %var3 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %load_var1 = load i32, ptr %var1, align 4 + store i32 %load_var1, ptr @prog_instance, align 4 + store ptr %var3, ptr getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 2), align 8 + call void @prog(ptr @prog_instance) ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__var_in_out_params_can_be_out_of_order.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__var_in_out_params_can_be_out_of_order.snap index 7bbe91b29ab..ef7493d36b6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__var_in_out_params_can_be_out_of_order.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__parameters_tests__var_in_out_params_can_be_out_of_order.snap @@ -8,59 +8,59 @@ target datalayout = "[filtered]" target triple = "[filtered]" %mainProg = type { %fb_t, i8, i8 } -%fb_t = type { i8, i8, i8*, i8, i8* } +%fb_t = type { i8, i8, ptr, i8, ptr } @mainProg_instance = global %mainProg zeroinitializer @__fb_t__init = unnamed_addr constant %fb_t zeroinitializer -define void @mainProg(%mainProg* %0) { +define void @mainProg(ptr %0) { entry: - %fb = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 0 - %out1 = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 1 - %out2 = getelementptr inbounds %mainProg, %mainProg* %0, i32 0, i32 2 - %1 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 4 - store i8* %out1, i8** %1, align 8 - %2 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 2 - store i8* %out2, i8** %2, align 8 - call void @fb_t(%fb_t* %fb) - %3 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 2 - store i8* %out1, i8** %3, align 8 - %4 = getelementptr inbounds %fb_t, %fb_t* %fb, i32 0, i32 4 - store i8* %out2, i8** %4, align 8 - call void @fb_t(%fb_t* %fb) - %load_out2 = load i8, i8* %out2, align 1 - %load_out1 = load i8, i8* %out1, align 1 - call void @fb_t__foo(%fb_t* %fb) - %load_out21 = load i8, i8* %out2, align 1 - %load_out12 = load i8, i8* %out1, align 1 - call void @fb_t__foo(%fb_t* %fb) + %fb = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 0 + %out1 = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 1 + %out2 = getelementptr inbounds nuw %mainProg, ptr %0, i32 0, i32 2 + %1 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 4 + store ptr %out1, ptr %1, align 8 + %2 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 2 + store ptr %out2, ptr %2, align 8 + call void @fb_t(ptr %fb) + %3 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 2 + store ptr %out1, ptr %3, align 8 + %4 = getelementptr inbounds nuw %fb_t, ptr %fb, i32 0, i32 4 + store ptr %out2, ptr %4, align 8 + call void @fb_t(ptr %fb) + %load_out2 = load i8, ptr %out2, align 1 + %load_out1 = load i8, ptr %out1, align 1 + call void @fb_t__foo(ptr %fb) + %load_out21 = load i8, ptr %out2, align 1 + %load_out12 = load i8, ptr %out1, align 1 + call void @fb_t__foo(ptr %fb) ret void } -define void @fb_t(%fb_t* %0) { +define void @fb_t(ptr %0) { entry: - %this = alloca %fb_t*, align 8 - store %fb_t* %0, %fb_t** %this, align 8 - %myVar = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 0 - %myInput = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 1 - %myInOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 2 - %myOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 3 - %myOtherInOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %myVar = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 0 + %myInput = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 1 + %myInOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 2 + %myOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 3 + %myOtherInOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 4 ret void } -define void @fb_t__foo(%fb_t* %0) { +define void @fb_t__foo(ptr %0) { entry: - %this = alloca %fb_t*, align 8 - store %fb_t* %0, %fb_t** %this, align 8 - %myVar = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 0 - %myInput = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 1 - %myInOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 2 - %myOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 3 - %myOtherInOut = getelementptr inbounds %fb_t, %fb_t* %0, i32 0, i32 4 - %deref = load i8*, i8** %myInOut, align 8 - %deref1 = load i8*, i8** %myOtherInOut, align 8 - %load_myOtherInOut = load i8, i8* %deref1, align 1 - store i8 %load_myOtherInOut, i8* %deref, align 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %myVar = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 0 + %myInput = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 1 + %myInOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 2 + %myOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 3 + %myOtherInOut = getelementptr inbounds nuw %fb_t, ptr %0, i32 0, i32 4 + %deref = load ptr, ptr %myInOut, align 8 + %deref1 = load ptr, ptr %myOtherInOut, align 8 + %load_myOtherInOut = load i8, ptr %deref1, align 1 + store i8 %load_myOtherInOut, ptr %deref, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__bitaccess_generated_as_rsh_and_trunc_i1.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__bitaccess_generated_as_rsh_and_trunc_i1.snap index a1721ecb4d6..8d6bfc7be20 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__bitaccess_generated_as_rsh_and_trunc_i1.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__bitaccess_generated_as_rsh_and_trunc_i1.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,20 +11,20 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_x = load i32, i32* %x, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_x = load i32, ptr %x, align 4 %shift = lshr i32 %load_x, 2 %1 = trunc i32 %shift to i8 %2 = and i8 %1, 1 - store i8 %2, i8* %a, align 1 - %load_y = load i32, i32* %y, align 4 + store i8 %2, ptr %a, align 1 + %load_y = load i32, ptr %y, align 4 %shift1 = ashr i32 %load_y, 4 %3 = trunc i32 %shift1 to i8 %4 = and i8 %3, 1 - store i8 %4, i8* %a, align 1 + store i8 %4, ptr %a, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__byteaccess_generated_as_rsh_and_trunc_i8.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__byteaccess_generated_as_rsh_and_trunc_i8.snap index 8d8d7b33e71..894707f0aa2 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__byteaccess_generated_as_rsh_and_trunc_i8.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__byteaccess_generated_as_rsh_and_trunc_i8.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,22 +11,22 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_x = load i32, i32* %x, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_x = load i32, ptr %x, align 4 %shift = lshr i32 %load_x, 0 %1 = trunc i32 %shift to i8 - store i8 %1, i8* %a, align 1 - %load_x1 = load i32, i32* %x, align 4 + store i8 %1, ptr %a, align 1 + %load_x1 = load i32, ptr %x, align 4 %shift2 = lshr i32 %load_x1, 8 %2 = trunc i32 %shift2 to i8 - store i8 %2, i8* %a, align 1 - %load_y = load i32, i32* %y, align 4 + store i8 %2, ptr %a, align 1 + %load_y = load i32, ptr %y, align 4 %shift3 = ashr i32 %load_y, 24 %3 = trunc i32 %shift3 to i8 - store i8 %3, i8* %a, align 1 + store i8 %3, ptr %a, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__dwordaccess_generated_as_rsh_and_trunc_i32.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__dwordaccess_generated_as_rsh_and_trunc_i32.snap index 41d653b2215..dcef203d302 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__dwordaccess_generated_as_rsh_and_trunc_i32.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__dwordaccess_generated_as_rsh_and_trunc_i32.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,22 +11,22 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_x = load i64, i64* %x, align 8 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_x = load i64, ptr %x, align 8 %shift = lshr i64 %load_x, 0 %1 = trunc i64 %shift to i32 - store i32 %1, i32* %a, align 4 - %load_x1 = load i64, i64* %x, align 8 + store i32 %1, ptr %a, align 4 + %load_x1 = load i64, ptr %x, align 8 %shift2 = lshr i64 %load_x1, 32 %2 = trunc i64 %shift2 to i32 - store i32 %2, i32* %a, align 4 - %load_y = load i64, i64* %y, align 8 + store i32 %2, ptr %a, align 4 + %load_y = load i64, ptr %y, align 8 %shift3 = ashr i64 %load_y, 32 %3 = trunc i64 %shift3 to i32 - store i32 %3, i32* %a, align 4 + store i32 %3, ptr %a, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__floating_point_type_casting.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__floating_point_type_casting.snap index 6cd27b62478..a9ea640d0ea 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__floating_point_type_casting.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__floating_point_type_casting.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,19 +16,19 @@ entry: %d = alloca double, align 8 %e = alloca double, align 8 %f = alloca double, align 8 - store float 3.000000e+00, float* %a, align 4 - store float 3.500000e+00, float* %b, align 4 - store float 3.500000e+00, float* %c, align 4 - store double 3.000000e+00, double* %d, align 8 - store double 3.500000e+00, double* %e, align 8 - store double 3.500000e+00, double* %f, align 8 - store i32 0, i32* %fn, align 4 - store float 3.000000e+00, float* %a, align 4 - store float 3.500000e+00, float* %b, align 4 - store float 3.500000e+00, float* %c, align 4 - store double 3.000000e+00, double* %d, align 8 - store double 3.500000e+00, double* %e, align 8 - store double 3.500000e+00, double* %f, align 8 - %fn_ret = load i32, i32* %fn, align 4 + store float 3.000000e+00, ptr %a, align 4 + store float 3.500000e+00, ptr %b, align 4 + store float 3.500000e+00, ptr %c, align 4 + store double 3.000000e+00, ptr %d, align 8 + store double 3.500000e+00, ptr %e, align 8 + store double 3.500000e+00, ptr %f, align 8 + store i32 0, ptr %fn, align 4 + store float 3.000000e+00, ptr %a, align 4 + store float 3.500000e+00, ptr %b, align 4 + store float 3.500000e+00, ptr %c, align 4 + store double 3.000000e+00, ptr %d, align 8 + store double 3.500000e+00, ptr %e, align 8 + store double 3.500000e+00, ptr %f, align 8 + %fn_ret = load i32, ptr %fn, align 4 ret i32 %fn_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_aliased_string.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_aliased_string.snap index b09d8adf8c3..ac10a43fe37 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_aliased_string.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_aliased_string.snap @@ -1,49 +1,40 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -declare void @CONCAT(i8*, i8*, i8*) +declare void @CONCAT(ptr, ptr, ptr) -define i8 @LIST_ADD(i8* %0, i8* %1) { +define i8 @LIST_ADD(ptr %0, ptr %1) { entry: %LIST_ADD = alloca i8, align 1 %INS = alloca [1001 x i8], align 1 - %bitcast = bitcast [1001 x i8]* %INS to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1001, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1000, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %INS, i8 0, i64 1001, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %INS, ptr align 1 %0, i64 1000, i1 false) %sx = alloca [2 x i8], align 1 - %bitcast1 = bitcast [2 x i8]* %sx to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 2, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1, i1 false) - store i8 0, i8* %LIST_ADD, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %sx, i8 0, i64 2, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %sx, ptr align 1 %1, i64 1, i1 false) + store i8 0, ptr %LIST_ADD, align 1 %__CONCAT0 = alloca [1025 x i8], align 1 - %2 = bitcast [1025 x i8]* %__CONCAT0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([1025 x i8]* getelementptr ([1025 x i8], [1025 x i8]* null, i32 1) to i64), i1 false) - %3 = bitcast [1025 x i8]* %__CONCAT0 to i8* - %4 = bitcast [2 x i8]* %sx to i8* - %5 = bitcast [1001 x i8]* %INS to i8* - call void @CONCAT(i8* %3, i8* %4, i8* %5) - %6 = bitcast [1001 x i8]* %INS to i8* - %7 = bitcast [1025 x i8]* %__CONCAT0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %6, i8* align 1 %7, i32 1000, i1 false) - %LIST_ADD_ret = load i8, i8* %LIST_ADD, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %__CONCAT0, i8 0, i64 ptrtoint (ptr getelementptr ([1025 x i8], ptr null, i32 1) to i64), i1 false) + call void @CONCAT(ptr %__CONCAT0, ptr %sx, ptr %INS) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %INS, ptr align 1 %__CONCAT0, i32 1000, i1 false) + %LIST_ADD_ret = load i8, ptr %LIST_ADD, align 1 ret i8 %LIST_ADD_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_string.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_string.snap index b09d8adf8c3..ac10a43fe37 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_string.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__function_result_assignment_on_string.snap @@ -1,49 +1,40 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -declare void @CONCAT(i8*, i8*, i8*) +declare void @CONCAT(ptr, ptr, ptr) -define i8 @LIST_ADD(i8* %0, i8* %1) { +define i8 @LIST_ADD(ptr %0, ptr %1) { entry: %LIST_ADD = alloca i8, align 1 %INS = alloca [1001 x i8], align 1 - %bitcast = bitcast [1001 x i8]* %INS to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1001, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1000, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %INS, i8 0, i64 1001, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %INS, ptr align 1 %0, i64 1000, i1 false) %sx = alloca [2 x i8], align 1 - %bitcast1 = bitcast [2 x i8]* %sx to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 2, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1, i1 false) - store i8 0, i8* %LIST_ADD, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %sx, i8 0, i64 2, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %sx, ptr align 1 %1, i64 1, i1 false) + store i8 0, ptr %LIST_ADD, align 1 %__CONCAT0 = alloca [1025 x i8], align 1 - %2 = bitcast [1025 x i8]* %__CONCAT0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([1025 x i8]* getelementptr ([1025 x i8], [1025 x i8]* null, i32 1) to i64), i1 false) - %3 = bitcast [1025 x i8]* %__CONCAT0 to i8* - %4 = bitcast [2 x i8]* %sx to i8* - %5 = bitcast [1001 x i8]* %INS to i8* - call void @CONCAT(i8* %3, i8* %4, i8* %5) - %6 = bitcast [1001 x i8]* %INS to i8* - %7 = bitcast [1025 x i8]* %__CONCAT0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %6, i8* align 1 %7, i32 1000, i1 false) - %LIST_ADD_ret = load i8, i8* %LIST_ADD, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %__CONCAT0, i8 0, i64 ptrtoint (ptr getelementptr ([1025 x i8], ptr null, i32 1) to i64), i1 false) + call void @CONCAT(ptr %__CONCAT0, ptr %sx, ptr %INS) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %INS, ptr align 1 %__CONCAT0, i32 1000, i1 false) + %LIST_ADD_ret = load i8, ptr %LIST_ADD, align 1 ret i8 %LIST_ADD_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__nested_bitwise_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__nested_bitwise_access.snap index 17cd18851d4..fbb41891982 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__nested_bitwise_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__nested_bitwise_access.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,11 +11,11 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i64, i64* %x, align 8 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i64, ptr %x, align 8 %shift = lshr i64 %load_x, 32 %1 = trunc i64 %shift to i32 %shift1 = lshr i32 %1, 16 @@ -25,6 +24,6 @@ entry: %3 = trunc i16 %shift2 to i8 %shift3 = lshr i8 %3, 1 %4 = and i8 %shift3, 1 - store i8 %4, i8* %a, align 1 + store i8 %4, ptr %a, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__variable_based_bitwise_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__variable_based_bitwise_access.snap index 67d8d31730f..9f72c816365 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__variable_based_bitwise_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__variable_based_bitwise_access.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,23 +11,23 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %load_x = load i16, i16* %x, align 2 - %load_y = load i16, i16* %y, align 2 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + %load_x = load i16, ptr %x, align 2 + %load_y = load i16, ptr %y, align 2 %shift = ashr i16 %load_x, %load_y %1 = trunc i16 %shift to i8 %2 = and i8 %1, 1 - store i8 %2, i8* %a, align 1 - %load_x1 = load i16, i16* %x, align 2 - %load_y2 = load i16, i16* %y, align 2 + store i8 %2, ptr %a, align 1 + %load_x1 = load i16, ptr %x, align 2 + %load_y2 = load i16, ptr %y, align 2 %3 = mul i16 %load_y2, 8 %shift3 = ashr i16 %load_x1, %3 %4 = trunc i16 %shift3 to i8 - store i8 %4, i8* %b, align 1 + store i8 %4, ptr %b, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__wordaccess_generated_as_rsh_and_trunc_i16.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__wordaccess_generated_as_rsh_and_trunc_i16.snap index 6b101f4f96e..87c04e8d438 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__wordaccess_generated_as_rsh_and_trunc_i16.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__statement_codegen_test__wordaccess_generated_as_rsh_and_trunc_i16.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/statement_codegen_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,22 +11,22 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_x = load i32, i32* %x, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_x = load i32, ptr %x, align 4 %shift = lshr i32 %load_x, 0 %1 = trunc i32 %shift to i16 - store i16 %1, i16* %a, align 2 - %load_x1 = load i32, i32* %x, align 4 + store i16 %1, ptr %a, align 2 + %load_x1 = load i32, ptr %x, align 4 %shift2 = lshr i32 %load_x1, 16 %2 = trunc i32 %shift2 to i16 - store i16 %2, i16* %a, align 2 - %load_y = load i32, i32* %y, align 4 + store i16 %2, ptr %a, align 2 + %load_y = load i32, ptr %y, align 4 %shift3 = ashr i32 %load_y, 16 %3 = trunc i32 %shift3 to i16 - store i16 %3, i16* %a, align 2 + store i16 %3, ptr %a, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__casted_string_assignment_uses_memcpy.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__casted_string_assignment_uses_memcpy.snap index 126b22f3f9b..ba3f6863dbb 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__casted_string_assignment_uses_memcpy.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__casted_string_assignment_uses_memcpy.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,22 +13,18 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [4 x i8] c"abc\00" @utf16_literal_0 = private unnamed_addr constant [4 x i16] [i16 97, i16 98, i16 99, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %a to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 80, i1 false) - %2 = bitcast [81 x i8]* %a to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 80, i1 false) - %3 = bitcast [81 x i16]* %b to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %3, i8* align 2 bitcast ([4 x i16]* @utf16_literal_0 to i8*), i32 160, i1 false) - %4 = bitcast [81 x i16]* %b to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %4, i8* align 2 bitcast ([4 x i16]* @utf16_literal_0 to i8*), i32 160, i1 false) + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 @utf08_literal_0, i32 80, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 @utf08_literal_0, i32 80, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %b, ptr align 2 @utf16_literal_0, i32 160, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %b, ptr align 2 @utf16_literal_0, i32 160, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returning_generic_string_should_return_by_ref.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returning_generic_string_should_return_by_ref.snap index 6c195137032..8ac95ca400f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returning_generic_string_should_return_by_ref.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returning_generic_string_should_return_by_ref.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,42 +12,37 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [4 x i8] c"abc\00" -define void @MID__STRING(i8* %0, i8* %1, i32 %2, i32 %3) { +define void @MID__STRING(ptr %0, ptr %1, i32 %2, i32 %3) { entry: - %MID__STRING = alloca i8*, align 8 - store i8* %0, i8** %MID__STRING, align 8 - %IN = alloca i8*, align 8 - store i8* %1, i8** %IN, align 8 + %MID__STRING = alloca ptr, align 8 + store ptr %0, ptr %MID__STRING, align 8 + %IN = alloca ptr, align 8 + store ptr %1, ptr %IN, align 8 %L = alloca i32, align 4 - store i32 %2, i32* %L, align 4 + store i32 %2, ptr %L, align 4 %P = alloca i32, align 4 - store i32 %3, i32* %P, align 4 - %deref = load i8*, i8** %MID__STRING, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 4, i1 false) + store i32 %3, ptr %P, align 4 + %deref = load ptr, ptr %MID__STRING, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 4, i1 false) ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %fmt = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 1 + %fmt = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 %__MID0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__MID0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__MID0 to i8* - %3 = bitcast [61 x i8]* %fmt to i8* - call void @MID__STRING(i8* %2, i8* %3, i32 1, i32 2) - %4 = bitcast [81 x i8]* %x to i8* - %5 = bitcast [81 x i8]* %__MID0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %4, i8* align 1 %5, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__MID0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @MID__STRING(ptr %__MID0, ptr %fmt, i32 1, i32 2) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %x, ptr align 1 %__MID0, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returns_a_literal_string.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returns_a_literal_string.snap index 90eb2240f3b..17d47236db5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returns_a_literal_string.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_returns_a_literal_string.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: program -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,34 +12,30 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [4 x i8] c"abc\00" -define void @ret(i8* %0) { +define void @ret(ptr %0) { entry: - %ret = alloca i8*, align 8 - store i8* %0, i8** %ret, align 8 - %deref = load i8*, i8** %ret, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @utf08_literal_0, i32 0, i32 0), i32 4, i1 false) + %ret = alloca ptr, align 8 + store ptr %0, ptr %ret, align 8 + %deref = load ptr, ptr %ret, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 4, i1 false) ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %str = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %str = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %__ret0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__ret0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__ret0 to i8* - call void @ret(i8* %2) - %3 = bitcast [81 x i8]* %str to i8* - %4 = bitcast [81 x i8]* %__ret0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__ret0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @ret(ptr %__ret0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %str, ptr align 1 %__ret0, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_takes_string_paramter_and_returns_string.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_takes_string_paramter_and_returns_string.snap index bd58250aa9f..dc3bb1bc675 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_takes_string_paramter_and_returns_string.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_takes_string_paramter_and_returns_string.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: program -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,42 +12,36 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @utf08_literal_0 = private unnamed_addr constant [154 x i8] c"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\00" -define void @read_string(i8* %0, i8* %1) { +define void @read_string(ptr %0, ptr %1) { entry: - %read_string = alloca i8*, align 8 - store i8* %0, i8** %read_string, align 8 + %read_string = alloca ptr, align 8 + store ptr %0, ptr %read_string, align 8 %to_read = alloca [81 x i8], align 1 - %bitcast = bitcast [81 x i8]* %to_read to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 81, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %1, i64 80, i1 false) - %deref = load i8*, i8** %read_string, align 8 - %2 = bitcast [81 x i8]* %to_read to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 %2, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %to_read, i8 0, i64 81, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %to_read, ptr align 1 %1, i64 80, i1 false) + %deref = load ptr, ptr %read_string, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 %to_read, i32 80, i1 false) ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %text1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 + %text1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 %__read_string0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__read_string0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__read_string0 to i8* - call void @read_string(i8* %2, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @utf08_literal_0, i32 0, i32 0)) - %3 = bitcast [81 x i8]* %text1 to i8* - %4 = bitcast [81 x i8]* %__read_string0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__read_string0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @read_string(ptr %__read_string0, ptr @utf08_literal_0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %text1, ptr align 1 %__read_string0, i32 80, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_var_constant_strings_should_be_collected_as_literals.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_var_constant_strings_should_be_collected_as_literals.snap index 9a84df2baae..aa5e526bf86 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_var_constant_strings_should_be_collected_as_literals.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__function_var_constant_strings_should_be_collected_as_literals.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,23 +17,19 @@ entry: %FSTRING_TO_DT = alloca i64, align 8 %ignore = alloca [2 x i8], align 1 %fchar = alloca [2 x i8], align 1 - %0 = bitcast [2 x i8]* %ignore to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.ignore__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x i8]* %fchar to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.fchar__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - store i64 0, i64* %FSTRING_TO_DT, align 8 - %2 = bitcast [2 x i8]* %fchar to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_0, i32 0, i32 0), i32 1, i1 false) - %3 = bitcast [2 x i8]* %ignore to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @utf08_literal_1, i32 0, i32 0), i32 1, i1 false) - %FSTRING_TO_DT_ret = load i64, i64* %FSTRING_TO_DT, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %ignore, ptr align 1 @__FSTRING_TO_DT.ignore__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fchar, ptr align 1 @__FSTRING_TO_DT.fchar__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + store i64 0, ptr %FSTRING_TO_DT, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %fchar, ptr align 1 @utf08_literal_0, i32 1, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %ignore, ptr align 1 @utf08_literal_1, i32 1, i1 false) + %FSTRING_TO_DT_ret = load i64, ptr %FSTRING_TO_DT, align 8 ret i64 %FSTRING_TO_DT_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_string_output.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_string_output.snap index eda1adb316a..05b0248bc6e 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_string_output.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_string_output.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,30 +15,26 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [7 x i8] c"string\00" @utf16_literal_0 = private unnamed_addr constant [8 x i16] [i16 119, i16 115, i16 116, i16 114, i16 105, i16 110, i16 103, i16 0] -define void @prog(%prog* %0) { +define void @prog(ptr %0) { entry: - %output1 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 0 - %output2 = getelementptr inbounds %prog, %prog* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %output1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([7 x i8], [7 x i8]* @utf08_literal_0, i32 0, i32 0), i32 7, i1 false) - %2 = bitcast [81 x i16]* %output2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([8 x i16]* @utf16_literal_0 to i8*), i32 16, i1 false) + %output1 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 0 + %output2 = getelementptr inbounds nuw %prog, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %output1, ptr align 1 @utf08_literal_0, i32 7, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %output2, ptr align 2 @utf16_literal_0, i32 16, i1 false) ret void } -define void @main(%main* %0) { +define void @main(ptr %0) { entry: - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %y = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - call void @prog(%prog* @prog_instance) - %1 = bitcast [7 x i8]* %x to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 0, i32 0), i32 6, i1 false) - %2 = bitcast [8 x i16]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([81 x i16]* getelementptr inbounds (%prog, %prog* @prog_instance, i32 0, i32 1) to i8*), i32 14, i1 false) + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + call void @prog(ptr @prog_instance) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %x, ptr align 1 @prog_instance, i32 6, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %y, ptr align 2 getelementptr inbounds nuw (%prog, ptr @prog_instance, i32 0, i32 1), i32 14, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_casted_string_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_casted_string_assignment.snap index ded08f4b7ae..7448fe23c2b 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_casted_string_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_casted_string_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,18 +15,16 @@ target triple = "[filtered]" @utf16_literal_0 = private unnamed_addr constant [12 x i16] [i16 105, i16 109, i16 32, i16 97, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] @utf16_literal_1 = private unnamed_addr constant [18 x i16] [i16 105, i16 109, i16 32, i16 97, i16 32, i16 117, i16 116, i16 102, i16 49, i16 54, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([12 x i8], [12 x i8]* @utf08_literal_0, i32 0, i32 0), i32 80, i1 false) - %2 = bitcast [81 x i16]* %z to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([18 x i16]* @utf16_literal_1 to i8*), i32 160, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 @utf08_literal_0, i32 80, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %z, ptr align 2 @utf16_literal_1, i32 160, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_string_type_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_string_type_assignment.snap index 1e7ae940a06..cc98b077af6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_string_type_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__program_with_string_type_assignment.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -17,21 +16,18 @@ target triple = "[filtered]" @utf08_literal_1 = private unnamed_addr constant [17 x i8] c"im also a genius\00" @utf16_literal_0 = private unnamed_addr constant [17 x i16] [i16 105, i16 109, i16 32, i16 97, i16 108, i16 115, i16 111, i16 32, i16 97, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %zz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %1 = bitcast [81 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([12 x i8], [12 x i8]* @utf08_literal_0, i32 0, i32 0), i32 12, i1 false) - %2 = bitcast [100 x i8]* %z to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([17 x i8], [17 x i8]* @utf08_literal_1, i32 0, i32 0), i32 17, i1 false) - %3 = bitcast [100 x i16]* %zz to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %3, i8* align 2 bitcast ([17 x i16]* @utf16_literal_0 to i8*), i32 34, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %zz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 @utf08_literal_0, i32 12, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %z, ptr align 1 @utf08_literal_1, i32 17, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %zz, ptr align 2 @utf16_literal_0, i32 34, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__string_function_parameters.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__string_function_parameters.snap index cb54b24a66e..6aef1d41615 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__string_function_parameters.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__string_function_parameters.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -14,45 +13,40 @@ target triple = "[filtered]" @__prg.s__init = unnamed_addr constant [11 x i8] c"hello\00\00\00\00\00\00" @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" -define i16 @foo(i8* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %s = alloca [81 x i8], align 1 - %bitcast = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 81, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 80, i1 false) - store i16 0, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 81, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %s, ptr align 1 %0, i64 80, i1 false) + store i16 0, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret buffer_block: ; No predecessors! - %foo_ret1 = load i16, i16* %foo, align 2 + %foo_ret1 = load i16, ptr %foo, align 2 ret i16 %foo_ret1 } -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %s = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %a to i8* - %2 = bitcast [11 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 %2, i32 11, i1 false) - %3 = bitcast [81 x i8]* %a to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %4 = bitcast [11 x i8]* %s to i8* - %call = call i16 @foo(i8* %4) - %call1 = call i16 @foo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0)) + %s = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 %s, i32 11, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 @utf08_literal_0, i32 6, i1 false) + %call = call i16 @foo(ptr %s) + %call1 = call i16 @foo(ptr @utf08_literal_0) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable.snap index 241e0170deb..5b6e50dcee4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,15 +10,15 @@ target triple = "[filtered]" @__FSTRING_TO_DT.ignore__init = unnamed_addr constant [2 x i8] c"*\00" @__FSTRING_TO_DT.fchar__init = unnamed_addr constant [2 x i8] c"#\00" -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 - %op1 = alloca i8*, align 8 - store i8* %0, i8** %op1, align 8 - %op2 = alloca i8*, align 8 - store i8* %1, i8** %op2, align 8 - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + %op1 = alloca ptr, align 8 + store ptr %0, ptr %op1, align 8 + %op2 = alloca ptr, align 8 + store ptr %1, ptr %op2, align 8 + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -29,32 +28,27 @@ entry: %ignore = alloca [2 x i8], align 1 %fchar = alloca [2 x i8], align 1 %c = alloca [2 x i8], align 1 - %0 = bitcast [2 x i8]* %ignore to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.ignore__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x i8]* %fchar to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.fchar__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [2 x i8]* %c to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - store i64 0, i64* %FSTRING_TO_DT, align 8 - %3 = bitcast [2 x i8]* %c to i8* - %4 = bitcast [2 x i8]* %ignore to i8* - %call = call i8 @STRING_EQUAL(i8* %3, i8* %4) - %5 = icmp ne i8 %call, 0 - br i1 %5, label %condition_body, label %continue + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %ignore, ptr align 1 @__FSTRING_TO_DT.ignore__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fchar, ptr align 1 @__FSTRING_TO_DT.fchar__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %c, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + store i64 0, ptr %FSTRING_TO_DT, align 8 + %call = call i8 @STRING_EQUAL(ptr %c, ptr %ignore) + %0 = icmp ne i8 %call, 0 + br i1 %0, label %condition_body, label %continue condition_body: ; preds = %entry br label %continue continue: ; preds = %condition_body, %entry - %FSTRING_TO_DT_ret = load i64, i64* %FSTRING_TO_DT, align 8 + %FSTRING_TO_DT_ret = load i64, ptr %FSTRING_TO_DT, align 8 ret i64 %FSTRING_TO_DT_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable_nonref.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable_nonref.snap index 99fa5afe981..5d0ece5fc14 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable_nonref.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__using_a_constant_var_string_should_be_memcpyable_nonref.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,19 +10,17 @@ target triple = "[filtered]" @__FSTRING_TO_DT.ignore__init = unnamed_addr constant [2 x i8] c"*\00" @__FSTRING_TO_DT.fchar__init = unnamed_addr constant [2 x i8] c"#\00" -define i8 @STRING_EQUAL(i8* %0, i8* %1) { +define i8 @STRING_EQUAL(ptr %0, ptr %1) { entry: %STRING_EQUAL = alloca i8, align 1 %op1 = alloca [1025 x i8], align 1 - %bitcast = bitcast [1025 x i8]* %op1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 1024, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %op1, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op1, ptr align 1 %0, i64 1024, i1 false) %op2 = alloca [1025 x i8], align 1 - %bitcast1 = bitcast [1025 x i8]* %op2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast1, i8 0, i64 1025, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast1, i8* align 1 %1, i64 1024, i1 false) - store i8 0, i8* %STRING_EQUAL, align 1 - %STRING_EQUAL_ret = load i8, i8* %STRING_EQUAL, align 1 + call void @llvm.memset.p0.i64(ptr align 1 %op2, i8 0, i64 1025, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %op2, ptr align 1 %1, i64 1024, i1 false) + store i8 0, ptr %STRING_EQUAL, align 1 + %STRING_EQUAL_ret = load i8, ptr %STRING_EQUAL, align 1 ret i8 %STRING_EQUAL_ret } @@ -33,32 +30,27 @@ entry: %ignore = alloca [2 x i8], align 1 %fchar = alloca [2 x i8], align 1 %c = alloca [2 x i8], align 1 - %0 = bitcast [2 x i8]* %ignore to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.ignore__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - %1 = bitcast [2 x i8]* %fchar to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds ([2 x i8], [2 x i8]* @__FSTRING_TO_DT.fchar__init, i32 0, i32 0), i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [2 x i8]* %c to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %2, i8 0, i64 ptrtoint ([2 x i8]* getelementptr ([2 x i8], [2 x i8]* null, i32 1) to i64), i1 false) - store i64 0, i64* %FSTRING_TO_DT, align 8 - %3 = bitcast [2 x i8]* %c to i8* - %4 = bitcast [2 x i8]* %ignore to i8* - %call = call i8 @STRING_EQUAL(i8* %3, i8* %4) - %5 = icmp ne i8 %call, 0 - br i1 %5, label %condition_body, label %continue + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %ignore, ptr align 1 @__FSTRING_TO_DT.ignore__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fchar, ptr align 1 @__FSTRING_TO_DT.fchar__init, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %c, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i8], ptr null, i32 1) to i64), i1 false) + store i64 0, ptr %FSTRING_TO_DT, align 8 + %call = call i8 @STRING_EQUAL(ptr %c, ptr %ignore) + %0 = icmp ne i8 %call, 0 + br i1 %0, label %condition_body, label %continue condition_body: ; preds = %entry br label %continue continue: ; preds = %condition_body, %entry - %FSTRING_TO_DT_ret = load i64, i64* %FSTRING_TO_DT, align 8 + %FSTRING_TO_DT_ret = load i64, ptr %FSTRING_TO_DT, align 8 ret i64 %FSTRING_TO_DT_ret } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_can_be_created.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_can_be_created.snap index 9bafab43fb5..99325aed641 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_can_be_created.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_can_be_created.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -16,20 +15,18 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [12 x i8] c"im a genius\00" @utf16_literal_0 = private unnamed_addr constant [12 x i16] [i16 105, i16 109, i16 32, i16 97, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %wy = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %wz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %1 = bitcast [16 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([12 x i8], [12 x i8]* @utf08_literal_0, i32 0, i32 0), i32 12, i1 false) - %2 = bitcast [16 x i16]* %wy to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([12 x i16]* @utf16_literal_0 to i8*), i32 24, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %wy = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %wz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 @utf08_literal_0, i32 12, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %wy, ptr align 2 @utf16_literal_0, i32 24, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_using_constants_can_be_created.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_using_constants_can_be_created.snap index ef7b653a81e..08462dcbccf 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_using_constants_can_be_created.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_length_strings_using_constants_can_be_created.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -18,20 +17,18 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [12 x i8] c"im a genius\00" @utf16_literal_0 = private unnamed_addr constant [12 x i16] [i16 105, i16 109, i16 32, i16 97, i16 32, i16 103, i16 101, i16 110, i16 105, i16 117, i16 115, i16 0] -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %wy = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %wz = getelementptr inbounds %prg, %prg* %0, i32 0, i32 3 - %1 = bitcast [16 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([12 x i8], [12 x i8]* @utf08_literal_0, i32 0, i32 0), i32 12, i1 false) - %2 = bitcast [31 x i16]* %wy to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %2, i8* align 2 bitcast ([12 x i16]* @utf16_literal_0 to i8*), i32 24, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %wy = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %wz = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 @utf08_literal_0, i32 12, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 2 %wy, ptr align 2 @utf16_literal_0, i32 24, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_string_assignment_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_string_assignment_test.snap index 2cff91b9fcb..39c9cebacd5 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_string_assignment_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__variable_string_assignment_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,20 +12,16 @@ target triple = "[filtered]" @prg_instance = global %prg { [16 x i8] zeroinitializer, [31 x i8] c"xyz\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" } @__prg.z__init = unnamed_addr constant [31 x i8] c"xyz\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [16 x i8]* %y to i8* - %2 = bitcast [31 x i8]* %z to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 %2, i32 15, i1 false) - %3 = bitcast [31 x i8]* %z to i8* - %4 = bitcast [16 x i8]* %y to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 16, i1 false) + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 %z, i32 15, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %z, ptr align 1 %y, i32 16, i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__vartmp_string_init_test.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__vartmp_string_init_test.snap index 43d6a4cebf1..8170a03e4af 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__vartmp_string_init_test.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__vartmp_string_init_test.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/string_tests.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,22 +12,20 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer @__prg.z__init = unnamed_addr constant [31 x i8] c"xyz\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: %y = alloca [16 x i8], align 1 %z = alloca [31 x i8], align 1 - %1 = bitcast [16 x i8]* %y to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([16 x i8]* getelementptr ([16 x i8], [16 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [31 x i8]* %z to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 getelementptr inbounds ([31 x i8], [31 x i8]* @__prg.z__init, i32 0, i32 0), i64 ptrtoint ([31 x i8]* getelementptr ([31 x i8], [31 x i8]* null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %y, i8 0, i64 ptrtoint (ptr getelementptr ([16 x i8], ptr null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %z, ptr align 1 @__prg.z__init, i64 ptrtoint (ptr getelementptr ([31 x i8], ptr null, i32 1) to i64), i1 false) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn writeonly } -attributes #1 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__aliased_datatypes_respect_conversion_rules.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__aliased_datatypes_respect_conversion_rules.snap index b50bdd1cfb8..4b8da5c6556 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__aliased_datatypes_respect_conversion_rules.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__aliased_datatypes_respect_conversion_rules.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,20 +11,20 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i8, i8* %b, align 1 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i8, ptr %b, align 1 %1 = sext i8 %load_b to i32 - %load_c = load i32, i32* %c, align 4 + %load_c = load i32, ptr %c, align 4 %tmpVar = add i32 %1, %load_c - store i32 %tmpVar, i32* %x, align 4 - %load_c1 = load i32, i32* %c, align 4 - %load_x = load i32, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 + %load_c1 = load i32, ptr %c, align 4 + %load_x = load i32, ptr %x, align 4 %tmpVar2 = add i32 %load_c1, %load_x %2 = trunc i32 %tmpVar2 to i8 - store i8 %2, i8* %b, align 1 + store i8 %2, ptr %b, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_larger_than_int_promote_the_second_operand.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_larger_than_int_promote_the_second_operand.snap index ece4ed7e3fa..a9e6d18f836 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_larger_than_int_promote_the_second_operand.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_larger_than_int_promote_the_second_operand.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i32, i32* %b, align 4 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i32, ptr %b, align 4 %1 = sext i32 %load_b to i64 - %load_c = load i64, i64* %c, align 8 + %load_c = load i64, ptr %c, align 8 %tmpVar = add i64 %1, %load_c - store i64 %tmpVar, i64* %x, align 8 + store i64 %tmpVar, ptr %x, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_smaller_than_dint_promoted_to_dint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_smaller_than_dint_promoted_to_dint.snap index c40964af676..20ed905233f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_smaller_than_dint_promoted_to_dint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__datatypes_smaller_than_dint_promoted_to_dint.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i8, i8* %b, align 1 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i8, ptr %b, align 1 %1 = sext i8 %load_b to i32 - %load_c = load i32, i32* %c, align 4 + %load_c = load i32, ptr %c, align 4 %tmpVar = add i32 %1, %load_c - store i32 %tmpVar, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__even_all_sint_expressions_fallback_to_dint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__even_all_sint_expressions_fallback_to_dint.snap index b32301e40ed..b4d22943f60 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__even_all_sint_expressions_fallback_to_dint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__even_all_sint_expressions_fallback_to_dint.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,17 +11,17 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i8, i8* %b, align 1 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i8, ptr %b, align 1 %1 = sext i8 %load_b to i32 - %load_c = load i8, i8* %c, align 1 + %load_c = load i8, ptr %c, align 1 %2 = sext i8 %load_c to i32 %tmpVar = add i32 %1, %2 %3 = trunc i32 %tmpVar to i8 - store i8 %3, i8* %x, align 1 + store i8 %3, ptr %x, align 1 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_and_double_mix_converted_to_double.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_and_double_mix_converted_to_double.snap index d50d134b5ef..64ce638fe54 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_and_double_mix_converted_to_double.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_and_double_mix_converted_to_double.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load double, double* %b, align 8 - %load_a = load float, float* %a, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load double, ptr %b, align 8 + %load_a = load float, ptr %a, align 4 %1 = fpext float %load_a to double %tmpVar = fadd double %load_b, %1 - store double %tmpVar, double* %c, align 8 + store double %tmpVar, ptr %c, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assigned_to_int_is_cast.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assigned_to_int_is_cast.snap index d7f26b22d9d..0f67b628ace 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assigned_to_int_is_cast.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assigned_to_int_is_cast.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_c = load float, float* %c, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_c = load float, ptr %c, align 4 %1 = fptosi float %load_c to i16 - store i16 %1, i16* %a, align 2 - %load_c1 = load float, float* %c, align 4 + store i16 %1, ptr %a, align 2 + %load_c1 = load float, ptr %c, align 4 %2 = fptoui float %load_c1 to i16 - store i16 %2, i16* %b, align 2 + store i16 %2, ptr %b, align 2 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assinged_to_double_to_double.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assinged_to_double_to_double.snap index fa2e3717cb5..2b15ec5ecc6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assinged_to_double_to_double.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__float_assinged_to_double_to_double.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_a = load float, float* %a, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_a = load float, ptr %a, align 4 %1 = fpext float %load_a to double - store double %1, double* %b, align 8 + store double %1, ptr %b, align 8 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_assigned_to_float_is_cast.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_assigned_to_float_is_cast.snap index ff62d286d59..d29bf4420cc 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_assigned_to_float_is_cast.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_assigned_to_float_is_cast.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,16 +11,16 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_a = load i16, i16* %a, align 2 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_a = load i16, ptr %a, align 2 %1 = sitofp i16 %load_a to float - store float %1, float* %c, align 4 - %load_b = load i16, i16* %b, align 2 + store float %1, ptr %c, align 4 + %load_b = load i16, ptr %b, align 2 %2 = uitofp i16 %load_b to float - store float %2, float* %c, align 4 + store float %2, ptr %c, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_byte_promoted_on_compare_statement.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_byte_promoted_on_compare_statement.snap index 1c6d4d41ca4..a7166e0f1f4 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_byte_promoted_on_compare_statement.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_byte_promoted_on_compare_statement.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,12 +11,12 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_b = load i64, i64* %b, align 8 - %load_a = load i8, i8* %a, align 1 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_b = load i64, ptr %b, align 8 + %load_a = load i8, ptr %a, align 1 %1 = zext i8 %load_a to i64 %tmpVar = icmp slt i64 %load_b, %1 ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_float_converted_to_double.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_float_converted_to_double.snap index 1d4af0214eb..2a17d08fc13 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_float_converted_to_double.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_bigger_than_float_converted_to_double.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,13 +11,13 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_b = load i64, i64* %b, align 8 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_b = load i64, ptr %b, align 8 %1 = sitofp i64 %load_b to double - %load_a = load float, float* %a, align 4 + %load_a = load float, ptr %a, align 4 %2 = fpext float %load_a to double %tmpVar = fadd double %1, %2 ret void diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_smaller_or_equal_to_float_converted_to_float.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_smaller_or_equal_to_float_converted_to_float.snap index bc81fe80caf..65c8c51b740 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_smaller_or_equal_to_float_converted_to_float.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__int_smaller_or_equal_to_float_converted_to_float.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i16, i16* %b, align 2 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i16, ptr %b, align 2 %1 = sitofp i16 %load_b to float - %load_a = load float, float* %a, align 4 + %load_a = load float, ptr %a, align 4 %tmpVar = fadd float %1, %load_a - store float %tmpVar, float* %c, align 4 + store float %tmpVar, ptr %c, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__numerical_promotion_for_variadic_functions_without_declaration.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__numerical_promotion_for_variadic_functions_without_declaration.snap index b3cbb90e9ac..e02ef5998a9 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__numerical_promotion_for_variadic_functions_without_declaration.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__numerical_promotion_for_variadic_functions_without_declaration.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -13,30 +12,28 @@ target triple = "[filtered]" @main_instance = global %main zeroinitializer @__main.s__init = unnamed_addr constant [81 x i8] c"\0A numbers: %f %f %f %d \0A \0A\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) -define void @main(%main* %0) { +define void @main(ptr %0) { entry: %s = alloca [81 x i8], align 1 %float = alloca float, align 4 %double = alloca double, align 8 %integer = alloca i16, align 2 - %1 = bitcast [81 x i8]* %s to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 getelementptr inbounds ([81 x i8], [81 x i8]* @__main.s__init, i32 0, i32 0), i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - store float 3.000000e+00, float* %float, align 4 - store double 3.000000e+00, double* %double, align 8 - store i16 3, i16* %integer, align 2 - %2 = bitcast [81 x i8]* %s to i8* - %load_float = load float, float* %float, align 4 - %3 = fpext float %load_float to double - %load_double = load double, double* %double, align 8 - %load_integer = load i16, i16* %integer, align 2 - %4 = sext i16 %load_integer to i32 - %call = call i32 (i8*, ...) @printf(i8* %2, double 3.000000e+00, double %3, double %load_double, i32 %4) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %s, ptr align 1 @__main.s__init, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + store float 3.000000e+00, ptr %float, align 4 + store double 3.000000e+00, ptr %double, align 8 + store i16 3, ptr %integer, align 2 + %load_float = load float, ptr %float, align 4 + %1 = fpext float %load_float to double + %load_double = load double, ptr %double, align 8 + %load_integer = load i16, ptr %integer, align 2 + %2 = sext i16 %load_integer to i32 + %call = call i32 (ptr, ...) @printf(ptr %s, double 3.000000e+00, double %1, double %load_double, i32 %2) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__small_int_varargs_get_promoted_while_32bit_and_higher_keep_their_type.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__small_int_varargs_get_promoted_while_32bit_and_higher_keep_their_type.snap index 47ff568e0c3..fd06629f215 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__small_int_varargs_get_promoted_while_32bit_and_higher_keep_their_type.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__small_int_varargs_get_promoted_while_32bit_and_higher_keep_their_type.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -11,7 +10,7 @@ target triple = "[filtered]" @utf08_literal_0 = private unnamed_addr constant [26 x i8] c"(d) result : %d %d %d %u\0A\00" @utf08_literal_1 = private unnamed_addr constant [27 x i8] c"(hd) result : %hd %hd %hd\0A\00" -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) define i32 @main() { entry: @@ -20,22 +19,22 @@ entry: %out2 = alloca i32, align 4 %out3 = alloca i64, align 8 %out4 = alloca i32, align 4 - store i16 -1, i16* %out1, align 2 - store i32 -1, i32* %out2, align 4 - store i64 -1, i64* %out3, align 8 - store i32 -1, i32* %out4, align 4 - store i32 0, i32* %main, align 4 - %load_out1 = load i16, i16* %out1, align 2 + store i16 -1, ptr %out1, align 2 + store i32 -1, ptr %out2, align 4 + store i64 -1, ptr %out3, align 8 + store i32 -1, ptr %out4, align 4 + store i32 0, ptr %main, align 4 + %load_out1 = load i16, ptr %out1, align 2 %0 = sext i16 %load_out1 to i32 - %load_out2 = load i32, i32* %out2, align 4 - %load_out3 = load i64, i64* %out3, align 8 - %load_out4 = load i32, i32* %out4, align 4 - %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @utf08_literal_0, i32 0, i32 0), i32 %0, i32 %load_out2, i64 %load_out3, i32 %load_out4) - %load_out11 = load i16, i16* %out1, align 2 + %load_out2 = load i32, ptr %out2, align 4 + %load_out3 = load i64, ptr %out3, align 8 + %load_out4 = load i32, ptr %out4, align 4 + %call = call i32 (ptr, ...) @printf(ptr @utf08_literal_0, i32 %0, i32 %load_out2, i64 %load_out3, i32 %load_out4) + %load_out11 = load i16, ptr %out1, align 2 %1 = sext i16 %load_out11 to i32 - %load_out22 = load i32, i32* %out2, align 4 - %load_out33 = load i64, i64* %out3, align 8 - %call4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @utf08_literal_1, i32 0, i32 0), i32 %1, i32 %load_out22, i64 %load_out33) - %main_ret = load i32, i32* %main, align 4 + %load_out22 = load i32, ptr %out2, align 4 + %load_out33 = load i64, ptr %out3, align 8 + %call4 = call i32 (ptr, ...) @printf(ptr @utf08_literal_1, i32 %1, i32 %load_out22, i64 %load_out33) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__unsingned_datatypes_smaller_than_dint_promoted_to_dint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__unsingned_datatypes_smaller_than_dint_promoted_to_dint.snap index bf414d3e0f3..bc0de2f6b15 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__unsingned_datatypes_smaller_than_dint_promoted_to_dint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__typesystem_test__unsingned_datatypes_smaller_than_dint_promoted_to_dint.snap @@ -1,7 +1,6 @@ --- source: src/codegen/tests/typesystem_test.rs expression: result -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,15 +11,15 @@ target triple = "[filtered]" @prg_instance = global %prg zeroinitializer -define void @prg(%prg* %0) { +define void @prg(ptr %0) { entry: - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %c = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - %load_b = load i8, i8* %b, align 1 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %c = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + %load_b = load i8, ptr %b, align 1 %1 = zext i8 %load_b to i32 - %load_c = load i32, i32* %c, align 4 + %load_c = load i32, ptr %c, align 4 %tmpVar = add i32 %1, %load_c - store i32 %tmpVar, i32* %x, align 4 + store i32 %tmpVar, ptr %x, align 4 ret void } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__consecutive_calls_with_differently_sized_arrays.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__consecutive_calls_with_differently_sized_arrays.snap index ff5bf0837d4..5a01d0da332 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__consecutive_calls_with_differently_sized_arrays.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__consecutive_calls_with_differently_sized_arrays.snap @@ -1,62 +1,59 @@ --- source: src/codegen/tests/vla_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [4 x i32] } +%__foo_vla = type { ptr, [4 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 - %start_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 2 - %end_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 3 - %start_idx_value1 = load i32, i32* %start_idx_ptr1, align 4 - %end_idx_value1 = load i32, i32* %end_idx_ptr1, align 4 - %3 = sub i32 %end_idx_value0, %start_idx_value0 - %len_dim0 = add i32 1, %3 - %4 = sub i32 %end_idx_value1, %start_idx_value1 - %len_dim1 = add i32 1, %4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 + %start_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 2 + %end_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 3 + %start_idx_value1 = load i32, ptr %start_idx_ptr1, align 4 + %end_idx_value1 = load i32, ptr %end_idx_ptr1, align 4 + %1 = sub i32 %end_idx_value0, %start_idx_value0 + %len_dim0 = add i32 1, %1 + %2 = sub i32 %end_idx_value1, %start_idx_value1 + %len_dim1 = add i32 1, %2 %accum = alloca i32, align 4 - store i32 1, i32* %accum, align 4 - %load_accum = load i32, i32* %accum, align 4 + store i32 1, ptr %accum, align 4 + %load_accum = load i32, ptr %accum, align 4 %product = mul i32 %load_accum, %len_dim1 - store i32 %product, i32* %accum, align 4 - %accessor_factor = load i32, i32* %accum, align 4 + store i32 %product, ptr %accum, align 4 + %accessor_factor = load i32, ptr %accum, align 4 %adj_access0 = sub i32 2, %start_idx_value0 %adj_access1 = sub i32 -1, %start_idx_value1 %accum1 = alloca i32, align 4 - store i32 0, i32* %accum1, align 4 + store i32 0, ptr %accum1, align 4 %multiply = mul i32 %adj_access0, %accessor_factor - %load_accum2 = load i32, i32* %accum1, align 4 + %load_accum2 = load i32, ptr %accum1, align 4 %accumulate = add i32 %load_accum2, %multiply - store i32 %accumulate, i32* %accum1, align 4 + store i32 %accumulate, ptr %accum1, align 4 %multiply3 = mul i32 %adj_access1, 1 - %load_accum4 = load i32, i32* %accum1, align 4 + %load_accum4 = load i32, ptr %accum1, align 4 %accumulate5 = add i32 %load_accum4, %multiply3 - store i32 %accumulate5, i32* %accum1, align 4 - %accessor = load i32, i32* %accum1, align 4 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %accessor - store i16 1, i16* %arr_val, align 2 - %foo_ret = load i16, i16* %foo, align 2 + store i32 %accumulate5, ptr %accum1, align 4 + %accessor = load i32, ptr %accum1, align 4 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %accessor + store i16 1, ptr %arr_val, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -65,42 +62,40 @@ entry: %main = alloca i32, align 4 %arr = alloca [60 x i16], align 2 %arr2 = alloca [299 x i16], align 2 - %0 = bitcast [60 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([60 x i16]* getelementptr ([60 x i16], [60 x i16]* null, i32 1) to i64), i1 false) - %1 = bitcast [299 x i16]* %arr2 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([299 x i16]* getelementptr ([299 x i16], [299 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [60 x i16], [60 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [60 x i16], [60 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([60 x i16], ptr null, i32 1) to i64), i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %arr2, i8 0, i64 ptrtoint (ptr getelementptr ([299 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [60 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [60 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [4 x i32] [i32 0, i32 14, i32 -2, i32 1], [4 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %2 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [4 x i32] [i32 0, i32 14, i32 -2, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %2, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %auto_deref1 = load [299 x i16], [299 x i16]* %arr2, align 2 - %outer_arr_gep2 = getelementptr inbounds [299 x i16], [299 x i16]* %arr2, i32 0, i32 0 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %auto_deref1 = load [299 x i16], ptr %arr2, align 2 + %outer_arr_gep2 = getelementptr inbounds [299 x i16], ptr %arr2, i32 0, i32 0 %vla_struct3 = alloca %__foo_vla, align 8 - %vla_array_gep4 = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct3, i32 0, i32 0 - %vla_dimensions_gep5 = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct3, i32 0, i32 1 - store [4 x i32] [i32 -8, i32 4, i32 -3, i32 19], [4 x i32]* %vla_dimensions_gep5, align 4 - store i16* %outer_arr_gep2, i16** %vla_array_gep4, align 8 - %3 = load %__foo_vla, %__foo_vla* %vla_struct3, align 8 + %vla_array_gep4 = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct3, i32 0, i32 0 + %vla_dimensions_gep5 = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct3, i32 0, i32 1 + store [4 x i32] [i32 -8, i32 4, i32 -3, i32 19], ptr %vla_dimensions_gep5, align 4 + store ptr %outer_arr_gep2, ptr %vla_array_gep4, align 8 + %1 = load %__foo_vla, ptr %vla_struct3, align 8 %vla_struct_ptr6 = alloca %__foo_vla, align 8 - store %__foo_vla %3, %__foo_vla* %vla_struct_ptr6, align 8 - %call7 = call i16 @foo(%__foo_vla* %vla_struct_ptr6) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %1, ptr %vla_struct_ptr6, align 8 + %call7 = call i16 @foo(ptr %vla_struct_ptr6) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__global_variable_passed_to_function_as_vla.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__global_variable_passed_to_function_as_vla.snap index 81ac40dec53..78804fea05d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__global_variable_passed_to_function_as_vla.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__global_variable_passed_to_function_as_vla.snap @@ -1,59 +1,56 @@ --- source: src/codegen/tests/vla_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @arr = global [2 x i16] zeroinitializer @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 %tmpVar = sub i32 0, %start_idx_value0 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %tmpVar - store i16 10, i16* %arr_val, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %tmpVar + store i16 10, ptr %arr_val, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } define i32 @main() { entry: %main = alloca i32, align 4 - store i32 0, i32* %main, align 4 - %auto_deref = load [2 x i16], [2 x i16]* @arr, align 2 + store i32 0, ptr %main, align 4 + %auto_deref = load [2 x i16], ptr @arr, align 2 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* getelementptr inbounds ([2 x i16], [2 x i16]* @arr, i32 0, i32 0), i16** %vla_array_gep, align 8 - %0 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr @arr, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %0, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__internal_vla_struct_is_generated_for_call_statements.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__internal_vla_struct_is_generated_for_call_statements.snap index ece7ff55d86..9b48299045d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__internal_vla_struct_is_generated_for_call_statements.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__internal_vla_struct_is_generated_for_call_statements.snap @@ -1,50 +1,46 @@ --- source: src/codegen/tests/vla_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define void @foo(%__foo_vla* %0) { +define void @foo(ptr %0) { entry: %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) ret void } define void @bar() { entry: %arr = alloca [2 x i16], align 2 - %0 = bitcast [2 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x i16]* getelementptr ([2 x i16], [2 x i16]* null, i32 1) to i64), i1 false) - %auto_deref = load [2 x i16], [2 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [2 x i16], [2 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i16], ptr null, i32 1) to i64), i1 false) + %auto_deref = load [2 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [2 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - call void @foo(%__foo_vla* %vla_struct_ptr) + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + call void @foo(ptr %vla_struct_ptr) ret void } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__multi_dimensional_vla.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__multi_dimensional_vla.snap index b860d9f9f45..7db95ff80e6 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__multi_dimensional_vla.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__multi_dimensional_vla.snap @@ -1,62 +1,59 @@ --- source: src/codegen/tests/vla_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [4 x i32] } +%__foo_vla = type { ptr, [4 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 - %start_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 2 - %end_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 3 - %start_idx_value1 = load i32, i32* %start_idx_ptr1, align 4 - %end_idx_value1 = load i32, i32* %end_idx_ptr1, align 4 - %3 = sub i32 %end_idx_value0, %start_idx_value0 - %len_dim0 = add i32 1, %3 - %4 = sub i32 %end_idx_value1, %start_idx_value1 - %len_dim1 = add i32 1, %4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 + %start_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 2 + %end_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 3 + %start_idx_value1 = load i32, ptr %start_idx_ptr1, align 4 + %end_idx_value1 = load i32, ptr %end_idx_ptr1, align 4 + %1 = sub i32 %end_idx_value0, %start_idx_value0 + %len_dim0 = add i32 1, %1 + %2 = sub i32 %end_idx_value1, %start_idx_value1 + %len_dim1 = add i32 1, %2 %accum = alloca i32, align 4 - store i32 1, i32* %accum, align 4 - %load_accum = load i32, i32* %accum, align 4 + store i32 1, ptr %accum, align 4 + %load_accum = load i32, ptr %accum, align 4 %product = mul i32 %load_accum, %len_dim1 - store i32 %product, i32* %accum, align 4 - %accessor_factor = load i32, i32* %accum, align 4 + store i32 %product, ptr %accum, align 4 + %accessor_factor = load i32, ptr %accum, align 4 %adj_access0 = sub i32 2, %start_idx_value0 %adj_access1 = sub i32 -1, %start_idx_value1 %accum1 = alloca i32, align 4 - store i32 0, i32* %accum1, align 4 + store i32 0, ptr %accum1, align 4 %multiply = mul i32 %adj_access0, %accessor_factor - %load_accum2 = load i32, i32* %accum1, align 4 + %load_accum2 = load i32, ptr %accum1, align 4 %accumulate = add i32 %load_accum2, %multiply - store i32 %accumulate, i32* %accum1, align 4 + store i32 %accumulate, ptr %accum1, align 4 %multiply3 = mul i32 %adj_access1, 1 - %load_accum4 = load i32, i32* %accum1, align 4 + %load_accum4 = load i32, ptr %accum1, align 4 %accumulate5 = add i32 %load_accum4, %multiply3 - store i32 %accumulate5, i32* %accum1, align 4 - %accessor = load i32, i32* %accum1, align 4 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %accessor - store i16 1, i16* %arr_val, align 2 - %foo_ret = load i16, i16* %foo, align 2 + store i32 %accumulate5, ptr %accum1, align 4 + %accessor = load i32, ptr %accum1, align 4 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %accessor + store i16 1, ptr %arr_val, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -64,29 +61,28 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [20 x i16], align 2 - %0 = bitcast [20 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([20 x i16]* getelementptr ([20 x i16], [20 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [20 x i16], [20 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [20 x i16], [20 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([20 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [20 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [20 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [4 x i32] [i32 0, i32 4, i32 -2, i32 1], [4 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [4 x i32] [i32 0, i32 4, i32 -2, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access.snap index 388340079df..f0241e5c9a7 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access.snap @@ -1,37 +1,34 @@ --- source: src/codegen/tests/vla_tests.rs expression: res -snapshot_kind: text --- ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 %tmpVar = sub i32 0, %start_idx_value0 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %tmpVar - %load_tmpVar = load i16, i16* %arr_val, align 2 - store i16 %load_tmpVar, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %tmpVar + %load_tmpVar = load i16, ptr %arr_val, align 2 + store i16 %load_tmpVar, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -39,29 +36,28 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [2 x i16], align 2 - %0 = bitcast [2 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x i16]* getelementptr ([2 x i16], [2 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [2 x i16], [2 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [2 x i16], [2 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [2 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [2 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_expr.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_expr.snap index d9a4105669c..e5e1a510f3a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_expr.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_expr.snap @@ -7,34 +7,32 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) %i = alloca i32, align 4 - store i32 0, i32* %i, align 4 - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 - %load_i = load i32, i32* %i, align 4 + store i32 0, ptr %i, align 4 + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 + %load_i = load i32, ptr %i, align 4 %tmpVar = add i32 %load_i, 1 %tmpVar1 = sub i32 %tmpVar, %start_idx_value0 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %tmpVar1 - %load_tmpVar = load i16, i16* %arr_val, align 2 - store i16 %load_tmpVar, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %tmpVar1 + %load_tmpVar = load i16, ptr %arr_val, align 2 + store i16 %load_tmpVar, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -42,29 +40,28 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [2 x i16], align 2 - %0 = bitcast [2 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x i16]* getelementptr ([2 x i16], [2 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [2 x i16], [2 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [2 x i16], [2 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [2 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [2 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_lint.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_lint.snap index 44189ea120c..f0241e5c9a7 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_lint.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_lint.snap @@ -7,30 +7,28 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 %tmpVar = sub i32 0, %start_idx_value0 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %tmpVar - %load_tmpVar = load i16, i16* %arr_val, align 2 - store i16 %load_tmpVar, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %tmpVar + %load_tmpVar = load i16, ptr %arr_val, align 2 + store i16 %load_tmpVar, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -38,29 +36,28 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [2 x i16], align 2 - %0 = bitcast [2 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x i16]* getelementptr ([2 x i16], [2 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [2 x i16], [2 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [2 x i16], [2 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [2 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [2 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_var.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_var.snap index 84acd5dafa4..91212aa9913 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_var.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__vla_tests__vla_read_access_with_var.snap @@ -7,33 +7,31 @@ source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" -%__foo_vla = type { i16*, [2 x i32] } +%__foo_vla = type { ptr, [2 x i32] } @____foo_vla__init = unnamed_addr constant %__foo_vla zeroinitializer -define i16 @foo(%__foo_vla* %0) { +define i16 @foo(ptr %0) { entry: %foo = alloca i16, align 2 %vla = alloca %__foo_vla, align 8 - %1 = bitcast %__foo_vla* %vla to i8* - %2 = bitcast %__foo_vla* %0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%__foo_vla* getelementptr (%__foo_vla, %__foo_vla* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %vla, ptr align 1 %0, i64 ptrtoint (ptr getelementptr (%__foo_vla, ptr null, i32 1) to i64), i1 false) %i = alloca i32, align 4 - store i32 0, i32* %i, align 4 - store i16 0, i16* %foo, align 2 - %vla_arr_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 0 - %vla_arr_ptr = load i16*, i16** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_vla, %__foo_vla* %vla, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 - %load_i = load i32, i32* %i, align 4 + store i32 0, ptr %i, align 4 + store i16 0, ptr %foo, align 2 + %vla_arr_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_vla, ptr %vla, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 + %load_i = load i32, ptr %i, align 4 %tmpVar = sub i32 %load_i, %start_idx_value0 - %arr_val = getelementptr inbounds i16, i16* %vla_arr_ptr, i32 %tmpVar - %load_tmpVar = load i16, i16* %arr_val, align 2 - store i16 %load_tmpVar, i16* %foo, align 2 - %foo_ret = load i16, i16* %foo, align 2 + %arr_val = getelementptr inbounds i16, ptr %vla_arr_ptr, i32 %tmpVar + %load_tmpVar = load i16, ptr %arr_val, align 2 + store i16 %load_tmpVar, ptr %foo, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } @@ -41,29 +39,28 @@ define i32 @main() { entry: %main = alloca i32, align 4 %arr = alloca [2 x i16], align 2 - %0 = bitcast [2 x i16]* %arr to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([2 x i16]* getelementptr ([2 x i16], [2 x i16]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [2 x i16], [2 x i16]* %arr, align 2 - %outer_arr_gep = getelementptr inbounds [2 x i16], [2 x i16]* %arr, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %arr, i8 0, i64 ptrtoint (ptr getelementptr ([2 x i16], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [2 x i16], ptr %arr, align 2 + %outer_arr_gep = getelementptr inbounds [2 x i16], ptr %arr, i32 0, i32 0 %vla_struct = alloca %__foo_vla, align 8 - %vla_array_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_vla, %__foo_vla* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 1], [2 x i32]* %vla_dimensions_gep, align 4 - store i16* %outer_arr_gep, i16** %vla_array_gep, align 8 - %1 = load %__foo_vla, %__foo_vla* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_vla, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 1], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_vla, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_vla, align 8 - store %__foo_vla %1, %__foo_vla* %vla_struct_ptr, align 8 - %call = call i16 @foo(%__foo_vla* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_vla %0, ptr %vla_struct_ptr, align 8 + %call = call i16 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -; Function Attrs: argmemonly nofree nounwind willreturn writeonly -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) +declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 -attributes #0 = { argmemonly nofree nounwind willreturn } -attributes #1 = { argmemonly nofree nounwind willreturn writeonly } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/src/codegen/tests/statement_codegen_test.rs b/src/codegen/tests/statement_codegen_test.rs index 15be6329f6a..0942893d874 100644 --- a/src/codegen/tests/statement_codegen_test.rs +++ b/src/codegen/tests/statement_codegen_test.rs @@ -209,11 +209,11 @@ fn ref_assignment() { define void @main() { entry: - %a = alloca i32*, align 8 + %a = alloca ptr, align 8 %b = alloca i32, align 4 - store i32* null, i32** %a, align 8 - store i32 0, i32* %b, align 4 - store i32* %b, i32** %a, align 8 + store ptr null, ptr %a, align 8 + store i32 0, ptr %b, align 4 + store ptr %b, ptr %a, align 8 ret void } "#); @@ -240,9 +240,9 @@ fn ref_assignment_to_null() { define void @main() { entry: - %a = alloca i32*, align 8 - store i32* null, i32** %a, align 8 - store i32 0, i32** %a, align 4 + %a = alloca ptr, align 8 + store ptr null, ptr %a, align 8 + store i32 0, ptr %a, align 4 ret void } "#); @@ -283,10 +283,10 @@ fn reference_to_assignment() { define void @main() { entry: - %a = alloca i32*, align 8 - store i32* null, i32** %a, align 8 - %deref = load i32*, i32** %a, align 8 - store i32 5, i32* %deref, align 4 + %a = alloca ptr, align 8 + store ptr null, ptr %a, align 8 + %deref = load ptr, ptr %a, align 8 + store i32 5, ptr %deref, align 4 ret void } "#); @@ -330,18 +330,17 @@ fn reference_to_string_assignment() { define void @main() { entry: - %a = alloca [81 x i8]*, align 8 - store [81 x i8]* null, [81 x i8]** %a, align 8 - %deref = load [81 x i8]*, [81 x i8]** %a, align 8 - %0 = bitcast [81 x i8]* %deref to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %0, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) + %a = alloca ptr, align 8 + store ptr null, ptr %a, align 8 + %deref = load ptr, ptr %a, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 6, i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -366,10 +365,10 @@ fn local_alias() { define void @main() { entry: - %foo = alloca i32*, align 8 + %foo = alloca ptr, align 8 %bar = alloca i32, align 4 - store i32* null, i32** %foo, align 8 - store i32 0, i32* %bar, align 4 + store ptr null, ptr %foo, align 8 + store i32 0, ptr %bar, align 4 ret void } "#); @@ -396,18 +395,17 @@ fn local_string_alias() { define void @main() { entry: - %foo = alloca [81 x i8]*, align 8 + %foo = alloca ptr, align 8 %bar = alloca [81 x i8], align 1 - store [81 x i8]* null, [81 x i8]** %foo, align 8 - %0 = bitcast [81 x i8]* %bar to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) + store ptr null, ptr %foo, align 8 + call void @llvm.memset.p0.i64(ptr align 1 %bar, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } diff --git a/src/codegen/tests/typesystem_test.rs b/src/codegen/tests/typesystem_test.rs index 1b532edcd6f..e98de69604b 100644 --- a/src/codegen/tests/typesystem_test.rs +++ b/src/codegen/tests/typesystem_test.rs @@ -348,22 +348,22 @@ fn enum_typed_varargs_get_promoted() { @MyEnum.b = unnamed_addr constant i16 20 @utf08_literal_0 = private unnamed_addr constant [16 x i8] c"result : %d %d\0A\00" - declare i32 @printf(i8*, ...) + declare i32 @printf(ptr, ...) define i32 @main() { entry: %main = alloca i32, align 4 %e1 = alloca i16, align 2 %i1 = alloca i16, align 2 - store i16 10, i16* %e1, align 2 - store i16 10, i16* %i1, align 2 - store i32 0, i32* %main, align 4 - %load_e1 = load i16, i16* %e1, align 2 + store i16 10, ptr %e1, align 2 + store i16 10, ptr %i1, align 2 + store i32 0, ptr %main, align 4 + %load_e1 = load i16, ptr %e1, align 2 %0 = sext i16 %load_e1 to i32 - %load_i1 = load i16, i16* %i1, align 2 + %load_i1 = load i16, ptr %i1, align 2 %1 = sext i16 %load_i1 to i32 - %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @utf08_literal_0, i32 0, i32 0), i32 %0, i32 %1) - %main_ret = load i32, i32* %main, align 4 + %call = call i32 (ptr, ...) @printf(ptr @utf08_literal_0, i32 %0, i32 %1) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } "#); @@ -398,23 +398,23 @@ fn self_referential_struct_via_reference_codegen() { target triple = "[filtered]" %main = type { %Node, %Node } - %Node = type { i32, %Node* } + %Node = type { i32, ptr } @main_instance = global %main zeroinitializer @__Node__init = unnamed_addr constant %Node zeroinitializer - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %node1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %node2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %data = getelementptr inbounds %Node, %Node* %node1, i32 0, i32 0 - store i32 42, i32* %data, align 4 - %data1 = getelementptr inbounds %Node, %Node* %node2, i32 0, i32 0 - store i32 84, i32* %data1, align 4 - %next = getelementptr inbounds %Node, %Node* %node1, i32 0, i32 1 - store %Node* %node2, %Node** %next, align 8 - %next2 = getelementptr inbounds %Node, %Node* %node2, i32 0, i32 1 - store %Node* %node1, %Node** %next2, align 8 + %node1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %node2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %data = getelementptr inbounds nuw %Node, ptr %node1, i32 0, i32 0 + store i32 42, ptr %data, align 4 + %data1 = getelementptr inbounds nuw %Node, ptr %node2, i32 0, i32 0 + store i32 84, ptr %data1, align 4 + %next = getelementptr inbounds nuw %Node, ptr %node1, i32 0, i32 1 + store ptr %node2, ptr %next, align 8 + %next2 = getelementptr inbounds nuw %Node, ptr %node2, i32 0, i32 1 + store ptr %node1, ptr %next2, align 8 ret void } "#); diff --git a/src/linker.rs b/src/linker.rs index 0d4bd065310..13529779494 100644 --- a/src/linker.rs +++ b/src/linker.rs @@ -52,7 +52,7 @@ impl Linker { (_, "darwin") => Box::new(CcLinker::new("clang")), - _ => Box::new(LdLinker::new()), + _ => Box::new(CcLinker::new("ld.lld")), } } LinkerType::External(linker) => Box::new(CcLinker::new(&linker)), @@ -164,30 +164,31 @@ impl LinkerInterface for CcLinker { } } -struct LdLinker { - args: Vec, -} - -impl LdLinker { - fn new() -> LdLinker { - LdLinker { args: Vec::default() } - } -} - -impl LinkerInterface for LdLinker { - fn add_arg(&mut self, value: String) { - self.args.push(value) - } - - fn get_build_command(&self) -> Result { - Ok(format!("ld.lld {}", self.args.join(" "))) - } - - fn finalize(&mut self) -> Result<(), LinkerError> { - log::debug!("Linker arguments : {}", self.get_build_command()?); - lld_rs::link(lld_rs::LldFlavor::Elf, &self.args).ok().map_err(LinkerError::Link) - } -} +// // TODO: Might not be needed anymore +// struct LdLinker { +// args: Vec, +// } + +// impl LdLinker { +// fn new() -> LdLinker { +// LdLinker { args: Vec::default() } +// } +// } + +// impl LinkerInterface for LdLinker { +// fn add_arg(&mut self, value: String) { +// self.args.push(value) +// } + +// fn get_build_command(&self) -> Result { +// Ok(format!("ld.lld {}", self.args.join(" "))) +// } + +// fn finalize(&mut self) -> Result<(), LinkerError> { +// log::debug!("Linker arguments : {}", self.get_build_command()?); +// lld_rs::link(lld_rs::LldFlavor::Elf, &self.args).ok().map_err(LinkerError::Link) +// } +// } #[derive(Clone, Debug)] pub struct MockLinker { diff --git a/src/resolver/tests/snapshots/rusty__resolver__tests__const_resolver_tests__const_variables_default_value_compile_time_evaluation.snap b/src/resolver/tests/snapshots/rusty__resolver__tests__const_resolver_tests__const_variables_default_value_compile_time_evaluation.snap index 8ee98ea91a9..dece08c2b8f 100644 --- a/src/resolver/tests/snapshots/rusty__resolver__tests__const_resolver_tests__const_variables_default_value_compile_time_evaluation.snap +++ b/src/resolver/tests/snapshots/rusty__resolver__tests__const_resolver_tests__const_variables_default_value_compile_time_evaluation.snap @@ -1,7 +1,6 @@ --- source: src/resolver/tests/const_resolver_tests.rs expression: ir -snapshot_kind: text --- ; ModuleID = '' source_filename = "" @@ -12,7 +11,7 @@ target triple = "[filtered]" @zero_int = unnamed_addr constant i16 0 @zero_real = unnamed_addr constant double 0.000000e+00 @empty_string = unnamed_addr constant [81 x i8] zeroinitializer -@null_ptr = unnamed_addr constant i16* null +@null_ptr = unnamed_addr constant ptr null @zero_enum = unnamed_addr constant i32 0 @myEnum.a = unnamed_addr constant i32 0 @myEnum.b = unnamed_addr constant i32 1 diff --git a/src/test_utils.rs b/src/test_utils.rs index 58daa2a7b09..46b591395bb 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -213,15 +213,6 @@ pub mod tests { codegen_debug_without_unwrap(src, DebugLevel::None) } - pub fn codegen_with_online_change(src: &str) -> String { - codegen_debug_without_unwrap_oc( - src, - DebugLevel::None, - OnlineChange::Enabled { file_name: "test".into(), format: crate::ConfigFormat::JSON }, - ) - .unwrap() - } - pub fn codegen_debug_without_unwrap(src: &str, debug_level: DebugLevel) -> Result { codegen_debug_without_unwrap_oc(src, debug_level, OnlineChange::Disabled) } diff --git a/src/tests/adr/arrays_adr.rs b/src/tests/adr/arrays_adr.rs index ee3e5a1fbcc..38ee0de569c 100644 --- a/src/tests/adr/arrays_adr.rs +++ b/src/tests/adr/arrays_adr.rs @@ -79,20 +79,18 @@ fn assigning_full_arrays() { @prg_instance = global %prg { [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9], [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9] } @__Data__init = unnamed_addr constant [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9] - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [10 x i32]* %a to i8* - %2 = bitcast [10 x i32]* %b to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint ([10 x i32]* getelementptr ([10 x i32], [10 x i32]* null, i32 1) to i64), i1 false) + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %a, ptr align 1 %b, i64 ptrtoint (ptr getelementptr ([10 x i32], ptr null, i32 1) to i64), i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -134,14 +132,14 @@ fn accessing_array_elements() { @__Data__init = unnamed_addr constant [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9] @__prg.b__init = unnamed_addr constant [3 x i32] [i32 3, i32 4, i32 5] - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %tmpVar = getelementptr inbounds [10 x i32], [10 x i32]* %a, i32 0, i32 2 - %tmpVar1 = getelementptr inbounds [3 x i32], [3 x i32]* %b, i32 0, i32 1 - %load_tmpVar = load i32, i32* %tmpVar1, align 4 - store i32 %load_tmpVar, i32* %tmpVar, align 4 + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %tmpVar = getelementptr inbounds [10 x i32], ptr %a, i32 0, i32 2 + %tmpVar1 = getelementptr inbounds [3 x i32], ptr %b, i32 0, i32 1 + %load_tmpVar = load i32, ptr %tmpVar1, align 4 + store i32 %load_tmpVar, ptr %tmpVar, align 4 ret void } "#); diff --git a/src/tests/adr/enum_adr.rs b/src/tests/adr/enum_adr.rs index 282f1ebca07..b6adec83060 100644 --- a/src/tests/adr/enum_adr.rs +++ b/src/tests/adr/enum_adr.rs @@ -137,14 +137,14 @@ fn using_enums() { @Door.open = unnamed_addr constant i32 8 @Door.closed = unnamed_addr constant i32 16 - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %y = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 2 - store i32 5, i32* %x, align 4 - store i32 4, i32* %y, align 4 - store i32 16, i32* %z, align 4 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 2 + store i32 5, ptr %x, align 4 + store i32 4, ptr %y, align 4 + store i32 16, ptr %z, align 4 ret void } "#); diff --git a/src/tests/adr/initializer_functions_adr.rs b/src/tests/adr/initializer_functions_adr.rs index 956271e2af5..4dc03288e41 100644 --- a/src/tests/adr/initializer_functions_adr.rs +++ b/src/tests/adr/initializer_functions_adr.rs @@ -657,44 +657,44 @@ fn generating_init_functions() { "; let res = generate_to_string("Test", vec![SourceCode::from(src)]).unwrap(); - filtered_assert_snapshot!(res, @r###" + filtered_assert_snapshot!(res, @r#" ; ModuleID = '' source_filename = "" target datalayout = "[filtered]" target triple = "[filtered]" %myStruct = type { i8, i8 } - %myRefStruct = type { %myStruct* } + %myRefStruct = type { ptr } @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer @__myRefStruct__init = unnamed_addr constant %myRefStruct zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_myrefstruct(%myRefStruct* %0) { + define void @__init_myrefstruct(ptr %0) { entry: - %self = alloca %myRefStruct*, align 8 - store %myRefStruct* %0, %myRefStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myRefStruct(%myRefStruct* %0) { + define void @__user_init_myRefStruct(ptr %0) { entry: - %self = alloca %myRefStruct*, align 8 - store %myRefStruct* %0, %myRefStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } @@ -702,7 +702,7 @@ fn generating_init_functions() { entry: ret void } - "###); + "#); // The second example shows how each initializer function delegates member-initialization to the respective member-init-function // The wrapping init function contains a single call-statement to `__init_baz`, since `baz` is the only global instance in need of @@ -745,13 +745,13 @@ fn generating_init_functions() { target triple = "[filtered]" %baz = type { %bar } - %bar = type { i32*, %foo } - %foo = type { i32*, %myStruct* } + %bar = type { ptr, %foo } + %foo = type { ptr, ptr } %myStruct = type { i8, i8 } - %__vtable_foo = type { void (%foo*)* } - %__vtable_bar = type { void (%bar*)* } + %__vtable_foo = type { ptr } + %__vtable_bar = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @baz_instance = global %baz zeroinitializer @__bar__init = unnamed_addr constant %bar zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @@ -762,151 +762,151 @@ fn generating_init_functions() { @__vtable_foo_instance = global %__vtable_foo zeroinitializer @__vtable_bar_instance = global %__vtable_bar zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %ps = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %ps = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @bar(%bar* %0) { + define void @bar(ptr %0) { entry: - %this = alloca %bar*, align 8 - store %bar* %0, %bar** %this, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %0, i32 0, i32 0 - %fb = getelementptr inbounds %bar, %bar* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 0 + %fb = getelementptr inbounds nuw %bar, ptr %0, i32 0, i32 1 ret void } - define void @baz(%baz* %0) { + define void @baz(ptr %0) { entry: - %fb = getelementptr inbounds %baz, %baz* %0, i32 0, i32 0 + %fb = getelementptr inbounds nuw %baz, ptr %0, i32 0, i32 0 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init___vtable_bar(%__vtable_bar* %0) { + define void @__init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 - %deref = load %__vtable_bar*, %__vtable_bar** %self, align 8 - %__body = getelementptr inbounds %__vtable_bar, %__vtable_bar* %deref, i32 0, i32 0 - store void (%bar*)* @bar, void (%bar*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @bar, ptr %__body, align 8 ret void } - define void @__init_bar(%bar* %0) { + define void @__init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %fb = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 1 - call void @__init_foo(%foo* %fb) - %deref1 = load %bar*, %bar** %self, align 8 - %__vtable = getelementptr inbounds %bar, %bar* %deref1, i32 0, i32 0 - store i32* bitcast (%__vtable_bar* @__vtable_bar_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 1 + call void @__init_foo(ptr %fb) + %deref1 = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %bar, ptr %deref1, i32 0, i32 0 + store ptr @__vtable_bar_instance, ptr %__vtable, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %ps = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 1 - store %myStruct* @s, %myStruct** %ps, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %ps = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 1 + store ptr @s, ptr %ps, align 8 ret void } - define void @__init_mystruct(%myStruct* %0) { + define void @__init_mystruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__init_baz(%baz* %0) { + define void @__init_baz(ptr %0) { entry: - %self = alloca %baz*, align 8 - store %baz* %0, %baz** %self, align 8 - %deref = load %baz*, %baz** %self, align 8 - %fb = getelementptr inbounds %baz, %baz* %deref, i32 0, i32 0 - call void @__init_bar(%bar* %fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %baz, ptr %deref, i32 0, i32 0 + call void @__init_bar(ptr %fb) ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init___vtable_bar(%__vtable_bar* %0) { + define void @__user_init___vtable_bar(ptr %0) { entry: - %self = alloca %__vtable_bar*, align 8 - store %__vtable_bar* %0, %__vtable_bar** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_baz(%baz* %0) { + define void @__user_init_baz(ptr %0) { entry: - %self = alloca %baz*, align 8 - store %baz* %0, %baz** %self, align 8 - %deref = load %baz*, %baz** %self, align 8 - %fb = getelementptr inbounds %baz, %baz* %deref, i32 0, i32 0 - call void @__user_init_bar(%bar* %fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %baz, ptr %deref, i32 0, i32 0 + call void @__user_init_bar(ptr %fb) ret void } - define void @__user_init_bar(%bar* %0) { + define void @__user_init_bar(ptr %0) { entry: - %self = alloca %bar*, align 8 - store %bar* %0, %bar** %self, align 8 - %deref = load %bar*, %bar** %self, align 8 - %fb = getelementptr inbounds %bar, %bar* %deref, i32 0, i32 1 - call void @__user_init_foo(%foo* %fb) + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %fb = getelementptr inbounds nuw %bar, ptr %deref, i32 0, i32 1 + call void @__user_init_foo(ptr %fb) ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_myStruct(%myStruct* %0) { + define void @__user_init_myStruct(ptr %0) { entry: - %self = alloca %myStruct*, align 8 - store %myStruct* %0, %myStruct** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init_baz(%baz* @baz_instance) - call void @__init_mystruct(%myStruct* @s) - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) - call void @__user_init_baz(%baz* @baz_instance) - call void @__user_init_myStruct(%myStruct* @s) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_bar(%__vtable_bar* @__vtable_bar_instance) + call void @__init_baz(ptr @baz_instance) + call void @__init_mystruct(ptr @s) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__init___vtable_bar(ptr @__vtable_bar_instance) + call void @__user_init_baz(ptr @baz_instance) + call void @__user_init_myStruct(ptr @s) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_bar(ptr @__vtable_bar_instance) ret void } "#); @@ -951,25 +951,25 @@ fn intializing_temporary_variables() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)* } - %foo = type { i32*, [81 x i8]* } + %__vtable_foo = type { ptr } + %foo = type { ptr, ptr } @ps2 = global [81 x i8] zeroinitializer @ps = global [81 x i8] zeroinitializer - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %s = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %s2 = alloca [81 x i8]*, align 8 - store [81 x i8]* @ps2, [81 x i8]** %s2, align 8 - store [81 x i8]* @ps2, [81 x i8]** %s2, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %s2 = alloca ptr, align 8 + store ptr @ps2, ptr %s2, align 8 + store ptr @ps2, ptr %s2, align 8 ret void } @@ -977,70 +977,69 @@ fn intializing_temporary_variables() { entry: %main = alloca i32, align 4 %fb = alloca %foo, align 8 - %s = alloca [81 x i8]*, align 8 - %s2 = alloca [81 x i8]*, align 8 - %0 = bitcast %foo* %fb to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%foo* @__foo__init to i8*), i64 ptrtoint (%foo* getelementptr (%foo, %foo* null, i32 1) to i64), i1 false) - store [81 x i8]* null, [81 x i8]** %s, align 8 - store [81 x i8]* @ps2, [81 x i8]** %s2, align 8 - store i32 0, i32* %main, align 4 - store [81 x i8]* @ps, [81 x i8]** %s, align 8 - store [81 x i8]* @ps2, [81 x i8]** %s2, align 8 - call void @__init_foo(%foo* %fb) - call void @__user_init_foo(%foo* %fb) - call void @foo(%foo* %fb) - %main_ret = load i32, i32* %main, align 4 + %s = alloca ptr, align 8 + %s2 = alloca ptr, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %fb, ptr align 1 @__foo__init, i64 ptrtoint (ptr getelementptr (%foo, ptr null, i32 1) to i64), i1 false) + store ptr null, ptr %s, align 8 + store ptr @ps2, ptr %s2, align 8 + store i32 0, ptr %main, align 4 + store ptr @ps, ptr %s, align 8 + store ptr @ps2, ptr %s2, align 8 + call void @__init_foo(ptr %fb) + call void @__user_init_foo(ptr %fb) + call void @foo(ptr %fb) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 - %deref1 = load %foo*, %foo** %self, align 8 - %s = getelementptr inbounds %foo, %foo* %deref1, i32 0, i32 1 - store [81 x i8]* @ps, [81 x i8]** %s, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 + %deref1 = load ptr, ptr %self, align 8 + %s = getelementptr inbounds nuw %foo, ptr %deref1, i32 0, i32 1 + store ptr @ps, ptr %s, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#) } @@ -1070,76 +1069,76 @@ fn initializing_method_variables() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32* } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer @__foo__init = unnamed_addr constant %foo zeroinitializer @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 %x = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 10, i32* %x, align 4 - store i32* %x, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 10, ptr %x, align 4 + store ptr %x, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -1177,92 +1176,92 @@ fn initializing_method_variables() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)*, void (%foo*)* } - %foo = type { i32*, i32 } + %__vtable_foo = type { ptr, ptr, ptr } + %foo = type { ptr, i32 } @y = global i32 0 - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer - @__foo__init = unnamed_addr constant %foo { i32* null, i32 5 } + @__foo__init = unnamed_addr constant %foo { ptr null, i32 5 } @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %px = alloca i32*, align 8 - store i32* %x, i32** %px, align 8 - store i32* %x, i32** %px, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %px = alloca ptr, align 8 + store ptr %x, ptr %px, align 8 + store ptr %x, ptr %px, align 8 ret void } - define void @foo__baz(%foo* %0) { + define void @foo__baz(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %px = alloca i32*, align 8 - store i32* @y, i32** %px, align 8 - store i32* @y, i32** %px, align 8 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %px = alloca ptr, align 8 + store ptr @y, ptr %px, align 8 + store ptr @y, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 - %deref2 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %baz = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref2, i32 0, i32 2 - store void (%foo*)* @foo__baz, void (%foo*)** %baz, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 + %deref2 = load ptr, ptr %self, align 8 + %baz = getelementptr inbounds nuw %__vtable_foo, ptr %deref2, i32 0, i32 2 + store ptr @foo__baz, ptr %baz, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); @@ -1290,78 +1289,78 @@ fn initializing_method_variables() { target datalayout = "[filtered]" target triple = "[filtered]" - %__vtable_foo = type { void (%foo*)*, void (%foo*)* } - %foo = type { i32*, i32 } + %__vtable_foo = type { ptr, ptr } + %foo = type { ptr, i32 } - @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___Test, i8* null }] + @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___Test, ptr null }] @____vtable_foo__init = unnamed_addr constant %__vtable_foo zeroinitializer - @__foo__init = unnamed_addr constant %foo { i32* null, i32 5 } + @__foo__init = unnamed_addr constant %foo { ptr null, i32 5 } @__vtable_foo_instance = global %__vtable_foo zeroinitializer - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 ret void } - define void @foo__bar(%foo* %0) { + define void @foo__bar(ptr %0) { entry: - %this = alloca %foo*, align 8 - store %foo* %0, %foo** %this, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 %x1 = alloca i32, align 4 - %px = alloca i32*, align 8 - store i32 10, i32* %x1, align 4 - store i32* %x1, i32** %px, align 8 - store i32* %x1, i32** %px, align 8 + %px = alloca ptr, align 8 + store i32 10, ptr %x1, align 4 + store ptr %x1, ptr %px, align 8 + store ptr %x1, ptr %px, align 8 ret void } - define void @__init___vtable_foo(%__vtable_foo* %0) { + define void @__init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 - %deref = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %__body = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref, i32 0, i32 0 - store void (%foo*)* @foo, void (%foo*)** %__body, align 8 - %deref1 = load %__vtable_foo*, %__vtable_foo** %self, align 8 - %bar = getelementptr inbounds %__vtable_foo, %__vtable_foo* %deref1, i32 0, i32 1 - store void (%foo*)* @foo__bar, void (%foo*)** %bar, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_foo, ptr %deref, i32 0, i32 0 + store ptr @foo, ptr %__body, align 8 + %deref1 = load ptr, ptr %self, align 8 + %bar = getelementptr inbounds nuw %__vtable_foo, ptr %deref1, i32 0, i32 1 + store ptr @foo__bar, ptr %bar, align 8 ret void } - define void @__init_foo(%foo* %0) { + define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 - %deref = load %foo*, %foo** %self, align 8 - %__vtable = getelementptr inbounds %foo, %foo* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_foo* @__vtable_foo_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %foo, ptr %deref, i32 0, i32 0 + store ptr @__vtable_foo_instance, ptr %__vtable, align 8 ret void } - define void @__user_init___vtable_foo(%__vtable_foo* %0) { + define void @__user_init___vtable_foo(ptr %0) { entry: - %self = alloca %__vtable_foo*, align 8 - store %__vtable_foo* %0, %__vtable_foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } - define void @__user_init_foo(%foo* %0) { + define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___Test() { entry: - call void @__init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) - call void @__user_init___vtable_foo(%__vtable_foo* @__vtable_foo_instance) + call void @__init___vtable_foo(ptr @__vtable_foo_instance) + call void @__user_init___vtable_foo(ptr @__vtable_foo_instance) ret void } "#); diff --git a/src/tests/adr/pou_adr.rs b/src/tests/adr/pou_adr.rs index ac1ef8c7069..543bc690129 100644 --- a/src/tests/adr/pou_adr.rs +++ b/src/tests/adr/pou_adr.rs @@ -195,18 +195,18 @@ fn codegen_of_a_program_pou() { target datalayout = "[filtered]" target triple = "[filtered]" - %main_prg = type { i16, i16*, i16, i16 } + %main_prg = type { i16, ptr, i16, i16 } @main_prg_instance = global %main_prg zeroinitializer - define void @main_prg(%main_prg* %0) { + define void @main_prg(ptr %0) { entry: - %i = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 0 - %io = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 1 - %o = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 2 - %v = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 3 + %i = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 0 + %io = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 1 + %o = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 2 + %v = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 3 %vt = alloca i16, align 2 - store i16 0, i16* %vt, align 2 + store i16 0, ptr %vt, align 2 ret void } "#); @@ -235,7 +235,7 @@ fn calling_a_program() { target datalayout = "[filtered]" target triple = "[filtered]" - %main_prg = type { i16, i16*, i16, i16 } + %main_prg = type { i16, ptr, i16, i16 } @main_prg_instance = global %main_prg zeroinitializer @@ -244,26 +244,26 @@ fn calling_a_program() { %foo = alloca i16, align 2 %x = alloca i16, align 2 %y = alloca i16, align 2 - store i16 0, i16* %x, align 2 - store i16 0, i16* %y, align 2 - store i16 0, i16* %foo, align 2 - store i16 1, i16* getelementptr inbounds (%main_prg, %main_prg* @main_prg_instance, i32 0, i32 0), align 2 - store i16* %y, i16** getelementptr inbounds (%main_prg, %main_prg* @main_prg_instance, i32 0, i32 1), align 8 - call void @main_prg(%main_prg* @main_prg_instance) - %0 = load i16, i16* getelementptr inbounds (%main_prg, %main_prg* @main_prg_instance, i32 0, i32 2), align 2 - store i16 %0, i16* %x, align 2 - %foo_ret = load i16, i16* %foo, align 2 + store i16 0, ptr %x, align 2 + store i16 0, ptr %y, align 2 + store i16 0, ptr %foo, align 2 + store i16 1, ptr @main_prg_instance, align 2 + store ptr %y, ptr getelementptr inbounds nuw (%main_prg, ptr @main_prg_instance, i32 0, i32 1), align 8 + call void @main_prg(ptr @main_prg_instance) + %0 = load i16, ptr getelementptr inbounds nuw (%main_prg, ptr @main_prg_instance, i32 0, i32 2), align 2 + store i16 %0, ptr %x, align 2 + %foo_ret = load i16, ptr %foo, align 2 ret i16 %foo_ret } - define void @main_prg(%main_prg* %0) { + define void @main_prg(ptr %0) { entry: - %i = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 0 - %io = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 1 - %o = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 2 - %v = getelementptr inbounds %main_prg, %main_prg* %0, i32 0, i32 3 + %i = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 0 + %io = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 1 + %o = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 2 + %v = getelementptr inbounds nuw %main_prg, ptr %0, i32 0, i32 3 %vt = alloca i16, align 2 - store i16 0, i16* %vt, align 2 + store i16 0, ptr %vt, align 2 ret void } "#); @@ -300,20 +300,20 @@ fn function_blocks_get_a_method_with_a_self_parameter() { target datalayout = "[filtered]" target triple = "[filtered]" - %main_fb = type { i16, i16*, i16, i16 } + %main_fb = type { i16, ptr, i16, i16 } - @__main_fb__init = unnamed_addr constant %main_fb { i16 6, i16* null, i16 0, i16 1 } + @__main_fb__init = unnamed_addr constant %main_fb { i16 6, ptr null, i16 0, i16 1 } - define void @main_fb(%main_fb* %0) { + define void @main_fb(ptr %0) { entry: - %this = alloca %main_fb*, align 8 - store %main_fb* %0, %main_fb** %this, align 8 - %i = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 0 - %io = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 1 - %o = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 2 - %v = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %i = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 0 + %io = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 1 + %o = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 2 + %v = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 3 %vt = alloca i16, align 2 - store i16 2, i16* %vt, align 2 + store i16 2, ptr %vt, align 2 ret void } "#); @@ -344,37 +344,37 @@ fn calling_a_function_block() { target triple = "[filtered]" %foo = type { i16, i16, %main_fb } - %main_fb = type { i16, i16*, i16, i16 } + %main_fb = type { i16, ptr, i16, i16 } - @foo_instance = global %foo { i16 0, i16 0, %main_fb { i16 6, i16* null, i16 0, i16 1 } } - @__main_fb__init = unnamed_addr constant %main_fb { i16 6, i16* null, i16 0, i16 1 } + @foo_instance = global %foo { i16 0, i16 0, %main_fb { i16 6, ptr null, i16 0, i16 1 } } + @__main_fb__init = unnamed_addr constant %main_fb { i16 6, ptr null, i16 0, i16 1 } - define void @foo(%foo* %0) { + define void @foo(ptr %0) { entry: - %x = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 - %y = getelementptr inbounds %foo, %foo* %0, i32 0, i32 1 - %fb = getelementptr inbounds %foo, %foo* %0, i32 0, i32 2 - %1 = getelementptr inbounds %main_fb, %main_fb* %fb, i32 0, i32 0 - store i16 1, i16* %1, align 2 - %2 = getelementptr inbounds %main_fb, %main_fb* %fb, i32 0, i32 1 - store i16* %y, i16** %2, align 8 - call void @main_fb(%main_fb* %fb) - %3 = getelementptr inbounds %main_fb, %main_fb* %fb, i32 0, i32 2 - %4 = load i16, i16* %3, align 2 - store i16 %4, i16* %x, align 2 + %x = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 + %y = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 1 + %fb = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 2 + %1 = getelementptr inbounds nuw %main_fb, ptr %fb, i32 0, i32 0 + store i16 1, ptr %1, align 2 + %2 = getelementptr inbounds nuw %main_fb, ptr %fb, i32 0, i32 1 + store ptr %y, ptr %2, align 8 + call void @main_fb(ptr %fb) + %3 = getelementptr inbounds nuw %main_fb, ptr %fb, i32 0, i32 2 + %4 = load i16, ptr %3, align 2 + store i16 %4, ptr %x, align 2 ret void } - define void @main_fb(%main_fb* %0) { + define void @main_fb(ptr %0) { entry: - %this = alloca %main_fb*, align 8 - store %main_fb* %0, %main_fb** %this, align 8 - %i = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 0 - %io = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 1 - %o = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 2 - %v = getelementptr inbounds %main_fb, %main_fb* %0, i32 0, i32 3 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %i = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 0 + %io = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 1 + %o = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 2 + %v = getelementptr inbounds nuw %main_fb, ptr %0, i32 0, i32 3 %vt = alloca i16, align 2 - store i16 2, i16* %vt, align 2 + store i16 2, ptr %vt, align 2 ret void } "#); @@ -405,21 +405,21 @@ fn function_get_a_method_with_by_ref_parameters() { target datalayout = "[filtered]" target triple = "[filtered]" - define i32 @main_fun(i16 %0, i8* %1, i64* %2) { + define i32 @main_fun(i16 %0, ptr %1, ptr %2) { entry: %main_fun = alloca i32, align 4 %i = alloca i16, align 2 - store i16 %0, i16* %i, align 2 - %io = alloca i8*, align 8 - store i8* %1, i8** %io, align 8 - %o = alloca i64*, align 8 - store i64* %2, i64** %o, align 8 + store i16 %0, ptr %i, align 2 + %io = alloca ptr, align 8 + store ptr %1, ptr %io, align 8 + %o = alloca ptr, align 8 + store ptr %2, ptr %o, align 8 %v = alloca i16, align 2 %vt = alloca i16, align 2 - store i16 1, i16* %v, align 2 - store i16 2, i16* %vt, align 2 - store i32 0, i32* %main_fun, align 4 - %main_fun_ret = load i32, i32* %main_fun, align 4 + store i16 1, ptr %v, align 2 + store i16 2, ptr %vt, align 2 + store i32 0, ptr %main_fun, align 4 + %main_fun_ret = load i32, ptr %main_fun, align 4 ret i32 %main_fun_ret } "#); @@ -453,31 +453,31 @@ fn calling_a_function() { @prg_instance = global %prg zeroinitializer - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %x = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %z = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %load_x = load i16, i16* %x, align 2 + %x = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %z = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %load_x = load i16, ptr %x, align 2 %1 = alloca i64, align 8 - %call = call i32 @main_fun(i16 %load_x, i8* %z, i64* %1) + %call = call i32 @main_fun(i16 %load_x, ptr %z, ptr %1) ret void } - define i32 @main_fun(i16 %0, i8* %1, i64* %2) { + define i32 @main_fun(i16 %0, ptr %1, ptr %2) { entry: %main_fun = alloca i32, align 4 %i = alloca i16, align 2 - store i16 %0, i16* %i, align 2 - %io = alloca i8*, align 8 - store i8* %1, i8** %io, align 8 - %o = alloca i64*, align 8 - store i64* %2, i64** %o, align 8 + store i16 %0, ptr %i, align 2 + %io = alloca ptr, align 8 + store ptr %1, ptr %io, align 8 + %o = alloca ptr, align 8 + store ptr %2, ptr %o, align 8 %v = alloca i16, align 2 %vt = alloca i16, align 2 - store i16 1, i16* %v, align 2 - store i16 2, i16* %vt, align 2 - store i32 0, i32* %main_fun, align 4 - %main_fun_ret = load i32, i32* %main_fun, align 4 + store i16 1, ptr %v, align 2 + store i16 2, ptr %vt, align 2 + store i32 0, ptr %main_fun, align 4 + %main_fun_ret = load i32, ptr %main_fun, align 4 ret i32 %main_fun_ret } "#); @@ -518,37 +518,33 @@ fn return_a_complex_type_from_function() { @prg_instance = global %prg zeroinitializer @utf08_literal_0 = private unnamed_addr constant [13 x i8] c"hello world!\00" - define void @foo(i8* %0) { + define void @foo(ptr %0) { entry: - %foo = alloca i8*, align 8 - store i8* %0, i8** %foo, align 8 - %deref = load i8*, i8** %foo, align 8 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %deref, i8* align 1 getelementptr inbounds ([13 x i8], [13 x i8]* @utf08_literal_0, i32 0, i32 0), i32 13, i1 false) + %foo = alloca ptr, align 8 + store ptr %0, ptr %foo, align 8 + %deref = load ptr, ptr %foo, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %deref, ptr align 1 @utf08_literal_0, i32 13, i1 false) ret void } - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %s = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 + %s = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 %__foo0 = alloca [81 x i8], align 1 - %1 = bitcast [81 x i8]* %__foo0 to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %1, i8 0, i64 ptrtoint ([81 x i8]* getelementptr ([81 x i8], [81 x i8]* null, i32 1) to i64), i1 false) - %2 = bitcast [81 x i8]* %__foo0 to i8* - call void @foo(i8* %2) - %3 = bitcast [81 x i8]* %s to i8* - %4 = bitcast [81 x i8]* %__foo0 to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %3, i8* align 1 %4, i32 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %__foo0, i8 0, i64 ptrtoint (ptr getelementptr ([81 x i8], ptr null, i32 1) to i64), i1 false) + call void @foo(ptr %__foo0) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %s, ptr align 1 %__foo0, i32 80, i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn } - attributes #1 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -602,52 +598,39 @@ fn passing_aggregate_types_to_functions_by_value() { @__myStruct__init = unnamed_addr constant %myStruct zeroinitializer @main_instance = global %main zeroinitializer - define void @foo(i8* %0, i16* %1, i32* %2, %myStruct* %3) { + define void @foo(ptr %0, ptr %1, ptr %2, ptr %3) { entry: %s = alloca [81 x i8], align 1 - %bitcast = bitcast [81 x i8]* %s to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %bitcast, i8 0, i64 81, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %bitcast, i8* align 1 %0, i64 80, i1 false) + call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 81, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %s, ptr align 1 %0, i64 80, i1 false) %ws = alloca [81 x i16], align 2 - %bitcast1 = bitcast [81 x i16]* %ws to i16* - %4 = bitcast i16* %bitcast1 to i8* - call void @llvm.memset.p0i8.i64(i8* align 2 %4, i8 0, i64 162, i1 false) - %5 = bitcast i16* %bitcast1 to i8* - %6 = bitcast i16* %1 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 2 %5, i8* align 2 %6, i64 160, i1 false) + call void @llvm.memset.p0.i64(ptr align 2 %ws, i8 0, i64 162, i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 2 %ws, ptr align 2 %1, i64 160, i1 false) %arr = alloca [30000 x i32], align 4 - %bitcast2 = bitcast [30000 x i32]* %arr to i32* - %7 = bitcast i32* %bitcast2 to i8* - %8 = bitcast i32* %2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %7, i8* align 1 %8, i64 ptrtoint ([30000 x i32]* getelementptr ([30000 x i32], [30000 x i32]* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %arr, ptr align 1 %2, i64 ptrtoint (ptr getelementptr ([30000 x i32], ptr null, i32 1) to i64), i1 false) %st = alloca %myStruct, align 8 - %9 = bitcast %myStruct* %st to i8* - %10 = bitcast %myStruct* %3 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %9, i8* align 1 %10, i64 ptrtoint (%myStruct* getelementptr (%myStruct, %myStruct* null, i32 1) to i64), i1 false) + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %st, ptr align 1 %3, i64 ptrtoint (ptr getelementptr (%myStruct, ptr null, i32 1) to i64), i1 false) ret void } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %string1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %string2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %array1 = getelementptr inbounds %main, %main* %0, i32 0, i32 2 - %struct1 = getelementptr inbounds %main, %main* %0, i32 0, i32 3 - %1 = bitcast [81 x i8]* %string1 to i8* - %2 = bitcast [81 x i16]* %string2 to i16* - %3 = bitcast [30000 x i32]* %array1 to i32* - call void @foo(i8* %1, i16* %2, i32* %3, %myStruct* %struct1) + %string1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %string2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %array1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 2 + %struct1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 3 + call void @foo(ptr %string1, ptr %string2, ptr %array1, ptr %struct1) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } - attributes #1 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } + attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -688,25 +671,23 @@ fn passing_by_ref_to_functions() { @main_instance = global %main zeroinitializer - define i8 @StrEqual(i8* %0, i8* %1) { + define i8 @StrEqual(ptr %0, ptr %1) { entry: %StrEqual = alloca i8, align 1 - %o1 = alloca i8*, align 8 - store i8* %0, i8** %o1, align 8 - %o2 = alloca i8*, align 8 - store i8* %1, i8** %o2, align 8 - store i8 0, i8* %StrEqual, align 1 - %StrEqual_ret = load i8, i8* %StrEqual, align 1 + %o1 = alloca ptr, align 8 + store ptr %0, ptr %o1, align 8 + %o2 = alloca ptr, align 8 + store ptr %1, ptr %o2, align 8 + store i8 0, ptr %StrEqual, align 1 + %StrEqual_ret = load i8, ptr %StrEqual, align 1 ret i8 %StrEqual_ret } - define void @main(%main* %0) { + define void @main(ptr %0) { entry: - %str1 = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %str2 = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %1 = bitcast [81 x i8]* %str1 to i8* - %2 = bitcast [81 x i8]* %str2 to i8* - %call = call i8 @StrEqual(i8* %1, i8* %2) + %str1 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %str2 = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %call = call i8 @StrEqual(ptr %str1, ptr %str2) ret void } "#); diff --git a/src/tests/adr/strings_adr.rs b/src/tests/adr/strings_adr.rs index 888c98bda76..3ec72f90d2d 100644 --- a/src/tests/adr/strings_adr.rs +++ b/src/tests/adr/strings_adr.rs @@ -76,20 +76,18 @@ fn assigning_strings() { @prg_instance = global %prg zeroinitializer - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [11 x i8]* %a to i8* - %2 = bitcast [11 x i8]* %b to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 %2, i32 10, i1 false) + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 %b, i32 10, i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -121,20 +119,18 @@ fn assigning_string_literals() { @utf08_literal_0 = private unnamed_addr constant [6 x i8] c"hello\00" @utf08_literal_1 = private unnamed_addr constant [6 x i8] c"world\00" - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %a = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %b = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast [11 x i8]* %a to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_0, i32 0, i32 0), i32 6, i1 false) - %2 = bitcast [11 x i8]* %b to i8* - call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %2, i8* align 1 getelementptr inbounds ([6 x i8], [6 x i8]* @utf08_literal_1, i32 0, i32 0), i32 6, i1 false) + %a = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %a, ptr align 1 @utf08_literal_0, i32 6, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %b, ptr align 1 @utf08_literal_1, i32 6, i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } diff --git a/src/tests/adr/structs_adr.rs b/src/tests/adr/structs_adr.rs index cda4ae35525..d20abf518e5 100644 --- a/src/tests/adr/structs_adr.rs +++ b/src/tests/adr/structs_adr.rs @@ -109,10 +109,10 @@ fn initializing_a_struct() { @__prg.rect1__init = unnamed_addr constant %Rect { %Point { i16 1, i16 5 }, %Point { i16 10, i16 15 } } @__prg.rect2__init = unnamed_addr constant %Rect { %Point { i16 4, i16 6 }, %Point { i16 16, i16 22 } } - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %rect1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %rect2 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 + %rect1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %rect2 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 ret void } "#); @@ -154,20 +154,18 @@ fn assigning_structs() { @prg_instance = global %prg zeroinitializer @__Point__init = unnamed_addr constant %Point zeroinitializer - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %p1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %p2 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %1 = bitcast %Point* %p1 to i8* - %2 = bitcast %Point* %p2 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %1, i8* align 1 %2, i64 ptrtoint (%Point* getelementptr (%Point, %Point* null, i32 1) to i64), i1 false) + %p1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %p2 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %p1, ptr align 1 %p2, i64 ptrtoint (ptr getelementptr (%Point, ptr null, i32 1) to i64), i1 false) ret void } - ; Function Attrs: argmemonly nofree nounwind willreturn - declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) + declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } "#); } @@ -214,16 +212,16 @@ fn accessing_struct_members() { @__Rect__init = unnamed_addr constant %Rect zeroinitializer @__Point__init = unnamed_addr constant %Point zeroinitializer - define void @prg(%prg* %0) { + define void @prg(ptr %0) { entry: - %rect1 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 0 - %rect2 = getelementptr inbounds %prg, %prg* %0, i32 0, i32 1 - %topLeft = getelementptr inbounds %Rect, %Rect* %rect1, i32 0, i32 0 - %x = getelementptr inbounds %Point, %Point* %topLeft, i32 0, i32 0 - %bottomRight = getelementptr inbounds %Rect, %Rect* %rect2, i32 0, i32 1 - %x1 = getelementptr inbounds %Point, %Point* %bottomRight, i32 0, i32 0 - %load_x = load i16, i16* %x1, align 2 - store i16 %load_x, i16* %x, align 2 + %rect1 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 0 + %rect2 = getelementptr inbounds nuw %prg, ptr %0, i32 0, i32 1 + %topLeft = getelementptr inbounds nuw %Rect, ptr %rect1, i32 0, i32 0 + %x = getelementptr inbounds nuw %Point, ptr %topLeft, i32 0, i32 0 + %bottomRight = getelementptr inbounds nuw %Rect, ptr %rect2, i32 0, i32 1 + %x1 = getelementptr inbounds nuw %Point, ptr %bottomRight, i32 0, i32 0 + %load_x = load i16, ptr %x1, align 2 + store i16 %load_x, ptr %x, align 2 ret void } "#); diff --git a/src/tests/adr/vla_adr.rs b/src/tests/adr/vla_adr.rs index 9e8ee65e644..9a7910c3103 100644 --- a/src/tests/adr/vla_adr.rs +++ b/src/tests/adr/vla_adr.rs @@ -183,7 +183,7 @@ fn declare() { END_FUNCTION "; - assert!(codegen(src).contains("%__foo_arr = type { i32*, [2 x i32] }")); + assert!(codegen(src).contains("%__foo_arr = type { ptr, [2 x i32] }")); } /// VLAs (in RuSTy) are defined to be always by-ref, meaning POUs accepting VLAs expect a pointer to a struct. @@ -314,7 +314,7 @@ fn pass() { target datalayout = "[filtered]" target triple = "[filtered]" - %__foo_arr = type { i32*, [2 x i32] } + %__foo_arr = type { ptr, [2 x i32] } @____foo_arr__init = unnamed_addr constant %__foo_arr zeroinitializer @@ -322,38 +322,37 @@ fn pass() { entry: %main = alloca i32, align 4 %local = alloca [6 x i32], align 4 - %0 = bitcast [6 x i32]* %local to i8* - call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 ptrtoint ([6 x i32]* getelementptr ([6 x i32], [6 x i32]* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - %auto_deref = load [6 x i32], [6 x i32]* %local, align 4 - %outer_arr_gep = getelementptr inbounds [6 x i32], [6 x i32]* %local, i32 0, i32 0 + call void @llvm.memset.p0.i64(ptr align 1 %local, i8 0, i64 ptrtoint (ptr getelementptr ([6 x i32], ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + %auto_deref = load [6 x i32], ptr %local, align 4 + %outer_arr_gep = getelementptr inbounds [6 x i32], ptr %local, i32 0, i32 0 %vla_struct = alloca %__foo_arr, align 8 - %vla_array_gep = getelementptr inbounds %__foo_arr, %__foo_arr* %vla_struct, i32 0, i32 0 - %vla_dimensions_gep = getelementptr inbounds %__foo_arr, %__foo_arr* %vla_struct, i32 0, i32 1 - store [2 x i32] [i32 0, i32 5], [2 x i32]* %vla_dimensions_gep, align 4 - store i32* %outer_arr_gep, i32** %vla_array_gep, align 8 - %1 = load %__foo_arr, %__foo_arr* %vla_struct, align 8 + %vla_array_gep = getelementptr inbounds nuw %__foo_arr, ptr %vla_struct, i32 0, i32 0 + %vla_dimensions_gep = getelementptr inbounds nuw %__foo_arr, ptr %vla_struct, i32 0, i32 1 + store [2 x i32] [i32 0, i32 5], ptr %vla_dimensions_gep, align 4 + store ptr %outer_arr_gep, ptr %vla_array_gep, align 8 + %0 = load %__foo_arr, ptr %vla_struct, align 8 %vla_struct_ptr = alloca %__foo_arr, align 8 - store %__foo_arr %1, %__foo_arr* %vla_struct_ptr, align 8 - %call = call i32 @foo(%__foo_arr* %vla_struct_ptr) - %main_ret = load i32, i32* %main, align 4 + store %__foo_arr %0, ptr %vla_struct_ptr, align 8 + %call = call i32 @foo(ptr %vla_struct_ptr) + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } - define i32 @foo(%__foo_arr* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %arr = alloca %__foo_arr*, align 8 - store %__foo_arr* %0, %__foo_arr** %arr, align 8 - store i32 0, i32* %foo, align 4 - %foo_ret = load i32, i32* %foo, align 4 + %arr = alloca ptr, align 8 + store ptr %0, ptr %arr, align 8 + store i32 0, ptr %foo, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } - ; Function Attrs: argmemonly nofree nounwind willreturn writeonly - declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 + ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) + declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0 - attributes #0 = { argmemonly nofree nounwind willreturn writeonly } + attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } "#); } @@ -382,28 +381,28 @@ fn access() { target datalayout = "[filtered]" target triple = "[filtered]" - %__foo_arr = type { i32*, [2 x i32] } + %__foo_arr = type { ptr, [2 x i32] } @____foo_arr__init = unnamed_addr constant %__foo_arr zeroinitializer - define i32 @foo(%__foo_arr* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %arr = alloca %__foo_arr*, align 8 - store %__foo_arr* %0, %__foo_arr** %arr, align 8 - store i32 0, i32* %foo, align 4 - %deref = load %__foo_arr*, %__foo_arr** %arr, align 8 - %vla_arr_gep = getelementptr inbounds %__foo_arr, %__foo_arr* %deref, i32 0, i32 0 - %vla_arr_ptr = load i32*, i32** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_arr, %__foo_arr* %deref, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 + %arr = alloca ptr, align 8 + store ptr %0, ptr %arr, align 8 + store i32 0, ptr %foo, align 4 + %deref = load ptr, ptr %arr, align 8 + %vla_arr_gep = getelementptr inbounds nuw %__foo_arr, ptr %deref, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_arr, ptr %deref, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [2 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 %tmpVar = sub i32 0, %start_idx_value0 - %arr_val = getelementptr inbounds i32, i32* %vla_arr_ptr, i32 %tmpVar - store i32 12345, i32* %arr_val, align 4 - %foo_ret = load i32, i32* %foo, align 4 + %arr_val = getelementptr inbounds i32, ptr %vla_arr_ptr, i32 %tmpVar + store i32 12345, ptr %arr_val, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } "#); @@ -442,54 +441,54 @@ fn multi_dimensional() { target datalayout = "[filtered]" target triple = "[filtered]" - %__foo_arr = type { i32*, [4 x i32] } + %__foo_arr = type { ptr, [4 x i32] } @____foo_arr__init = unnamed_addr constant %__foo_arr zeroinitializer - define i32 @foo(%__foo_arr* %0) { + define i32 @foo(ptr %0) { entry: %foo = alloca i32, align 4 - %arr = alloca %__foo_arr*, align 8 - store %__foo_arr* %0, %__foo_arr** %arr, align 8 - store i32 0, i32* %foo, align 4 - %deref = load %__foo_arr*, %__foo_arr** %arr, align 8 - %vla_arr_gep = getelementptr inbounds %__foo_arr, %__foo_arr* %deref, i32 0, i32 0 - %vla_arr_ptr = load i32*, i32** %vla_arr_gep, align 8 - %dim_arr = getelementptr inbounds %__foo_arr, %__foo_arr* %deref, i32 0, i32 1 - %start_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 0 - %end_idx_ptr0 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 1 - %start_idx_value0 = load i32, i32* %start_idx_ptr0, align 4 - %end_idx_value0 = load i32, i32* %end_idx_ptr0, align 4 - %start_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 2 - %end_idx_ptr1 = getelementptr inbounds [4 x i32], [4 x i32]* %dim_arr, i32 0, i32 3 - %start_idx_value1 = load i32, i32* %start_idx_ptr1, align 4 - %end_idx_value1 = load i32, i32* %end_idx_ptr1, align 4 + %arr = alloca ptr, align 8 + store ptr %0, ptr %arr, align 8 + store i32 0, ptr %foo, align 4 + %deref = load ptr, ptr %arr, align 8 + %vla_arr_gep = getelementptr inbounds nuw %__foo_arr, ptr %deref, i32 0, i32 0 + %vla_arr_ptr = load ptr, ptr %vla_arr_gep, align 8 + %dim_arr = getelementptr inbounds nuw %__foo_arr, ptr %deref, i32 0, i32 1 + %start_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 0 + %end_idx_ptr0 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 1 + %start_idx_value0 = load i32, ptr %start_idx_ptr0, align 4 + %end_idx_value0 = load i32, ptr %end_idx_ptr0, align 4 + %start_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 2 + %end_idx_ptr1 = getelementptr inbounds [4 x i32], ptr %dim_arr, i32 0, i32 3 + %start_idx_value1 = load i32, ptr %start_idx_ptr1, align 4 + %end_idx_value1 = load i32, ptr %end_idx_ptr1, align 4 %1 = sub i32 %end_idx_value0, %start_idx_value0 %len_dim0 = add i32 1, %1 %2 = sub i32 %end_idx_value1, %start_idx_value1 %len_dim1 = add i32 1, %2 %accum = alloca i32, align 4 - store i32 1, i32* %accum, align 4 - %load_accum = load i32, i32* %accum, align 4 + store i32 1, ptr %accum, align 4 + %load_accum = load i32, ptr %accum, align 4 %product = mul i32 %load_accum, %len_dim1 - store i32 %product, i32* %accum, align 4 - %accessor_factor = load i32, i32* %accum, align 4 + store i32 %product, ptr %accum, align 4 + %accessor_factor = load i32, ptr %accum, align 4 %adj_access0 = sub i32 0, %start_idx_value0 %adj_access1 = sub i32 1, %start_idx_value1 %accum1 = alloca i32, align 4 - store i32 0, i32* %accum1, align 4 + store i32 0, ptr %accum1, align 4 %multiply = mul i32 %adj_access0, %accessor_factor - %load_accum2 = load i32, i32* %accum1, align 4 + %load_accum2 = load i32, ptr %accum1, align 4 %accumulate = add i32 %load_accum2, %multiply - store i32 %accumulate, i32* %accum1, align 4 + store i32 %accumulate, ptr %accum1, align 4 %multiply3 = mul i32 %adj_access1, 1 - %load_accum4 = load i32, i32* %accum1, align 4 + %load_accum4 = load i32, ptr %accum1, align 4 %accumulate5 = add i32 %load_accum4, %multiply3 - store i32 %accumulate5, i32* %accum1, align 4 - %accessor = load i32, i32* %accum1, align 4 - %arr_val = getelementptr inbounds i32, i32* %vla_arr_ptr, i32 %accessor - store i32 12345, i32* %arr_val, align 4 - %foo_ret = load i32, i32* %foo, align 4 + store i32 %accumulate5, ptr %accum1, align 4 + %accessor = load i32, ptr %accum1, align 4 + %arr_val = getelementptr inbounds i32, ptr %vla_arr_ptr, i32 %accessor + store i32 12345, ptr %arr_val, align 4 + %foo_ret = load i32, ptr %foo, align 4 ret i32 %foo_ret } "#); diff --git a/tests/integration/linking.rs b/tests/integration/linking.rs index 29b20241749..68a6e533fd9 100644 --- a/tests/integration/linking.rs +++ b/tests/integration/linking.rs @@ -140,14 +140,15 @@ fn link_missing_file() { let res = compile(&["plc", file1.as_str(), "-o", out.to_str().unwrap(), "--target", TARGET.unwrap()]); - match res { - Err(err) => { - assert!(err - .to_string() - .contains("An error occurred during linking: lld: error: undefined symbol: func")); - } - _ => panic!("Expected link failure"), - } + // lld will return something like: + // ``` + // ld.lld: error: undefined symbol: func2 + // >>> referenced by file1.st + // >>> /tmp/.tmpvZqPnA/tests/integration/data/linking/file1.st.o:(func1) + // >>> did you mean: func1 + // >>> defined in: /tmp/.tmpvZqPnA/tests/integration/data/linking/file1.st.o + // ``` + assert!(res.is_err()); } // TODO: Ghaith please fix this :) diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__actions_debug.snap b/tests/integration/snapshots/tests__integration__cfc__ir__actions_debug.snap index 9c379db6637..2040bb48bdf 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__actions_debug.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__actions_debug.snap @@ -6,68 +6,61 @@ target triple = "[filtered]" %main = type { i32, i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @main_instance = global %main zeroinitializer, !dbg !0 -define void @main(%main* %0) !dbg !12 { +define void @main(ptr %0) !dbg !12 { entry: - call void @llvm.dbg.declare(metadata %main* %0, metadata !16, metadata !DIExpression()), !dbg !17 - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - store i32 0, i32* %a, align 4, !dbg !18 - call void @main__newAction(%main* %0), !dbg !17 - call void @main__newAction2(%main* %0), !dbg !19 + #dbg_declare(ptr %0, !16, !DIExpression(), !17) + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + store i32 0, ptr %a, align 4, !dbg !18 + call void @main__newAction(ptr %0), !dbg !17 + call void @main__newAction2(ptr %0), !dbg !19 ret void, !dbg !20 } -define void @main__newAction(%main* %0) { +define void @main__newAction(ptr %0) { entry: - call void @llvm.dbg.declare(metadata %main* %0, metadata !15, metadata !DIExpression()), !dbg !21 - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %load_a = load i32, i32* %a, align 4, !dbg !21 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %load_a = load i32, ptr %a, align 4, !dbg !21 %tmpVar = add i32 %load_a, 1, !dbg !21 - store i32 %tmpVar, i32* %a, align 4, !dbg !21 + store i32 %tmpVar, ptr %a, align 4, !dbg !21 ret void, !dbg !22 } -define void @main__newAction2(%main* %0) { +define void @main__newAction2(ptr %0) { entry: - call void @llvm.dbg.declare(metadata %main* %0, metadata !15, metadata !DIExpression()), !dbg !21 - %a = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - %b = getelementptr inbounds %main, %main* %0, i32 0, i32 1 - %load_b = load i32, i32* %b, align 4, !dbg !23 + %a = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + %b = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 1 + %load_b = load i32, ptr %b, align 4, !dbg !23 %tmpVar = add i32 %load_b, 2, !dbg !23 - store i32 %tmpVar, i32* %b, align 4, !dbg !23 + store i32 %tmpVar, ptr %b, align 4, !dbg !23 ret void, !dbg !22 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -define void @__init_main(%main* %0) { +define void @__init_main(ptr %0) { entry: - %self = alloca %main*, align 8 - store %main* %0, %main** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_main(%main* %0) { +define void @__user_init_main(ptr %0) { entry: - %self = alloca %main*, align 8 - store %main* %0, %main** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init_main(%main* @main_instance) - call void @__user_init_main(%main* @main_instance) + call void @__init_main(ptr @main_instance) + call void @__user_init_main(ptr @main_instance) ret void } -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!8, !9} !llvm.dbg.cu = !{!10} diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return.snap b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return.snap index 00cde4aeb9c..d4144965327 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return.snap @@ -4,21 +4,21 @@ expression: output_file_content_without_headers --- target triple = "[filtered]" -%__vtable_conditional_return = type { void (%conditional_return*)* } -%conditional_return = type { i32*, i32 } +%__vtable_conditional_return = type { ptr } +%conditional_return = type { ptr, i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @____vtable_conditional_return__init = unnamed_addr constant %__vtable_conditional_return zeroinitializer @__conditional_return__init = unnamed_addr constant %conditional_return zeroinitializer @__vtable_conditional_return_instance = global %__vtable_conditional_return zeroinitializer -define void @conditional_return(%conditional_return* %0) { +define void @conditional_return(ptr %0) { entry: - %this = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %this, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 0 - %val = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 1 - %load_val = load i32, i32* %val, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 1 + %load_val = load i32, ptr %val, align 4 %tmpVar = icmp eq i32 %load_val, 5 br i1 %tmpVar, label %then_block, label %else_block @@ -26,47 +26,47 @@ then_block: ; preds = %entry ret void else_block: ; preds = %entry - store i32 10, i32* %val, align 4 + store i32 10, ptr %val, align 4 ret void } -define void @__init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 - %deref = load %__vtable_conditional_return*, %__vtable_conditional_return** %self, align 8 - %__body = getelementptr inbounds %__vtable_conditional_return, %__vtable_conditional_return* %deref, i32 0, i32 0 - store void (%conditional_return*)* @conditional_return, void (%conditional_return*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_conditional_return, ptr %deref, i32 0, i32 0 + store ptr @conditional_return, ptr %__body, align 8 ret void } -define void @__init_conditional_return(%conditional_return* %0) { +define void @__init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 - %deref = load %conditional_return*, %conditional_return** %self, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_conditional_return* @__vtable_conditional_return_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %deref, i32 0, i32 0 + store ptr @__vtable_conditional_return_instance, ptr %__vtable, align 8 ret void } -define void @__user_init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__user_init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_conditional_return(%conditional_return* %0) { +define void @__user_init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) - call void @__user_init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) + call void @__init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) + call void @__user_init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) ret void } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap index 09ce6001209..08f0ae62270 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap @@ -1,44 +1,38 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] define i32 @foo(i32 %0) !dbg !4 { entry: %foo = alloca i32, align 4 %val = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %val, metadata !9, metadata !DIExpression()), !dbg !10 - store i32 %0, i32* %val, align 4 - call void @llvm.dbg.declare(metadata i32* %foo, metadata !11, metadata !DIExpression()), !dbg !12 - store i32 0, i32* %foo, align 4 - %load_val = load i32, i32* %val, align 4, !dbg !13 + #dbg_declare(ptr %val, !9, !DIExpression(), !10) + store i32 %0, ptr %val, align 4 + #dbg_declare(ptr %foo, !11, !DIExpression(), !12) + store i32 0, ptr %foo, align 4 + %load_val = load i32, ptr %val, align 4, !dbg !13 %tmpVar = icmp eq i32 %load_val, 5, !dbg !13 br i1 %tmpVar, label %then_block, label %else_block, !dbg !13 then_block: ; preds = %entry - %foo_ret = load i32, i32* %foo, align 4, !dbg !14 + %foo_ret = load i32, ptr %foo, align 4, !dbg !14 ret i32 %foo_ret, !dbg !14 else_block: ; preds = %entry - store i32 10, i32* %val, align 4, !dbg !15 - %foo_ret1 = load i32, i32* %foo, align 4, !dbg !16 + store i32 10, ptr %val, align 4, !dbg !15 + %foo_ret1 = load i32, ptr %foo, align 4, !dbg !16 ret i32 %foo_ret1, !dbg !16 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - define void @__init___plc() { entry: ret void } -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true.snap b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true.snap index caba3519446..438167a05f5 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true.snap @@ -4,10 +4,10 @@ expression: output_file_content_without_headers --- target triple = "[filtered]" -%__vtable_conditional_return = type { void (%conditional_return*)* } -%conditional_return = type { i32*, i32 } +%__vtable_conditional_return = type { ptr } +%conditional_return = type { ptr, i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @____vtable_conditional_return__init = unnamed_addr constant %__vtable_conditional_return zeroinitializer @__conditional_return__init = unnamed_addr constant %conditional_return zeroinitializer @__vtable_conditional_return_instance = global %__vtable_conditional_return zeroinitializer @@ -17,33 +17,32 @@ entry: %main = alloca i32, align 4 %my_val = alloca i32, align 4 %conditional = alloca %conditional_return, align 8 - store i32 5, i32* %my_val, align 4 - %0 = bitcast %conditional_return* %conditional to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%conditional_return* @__conditional_return__init to i8*), i64 ptrtoint (%conditional_return* getelementptr (%conditional_return, %conditional_return* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - call void @__init_conditional_return(%conditional_return* %conditional) - call void @__user_init_conditional_return(%conditional_return* %conditional) - %val = getelementptr inbounds %conditional_return, %conditional_return* %conditional, i32 0, i32 1 - %load_my_val = load i32, i32* %my_val, align 4 - store i32 %load_my_val, i32* %val, align 4 - call void @conditional_return(%conditional_return* %conditional) - %val1 = getelementptr inbounds %conditional_return, %conditional_return* %conditional, i32 0, i32 1 - %load_val = load i32, i32* %val1, align 4 - store i32 %load_val, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 5, ptr %my_val, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %conditional, ptr align 1 @__conditional_return__init, i64 ptrtoint (ptr getelementptr (%conditional_return, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + call void @__init_conditional_return(ptr %conditional) + call void @__user_init_conditional_return(ptr %conditional) + %val = getelementptr inbounds nuw %conditional_return, ptr %conditional, i32 0, i32 1 + %load_my_val = load i32, ptr %my_val, align 4 + store i32 %load_my_val, ptr %val, align 4 + call void @conditional_return(ptr %conditional) + %val1 = getelementptr inbounds nuw %conditional_return, ptr %conditional, i32 0, i32 1 + %load_val = load i32, ptr %val1, align 4 + store i32 %load_val, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -define void @conditional_return(%conditional_return* %0) { +define void @conditional_return(ptr %0) { entry: - %this = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %this, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 0 - %val = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 1 - %load_val = load i32, i32* %val, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 1 + %load_val = load i32, ptr %val, align 4 %tmpVar = icmp eq i32 %load_val, 5 br i1 %tmpVar, label %then_block, label %else_block @@ -51,49 +50,49 @@ then_block: ; preds = %entry ret void else_block: ; preds = %entry - store i32 10, i32* %val, align 4 + store i32 10, ptr %val, align 4 ret void } -define void @__init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 - %deref = load %__vtable_conditional_return*, %__vtable_conditional_return** %self, align 8 - %__body = getelementptr inbounds %__vtable_conditional_return, %__vtable_conditional_return* %deref, i32 0, i32 0 - store void (%conditional_return*)* @conditional_return, void (%conditional_return*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_conditional_return, ptr %deref, i32 0, i32 0 + store ptr @conditional_return, ptr %__body, align 8 ret void } -define void @__init_conditional_return(%conditional_return* %0) { +define void @__init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 - %deref = load %conditional_return*, %conditional_return** %self, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_conditional_return* @__vtable_conditional_return_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %deref, i32 0, i32 0 + store ptr @__vtable_conditional_return_instance, ptr %__vtable, align 8 ret void } -define void @__user_init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__user_init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_conditional_return(%conditional_return* %0) { +define void @__user_init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) - call void @__user_init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) + call void @__init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) + call void @__user_init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) ret void } -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true_negated.snap b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true_negated.snap index 57a6a546d0e..8748237468f 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true_negated.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_evaluating_true_negated.snap @@ -4,10 +4,10 @@ expression: output_file_content_without_headers --- target triple = "[filtered]" -%__vtable_conditional_return = type { void (%conditional_return*)* } -%conditional_return = type { i32*, i32 } +%__vtable_conditional_return = type { ptr } +%conditional_return = type { ptr, i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @____vtable_conditional_return__init = unnamed_addr constant %__vtable_conditional_return zeroinitializer @__conditional_return__init = unnamed_addr constant %conditional_return zeroinitializer @__vtable_conditional_return_instance = global %__vtable_conditional_return zeroinitializer @@ -17,33 +17,32 @@ entry: %main = alloca i32, align 4 %my_val = alloca i32, align 4 %conditional = alloca %conditional_return, align 8 - store i32 5, i32* %my_val, align 4 - %0 = bitcast %conditional_return* %conditional to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 bitcast (%conditional_return* @__conditional_return__init to i8*), i64 ptrtoint (%conditional_return* getelementptr (%conditional_return, %conditional_return* null, i32 1) to i64), i1 false) - store i32 0, i32* %main, align 4 - call void @__init_conditional_return(%conditional_return* %conditional) - call void @__user_init_conditional_return(%conditional_return* %conditional) - %val = getelementptr inbounds %conditional_return, %conditional_return* %conditional, i32 0, i32 1 - %load_my_val = load i32, i32* %my_val, align 4 - store i32 %load_my_val, i32* %val, align 4 - call void @conditional_return(%conditional_return* %conditional) - %val1 = getelementptr inbounds %conditional_return, %conditional_return* %conditional, i32 0, i32 1 - %load_val = load i32, i32* %val1, align 4 - store i32 %load_val, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 5, ptr %my_val, align 4 + call void @llvm.memcpy.p0.p0.i64(ptr align 1 %conditional, ptr align 1 @__conditional_return__init, i64 ptrtoint (ptr getelementptr (%conditional_return, ptr null, i32 1) to i64), i1 false) + store i32 0, ptr %main, align 4 + call void @__init_conditional_return(ptr %conditional) + call void @__user_init_conditional_return(ptr %conditional) + %val = getelementptr inbounds nuw %conditional_return, ptr %conditional, i32 0, i32 1 + %load_my_val = load i32, ptr %my_val, align 4 + store i32 %load_my_val, ptr %val, align 4 + call void @conditional_return(ptr %conditional) + %val1 = getelementptr inbounds nuw %conditional_return, ptr %conditional, i32 0, i32 1 + %load_val = load i32, ptr %val1, align 4 + store i32 %load_val, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } -; Function Attrs: argmemonly nofree nounwind willreturn -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0 +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 -define void @conditional_return(%conditional_return* %0) { +define void @conditional_return(ptr %0) { entry: - %this = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %this, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 0 - %val = getelementptr inbounds %conditional_return, %conditional_return* %0, i32 0, i32 1 - %load_val = load i32, i32* %val, align 4 + %this = alloca ptr, align 8 + store ptr %0, ptr %this, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 0 + %val = getelementptr inbounds nuw %conditional_return, ptr %0, i32 0, i32 1 + %load_val = load i32, ptr %val, align 4 %tmpVar = icmp eq i32 %load_val, 5 %tmpVar1 = xor i1 %tmpVar, true br i1 %tmpVar1, label %then_block, label %else_block @@ -52,49 +51,49 @@ then_block: ; preds = %entry ret void else_block: ; preds = %entry - store i32 10, i32* %val, align 4 + store i32 10, ptr %val, align 4 ret void } -define void @__init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 - %deref = load %__vtable_conditional_return*, %__vtable_conditional_return** %self, align 8 - %__body = getelementptr inbounds %__vtable_conditional_return, %__vtable_conditional_return* %deref, i32 0, i32 0 - store void (%conditional_return*)* @conditional_return, void (%conditional_return*)** %__body, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__body = getelementptr inbounds nuw %__vtable_conditional_return, ptr %deref, i32 0, i32 0 + store ptr @conditional_return, ptr %__body, align 8 ret void } -define void @__init_conditional_return(%conditional_return* %0) { +define void @__init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 - %deref = load %conditional_return*, %conditional_return** %self, align 8 - %__vtable = getelementptr inbounds %conditional_return, %conditional_return* %deref, i32 0, i32 0 - store i32* bitcast (%__vtable_conditional_return* @__vtable_conditional_return_instance to i32*), i32** %__vtable, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 + %deref = load ptr, ptr %self, align 8 + %__vtable = getelementptr inbounds nuw %conditional_return, ptr %deref, i32 0, i32 0 + store ptr @__vtable_conditional_return_instance, ptr %__vtable, align 8 ret void } -define void @__user_init___vtable_conditional_return(%__vtable_conditional_return* %0) { +define void @__user_init___vtable_conditional_return(ptr %0) { entry: - %self = alloca %__vtable_conditional_return*, align 8 - store %__vtable_conditional_return* %0, %__vtable_conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_conditional_return(%conditional_return* %0) { +define void @__user_init_conditional_return(ptr %0) { entry: - %self = alloca %conditional_return*, align 8 - store %conditional_return* %0, %conditional_return** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) - call void @__user_init___vtable_conditional_return(%__vtable_conditional_return* @__vtable_conditional_return_instance) + call void @__init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) + call void @__user_init___vtable_conditional_return(ptr @__vtable_conditional_return_instance) ret void } -attributes #0 = { argmemonly nofree nounwind willreturn } +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__jump_debug.snap b/tests/integration/snapshots/tests__integration__cfc__ir__jump_debug.snap index 5079d6481e2..6d2e4194cbb 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__jump_debug.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__jump_debug.snap @@ -1,57 +1,51 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" %foo = type { i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @foo_instance = global %foo zeroinitializer, !dbg !0 -define void @foo(%foo* %0) !dbg !11 { +define void @foo(ptr %0) !dbg !11 { entry: - call void @llvm.dbg.declare(metadata %foo* %0, metadata !15, metadata !DIExpression()), !dbg !16 - %val = getelementptr inbounds %foo, %foo* %0, i32 0, i32 0 + #dbg_declare(ptr %0, !15, !DIExpression(), !16) + %val = getelementptr inbounds nuw %foo, ptr %0, i32 0, i32 0 br label %lbl, !dbg !17 lbl: ; preds = %lbl, %entry - %load_val = load i32, i32* %val, align 4, !dbg !16 + %load_val = load i32, ptr %val, align 4, !dbg !16 %tmpVar = icmp eq i32 %load_val, 0, !dbg !16 br i1 %tmpVar, label %lbl, label %else_block, !dbg !18 else_block: ; preds = %lbl - store i32 1, i32* %val, align 4, !dbg !19 + store i32 1, ptr %val, align 4, !dbg !19 ret void, !dbg !20 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -define void @__init_foo(%foo* %0) { +define void @__init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_foo(%foo* %0) { +define void @__user_init_foo(ptr %0) { entry: - %self = alloca %foo*, align 8 - store %foo* %0, %foo** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init_foo(%foo* @foo_instance) - call void @__user_init_foo(%foo* @foo_instance) + call void @__init_foo(ptr @foo_instance) + call void @__user_init_foo(ptr @foo_instance) ret void } -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!7, !8} !llvm.dbg.cu = !{!9} diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_false.snap b/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_false.snap index 8703789d524..c1c92ce6770 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_false.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_false.snap @@ -1,35 +1,34 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] define i32 @main() { entry: %main = alloca i32, align 4 %x = alloca i8, align 1 %a = alloca i32, align 4 - store i8 0, i8* %x, align 1 - store i32 0, i32* %a, align 4 - store i32 0, i32* %main, align 4 - store i8 0, i8* %x, align 1 - %load_x = load i8, i8* %x, align 1 + store i8 0, ptr %x, align 1 + store i32 0, ptr %a, align 4 + store i32 0, ptr %main, align 4 + store i8 0, ptr %x, align 1 + %load_x = load i8, ptr %x, align 1 br i8 %load_x, label %lbl, label %else_block else_block: ; preds = %entry - store i32 2, i32* %a, align 4 + store i32 2, ptr %a, align 4 br label %lbl lbl: ; preds = %else_block, %entry - %load_a = load i32, i32* %a, align 4 + %load_a = load i32, ptr %a, align 4 %tmpVar = add i32 %load_a, 3 - store i32 %tmpVar, i32* %a, align 4 - %load_a1 = load i32, i32* %a, align 4 - store i32 %load_a1, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 %tmpVar, ptr %a, align 4 + %load_a1 = load i32, ptr %a, align 4 + store i32 %load_a1, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_true.snap b/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_true.snap index c5fa1c00a80..da083d9f752 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_true.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__jump_to_label_with_true.snap @@ -1,35 +1,34 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] define i32 @main() { entry: %main = alloca i32, align 4 %x = alloca i8, align 1 %a = alloca i32, align 4 - store i8 0, i8* %x, align 1 - store i32 0, i32* %a, align 4 - store i32 0, i32* %main, align 4 - store i8 1, i8* %x, align 1 - %load_x = load i8, i8* %x, align 1 + store i8 0, ptr %x, align 1 + store i32 0, ptr %a, align 4 + store i32 0, ptr %main, align 4 + store i8 1, ptr %x, align 1 + %load_x = load i8, ptr %x, align 1 br i8 %load_x, label %lbl, label %else_block else_block: ; preds = %entry - store i32 2, i32* %a, align 4 + store i32 2, ptr %a, align 4 br label %lbl lbl: ; preds = %else_block, %entry - %load_a = load i32, i32* %a, align 4 + %load_a = load i32, ptr %a, align 4 %tmpVar = add i32 %load_a, 3 - store i32 %tmpVar, i32* %a, align 4 - %load_a1 = load i32, i32* %a, align 4 - store i32 %load_a1, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 %tmpVar, ptr %a, align 4 + %load_a1 = load i32, ptr %a, align 4 + store i32 %load_a1, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__sink_source_debug.snap b/tests/integration/snapshots/tests__integration__cfc__ir__sink_source_debug.snap index fb480bfabf9..8082c6f0242 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__sink_source_debug.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__sink_source_debug.snap @@ -1,49 +1,43 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" %main = type { i32 } -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] @main_instance = global %main zeroinitializer, !dbg !0 -define void @main(%main* %0) !dbg !11 { +define void @main(ptr %0) !dbg !11 { entry: - call void @llvm.dbg.declare(metadata %main* %0, metadata !15, metadata !DIExpression()), !dbg !16 - %x = getelementptr inbounds %main, %main* %0, i32 0, i32 0 - store i32 5, i32* %x, align 4, !dbg !17 + #dbg_declare(ptr %0, !15, !DIExpression(), !16) + %x = getelementptr inbounds nuw %main, ptr %0, i32 0, i32 0 + store i32 5, ptr %x, align 4, !dbg !17 ret void, !dbg !18 } -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -define void @__init_main(%main* %0) { +define void @__init_main(ptr %0) { entry: - %self = alloca %main*, align 8 - store %main* %0, %main** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } -define void @__user_init_main(%main* %0) { +define void @__user_init_main(ptr %0) { entry: - %self = alloca %main*, align 8 - store %main* %0, %main** %self, align 8 + %self = alloca ptr, align 8 + store ptr %0, ptr %self, align 8 ret void } define void @__init___plc() { entry: - call void @__init_main(%main* @main_instance) - call void @__user_init_main(%main* @main_instance) + call void @__init_main(ptr @main_instance) + call void @__user_init_main(ptr @main_instance) ret void } -attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } - !llvm.module.flags = !{!7, !8} !llvm.dbg.cu = !{!9} diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__variable_source_to_variable_and_block_sink.snap b/tests/integration/snapshots/tests__integration__cfc__ir__variable_source_to_variable_and_block_sink.snap index ba1b24a31e2..de90fcff0e2 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__variable_source_to_variable_and_block_sink.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__variable_source_to_variable_and_block_sink.snap @@ -1,22 +1,21 @@ --- source: tests/integration/cfc.rs expression: output_file_content_without_headers -snapshot_kind: text --- target triple = "[filtered]" -@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___plc, i8* null }] +@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___plc, ptr null }] define i32 @main() { entry: %main = alloca i32, align 4 %value = alloca i32, align 4 - store i32 2, i32* %value, align 4 - store i32 0, i32* %main, align 4 - %load_value = load i32, i32* %value, align 4 + store i32 2, ptr %value, align 4 + store i32 0, ptr %main, align 4 + %load_value = load i32, ptr %value, align 4 %call = call i32 @myConnection(i32 %load_value) - store i32 %call, i32* %main, align 4 - %main_ret = load i32, i32* %main, align 4 + store i32 %call, ptr %main, align 4 + %main_ret = load i32, ptr %main, align 4 ret i32 %main_ret } @@ -24,15 +23,15 @@ define i32 @myAdd(i32 %0, i32 %1) { entry: %myAdd = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %0, i32* %a, align 4 + store i32 %0, ptr %a, align 4 %b = alloca i32, align 4 - store i32 %1, i32* %b, align 4 - store i32 0, i32* %myAdd, align 4 - %load_a = load i32, i32* %a, align 4 - %load_b = load i32, i32* %b, align 4 + store i32 %1, ptr %b, align 4 + store i32 0, ptr %myAdd, align 4 + %load_a = load i32, ptr %a, align 4 + %load_b = load i32, ptr %b, align 4 %tmpVar = add i32 %load_a, %load_b - store i32 %tmpVar, i32* %myAdd, align 4 - %myAdd_ret = load i32, i32* %myAdd, align 4 + store i32 %tmpVar, ptr %myAdd, align 4 + %myAdd_ret = load i32, ptr %myAdd, align 4 ret i32 %myAdd_ret } @@ -40,17 +39,17 @@ define i32 @myConnection(i32 %0) { entry: %myConnection = alloca i32, align 4 %x = alloca i32, align 4 - store i32 %0, i32* %x, align 4 + store i32 %0, ptr %x, align 4 %y = alloca i32, align 4 - store i32 0, i32* %y, align 4 - store i32 0, i32* %myConnection, align 4 - %load_x = load i32, i32* %x, align 4 - store i32 %load_x, i32* %y, align 4 - %load_y = load i32, i32* %y, align 4 - %load_x1 = load i32, i32* %x, align 4 + store i32 0, ptr %y, align 4 + store i32 0, ptr %myConnection, align 4 + %load_x = load i32, ptr %x, align 4 + store i32 %load_x, ptr %y, align 4 + %load_y = load i32, ptr %y, align 4 + %load_x1 = load i32, ptr %x, align 4 %call = call i32 @myAdd(i32 %load_y, i32 %load_x1) - store i32 %call, i32* %myConnection, align 4 - %myConnection_ret = load i32, i32* %myConnection, align 4 + store i32 %call, ptr %myConnection, align 4 + %myConnection_ret = load i32, ptr %myConnection, align 4 ret i32 %myConnection_ret } diff --git a/tests/integration/snapshots/tests__integration__command_line_compile__ir_generation_full_pass.snap b/tests/integration/snapshots/tests__integration__command_line_compile__ir_generation_full_pass.snap index f151ac3254d..3a02485678a 100644 --- a/tests/integration/snapshots/tests__integration__command_line_compile__ir_generation_full_pass.snap +++ b/tests/integration/snapshots/tests__integration__command_line_compile__ir_generation_full_pass.snap @@ -1,6 +1,5 @@ --- source: tests/integration/command_line_compile.rs expression: content -snapshot_kind: text --- -target datalayout = "[filtered]"@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__init___command_line_st, i8* null }]define void @__init___command_line_st() {entry: ret void}define i32 @myFunc(i32 %0, i32 %1, i32 %2) {entry: %myFunc = alloca i32, align 4 %a = alloca i32, align 4 store i32 %0, i32* %a, align 4 %b = alloca i32, align 4 store i32 %1, i32* %b, align 4 %c = alloca i32, align 4 store i32 %2, i32* %c, align 4 store i32 0, i32* %myFunc, align 4 %myFunc_ret = load i32, i32* %myFunc, align 4 ret i32 %myFunc_ret} +target datalayout = "[filtered]"@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__init___command_line_st, ptr null }]define void @__init___command_line_st() {entry: ret void}define i32 @myFunc(i32 %0, i32 %1, i32 %2) {entry: %myFunc = alloca i32, align 4 %a = alloca i32, align 4 store i32 %0, ptr %a, align 4 %b = alloca i32, align 4 store i32 %1, ptr %b, align 4 %c = alloca i32, align 4 store i32 %2, ptr %c, align 4 store i32 0, ptr %myFunc, align 4 %myFunc_ret = load i32, ptr %myFunc, align 4 ret i32 %myFunc_ret} diff --git a/tests/lit/lit.cfg b/tests/lit/lit.cfg index 6b07c4aa42a..79b8ff5f3ce 100644 --- a/tests/lit/lit.cfg +++ b/tests/lit/lit.cfg @@ -17,4 +17,4 @@ print(f'Compile command: {compile}') config.substitutions.append(('%COMPILE', f'{compile}')) config.substitutions.append(('%RUN', f'LD_LIBRARY_PATH="{stdlibLocation}/lib" /tmp/%basename_t.out')) -config.substitutions.append(('%CHECK', f'FileCheck-14 --check-prefixes CHECK --allow-unused-prefixes --match-full-lines')) \ No newline at end of file +config.substitutions.append(('%CHECK', f'FileCheck-21 --check-prefixes CHECK --allow-unused-prefixes --match-full-lines'))