Commit Graph

4348 Commits

Author SHA1 Message Date
bjorn3
c0477a1231 Sync from rust b5b13568fb 2024-06-11 11:54:36 +00:00
Ralf Jung
0eb782ba13 ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
Ralf Jung
6210c26a5a offset_of: allow (unstably) taking the offset of slice tail fields 2024-06-08 18:17:55 +02:00
bjorn3
c511676a62
Merge pull request #1495 from folkertdev/add-llvm-sse2-cvtps2dq
add `llvm.x86.sse2.cvtps2dq`
2024-06-06 23:25:16 +02:00
Folkert
63cb28ed48
add llvm.x86.sse2.cvtps2dq 2024-06-06 22:43:28 +02:00
Boxy
5d0ec8d162 Misc fixes to cranelift/clippy/miri 2024-06-05 22:25:42 +01:00
bjorn3
632e5df38a Remove unreachable fatal error 2024-06-04 16:42:15 +02:00
bjorn3
406770001e Don't require the bench job to pass for a new release
cc rust-lang/rust#125493
2024-06-04 16:26:51 +02:00
bjorn3
97d47f7077 Fix rustc tests 2024-06-04 16:21:13 +02:00
bjorn3
eb449c1339 Move error on -Cinstrument-coverage earlier and elaborate that it is LLVM specific
cc rust-lang/rustc_codegen_cranelift#1494
2024-06-04 16:02:36 +02:00
bors
be961b0101 Auto merge of #122597 - pacak:master, r=bjorn3
Show files produced by `--emit foo` in json artifact notifications

Right now it is possible to ask `rustc` to save some intermediate representation into one or more files with `--emit=foo`, but figuring out what exactly was produced is difficult. This pull request adds information about `llvm_ir` and `asm` intermediate files into notifications produced by `--json=artifacts`.

Related discussion: https://internals.rust-lang.org/t/easier-access-to-files-generated-by-emit-foo/20477

Motivation - `cargo-show-asm` parses those intermediate files and presents them in a user friendly way, but right now I have to apply some dirty hacks. Hacks make behavior confusing: https://github.com/hintron/computer-enhance/issues/35

This pull request introduces a new behavior: now `rustc` will emit a new artifact notification for every artifact type user asked to `--emit`, for example for `--emit asm` those will include all the `.s` files.

Most users won't notice this behavior, to be affected by it all of the following must hold:
- user must use `rustc` binary directly (when `cargo` invokes `rustc` - it consumes artifact notifications and doesn't emit anything)
- user must specify both `--emit xxx` and `--json artifacts`
- user must refuse to handle unknown artifact types
- user must disable incremental compilation (or deal with it better than cargo does, or use a workaround like `save-temps`) in order not to hit #88829 / #89149
2024-06-04 00:05:56 +00:00
bjorn3
8f1d41e2a0 Implement _rdtsc x86 vendor intrinsic
Fixes rust-lang/rustc_codegen_cranelift#1493
2024-06-02 11:19:47 +02:00
bjorn3
ab10da27a1 Fix rustc test suite 2024-05-30 16:42:52 +00:00
bjorn3
a255965849 Rustup to rustc 1.80.0-nightly (debd22da6 2024-05-29) 2024-05-30 16:34:21 +00:00
bjorn3
a0ea60b3b2 Sync from rust debd22da66 2024-05-30 16:26:07 +00:00
许杰友 Jieyou Xu (Joe)
db4dbc84a5 Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
Add an intrinsic for `ptr::metadata`

The follow-up to #123840, so we can remove `PtrComponents` and `PtrRepr` from libcore entirely (well, after a bootstrap update).

As discussed in <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/.60ptr_metadata.60.20in.20MIR/near/435637808>, this introduces `UnOp::PtrMetadata` taking a raw pointer and returning the associated metadata value.

By no longer going through a `union`, this should also help future PRs better optimize pointer operations.

r? ``@oli-obk``
2024-05-29 03:25:07 +01:00
Scott McMurray
676fec7c65 Add an intrinsic for ptr::metadata 2024-05-28 09:28:51 -07:00
Mark Rousskov
9ddcc59411 Omit non-needs_drop drop_in_place in vtables
This replaces the drop_in_place reference with null in vtables. On
librustc_driver.so, this drops about ~17k dynamic relocations from the
output, since many vtables can now be placed in read-only memory, rather
than having a relocated pointer included.

This makes a tradeoff by adding a null check at vtable call sites.
That's hard to avoid without changing the vtable format (e.g., to use a
pc-relative relocation instead of an absolute address, and avoid the
dynamic relocation that way). But it seems likely that the check is
cheap at runtime.
2024-05-27 16:26:56 -04:00
Guillaume Gomez
05b1415f18 Rollup merge of #125345 - durin42:thin-link-bitcode, r=bjorn3
rustc_codegen_llvm: add support for writing summary bitcode

Typical uses of ThinLTO don't have any use for this as a standalone file, but distributed ThinLTO uses this to make the linker phase more efficient. With clang you'd do something like `clang -flto=thin -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o (full of bitcode) and foo.indexing.o (just the summary or index part of the bitcode). That's then usable by a two-stage linking process that's more friendly to distributed build systems like bazel, which is why I'm working on this area.

I talked some to `@teresajohnson` about naming in this area, as things seem to be a little confused between various blog posts and build systems. "bitcode index" and "bitcode summary" tend to be a little too ambiguous, and she tends to use "thin link bitcode" and "minimized bitcode" (which matches the descriptions in LLVM). Since the clang option is thin-link-bitcode, I went with that to try and not add a new spelling in the world.

Per `@dtolnay,` you can work around the lack of this by using `lld --thinlto-index-only` to do the indexing on regular .o files of bitcode, but that is a bit wasteful on actions when we already have all the information in rustc and could just write out the matching minimized bitcode. I didn't test that at all in our infrastructure, because by the time I learned that I already had this patch largely written.
2024-05-23 23:39:26 +02:00
bjorn3
ba8c695326 Stop passing --check-cfg to rustc
The standard library now has the right configs in it's Cargo.toml
2024-05-23 12:40:09 +00:00
bjorn3
8bb463ae11 Rustup to rustc 1.80.0-nightly (9cdfe285c 2024-05-22) 2024-05-23 12:25:11 +00:00
bjorn3
cc6c5ecf58 Sync from rust 9cdfe285ca 2024-05-23 12:19:06 +00:00
Augie Fackler
715f2264a9 rustc_codegen_llvm: add support for writing summary bitcode
Typical uses of ThinLTO don't have any use for this as a standalone
file, but distributed ThinLTO uses this to make the linker phase more
efficient. With clang you'd do something like `clang -flto=thin
-fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o
(full of bitcode) and foo.indexing.o (just the summary or index part of
the bitcode). That's then usable by a two-stage linking process that's
more friendly to distributed build systems like bazel, which is why I'm
working on this area.

I talked some to @teresajohnson about naming in this area, as things
seem to be a little confused between various blog posts and build
systems. "bitcode index" and "bitcode summary" tend to be a little too
ambiguous, and she tends to use "thin link bitcode" and "minimized
bitcode" (which matches the descriptions in LLVM). Since the clang
option is thin-link-bitcode, I went with that to try and not add a new
spelling in the world.

Per @dtolnay, you can work around the lack of this by using `lld
--thinlto-index-only` to do the indexing on regular .o files of
bitcode, but that is a bit wasteful on actions when we already have all
the information in rustc and could just write out the matching minimized
bitcode. I didn't test that at all in our infrastructure, because by the
time I learned that I already had this patch largely written.
2024-05-22 14:04:22 -04:00
Matthias Krüger
2c219ceb6b Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJung,nikic
compiler: add simd_ctpop intrinsic

Fairly straightforward addition.

cc `@rust-lang/opsem` new (extremely boring) intrinsic
2024-05-21 12:47:06 +02:00
bjorn3
39daa5a182 Update to Cranelift 0.108 2024-05-20 20:29:45 +00:00
Matthias Krüger
14134c1482 Rollup merge of #125173 - scottmcm:never-checked, r=davidtwco
Remove `Rvalue::CheckedBinaryOp`

Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/intrinsics.20vs.20binop.2Funop/near/438729996>
cc `@RalfJung`

While it's a draft,
r? ghost
2024-05-20 18:13:48 +02:00
Jubilee Young
7a53ba2e76 cg_clif: support simd_ctpop 2024-05-19 18:50:42 -07:00
bjorn3
8cea8a7840 Fix rustc test suite 2024-05-19 13:37:01 +00:00
bjorn3
bff31bdcbc Rustup to rustc 1.80.0-nightly (b1ec1bd65 2024-05-18) 2024-05-19 13:22:06 +00:00
bjorn3
0c204c3a37 Sync from rust b1ec1bd65f 2024-05-19 13:16:07 +00:00
Scott McMurray
6965b4a8bd Remove Rvalue::CheckedBinaryOp 2024-05-17 20:33:02 -07:00
Santiago Pastorino
8aa7112c82 Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
bjorn3
f0dffd9fab Merge branch 'sync_from_rust' 2024-05-13 13:28:07 +00:00
bjorn3
ed7d97e4c8 Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
bjorn3
3270432f4b Rustup to rustc 1.80.0-nightly (ef0027897 2024-05-12) 2024-05-13 13:22:02 +00:00
bjorn3
df88c11867 Use the target cpu from the target spec on x86_64 when -Ctarget-cpu isn't used
Fixes rust-lang/rustc_codegen_cranelift#1148
2024-05-12 18:57:24 +02:00
bjorn3
cba05a7a14 Support naked functions
Fixes rust-lang/rustc_codegen_cranelift#1203
2024-05-12 18:20:14 +02:00
bjorn3
0627c63ad9 Remove polymorphize calls for statics in a couple more places 2024-05-12 18:20:14 +02:00
bjorn3
6db27529dd Significantly reduce check cfg warnings 2024-05-12 12:59:10 +00:00
bjorn3
cfc919f532 Use cargo in y.sh
This will allow adding dependencies to the build system in the future.
2024-05-12 12:59:10 +00:00
bjorn3
2df34f9091
Merge pull request #1490 from folkertdev/add-llvm-x86-crc32
add all `llvm.x86.sse42.crc32.*.*` intrinsics
2024-05-11 22:39:21 +02:00
Folkert
9059a74fd0
test x86 crc intrinsics 2024-05-11 22:23:55 +02:00
bjorn3
1a2c489a93
Merge pull request #1489 from rust-lang/parallel_rustc
Translate MIR to clif ir in parallel with parallel rustc
2024-05-11 22:13:39 +02:00
bjorn3
893ba536bc
Merge pull request #1491 from folkertdev/add-llvm-avx2-permd
add `llvm.x86.avx2.permd` intrinsic
2024-05-11 22:11:53 +02:00
Folkert
4a4535a57c
add llvm.x86.avx2.permd intrinsic 2024-05-11 21:58:25 +02:00
Folkert
e7b6662464
support crc32 with 8-bit and 16-bit inputs, and add crc64 support 2024-05-11 21:44:08 +02:00
Folkert de Vries
7b50189dce
add the llvm.x86.sse42.crc32.32.32 intrinsic (#1488)
* add the `llvm.x86.sse42.crc32.32.32` intrinsic
2024-05-11 21:38:25 +02:00
bjorn3
a167142946 Translate MIR to clif ir in parallel with parallel rustc
On dev-desktop the advantage of cg_clif over cg_llvm on simple-raytracer
is 15% when parallel rustc is disabled. With -Zthreads=16 the advantage
goes from 5% to 22% with this change.
2024-05-11 18:51:59 +00:00
bjorn3
50b34279c3 Split cgus into todo and done before the main module codegen loop 2024-05-11 17:39:51 +00:00
bjorn3
9ee010cc34 Try to workaround gha issue with the caching action 2024-05-11 17:19:46 +00:00