Commit graph

4806 commits

Author SHA1 Message Date
bjorn3
086dba2a15 Sync from rust b48576b4db 2025-03-23 16:19:48 +00:00
bors
1986ad7527 Auto merge of #128320 - saethlin:link-me-maybe, r=compiler-errors
Avoid no-op unlink+link dances in incr comp

Incremental compilation scales quite poorly with the number of CGUs. This PR improves one reason for that.

The incr comp process hard-links all the files from an old session into a new one, then it runs the backend, which may just hard-link the new session files into the output directory. Then codegen hard-links all the output files back to the new session directory.

This PR (perhaps unimaginatively) fixes the silliness that ensues in the last step. The old `link_or_copy` implementation would be passed pairs of paths which are already the same inode, then it would blindly delete the destination and re-create the hard-link that it just deleted. This PR lets us skip both those operations. We don't skip the other two hard-links.

`cargo +stage1 b && touch crates/core/main.rs && strace -cfw -elink,linkat,unlink,unlinkat cargo +stage1 b` before and then after on `ripgrep-13.0.0`:
```
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 52.56    0.024950          25       978       485 unlink
 34.38    0.016318          22       727           linkat
 13.06    0.006200          24       249           unlinkat
------ ----------- ----------- --------- --------- ----------------
100.00    0.047467          24      1954       485 total
```
```
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 42.83    0.014521          57       252           unlink
 38.41    0.013021          26       486           linkat
 18.77    0.006362          25       249           unlinkat
------ ----------- ----------- --------- --------- ----------------
100.00    0.033904          34       987           total
```

This reduces the number of hard-links that are causing perf troubles, noted in https://github.com/rust-lang/rust/issues/64291 and https://github.com/rust-lang/rust/issues/137560
2025-03-21 21:03:49 +00:00
bjorn3
91ae8651ae Rustup to rustc 1.87.0-nightly (78948ac25 2025-03-20) 2025-03-21 09:52:08 +00:00
bjorn3
4811369acc Sync from rust 78948ac259 2025-03-21 09:46:53 +00:00
bjorn3
2133fb94b7 Disable PIC when jitting
This fixes jitting on non-x86_64 targets.
2025-03-20 15:37:38 +00:00
bjorn3
15fff5d2d2 Update to Cranelift 0.118 2025-03-20 15:37:34 +00:00
bjorn3
a8311b4a46 Temporarily disable FreeBSD testing 2025-03-20 14:08:02 +00:00
bjorn3
cb4a25ca81 Remove liballoc compiler-builtins f16/f128 disable patch
We already build with the compiler-builtins-no-f16-f128 feature enabled.
2025-03-18 14:49:15 +00:00
bjorn3
1adce908c6 Run alloctests tests too 2025-03-18 09:52:12 +00:00
bjorn3
ebef14a7b6 Reuse the Cargo.lock of the library workspace for coretests 2025-03-18 09:46:49 +00:00
bjorn3
93a9102a06 Rustup to rustc 1.87.0-nightly (43a2e9d2c 2025-03-17) 2025-03-18 09:01:19 +00:00
bjorn3
e69d216ab9 Sync from rust 43a2e9d2c7 2025-03-18 08:53:49 +00:00
bjorn3
3270d71cec Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
bjorn3
92e5c1a44d
Merge pull request #1564 from rust-lang/fix_arm64_asm_vector_regs
Fix usage of vector registers in inline asm on arm64
2025-03-16 18:01:11 +01:00
bjorn3
5bb37b7580 Fix usage of vector registers in inline asm on arm64 2025-03-16 14:55:32 +00:00
许杰友 Jieyou Xu (Joe)
a2797e514b Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc
Remove `#[cfg(not(test))]` gates in `core`

These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-16 09:40:05 +08:00
Ralf Jung
025eecc3e7 atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance 2025-03-13 08:14:34 +01:00
bjorn3
eea0db2590 Fix rustc test suite 2025-03-12 13:18:52 +00:00
bjorn3
d2b328e6b3 Reduce verbosity of ./scripts/rustup.sh pull 2025-03-12 13:08:50 +00:00
bjorn3
4ca551cf41 Rustup to rustc 1.87.0-nightly (665025243 2025-03-11) 2025-03-12 13:08:42 +00:00
bjorn3
11565c3471 Sync from rust 6650252439 2025-03-12 13:02:12 +00:00
Ralf Jung
56715d9864 intrinsics: remove unnecessary leading underscore from argument names 2025-03-12 08:04:09 +01:00
bors
43a25a5ec6 Auto merge of #128440 - oli-obk:defines, r=lcnr
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type

Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed.

A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table.

Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable.

Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature.

One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now.

fixes #131298
2025-03-11 18:13:31 +00:00
bors
5a44fffc33 Auto merge of #137586 - nnethercote:SetImpliedBits, r=bjorn3
Speed up target feature computation

The LLVM backend calls `LLVMRustHasFeature` twice for every feature. In short-running rustc invocations, this accounts for a surprising amount of work.

r? `@bjorn3`
2025-03-11 12:05:16 +00:00
Oli Scherer
d9de94001a Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
bjorn3
540565e5b9 Fully test the alloc crate through alloctests
For the tests that make use of internal implementation details, we
include the module to test using #[path] in alloctests now.
2025-03-07 19:11:13 +00:00
Thalia Archibald
fd3fb2cf46 Remove #[cfg(not(test))] gates in core
These gates are unnecessary now that unit tests for `core` are in a
separate package, `coretests`, instead of in the same files as the
source code. They previously prevented the two `core` versions from
conflicting with each other.
2025-03-06 13:21:59 -08:00
bjorn3
4b7bcdbf9f Use the github cli to publish dev releases
This removes a whole bunch of complicated javascript with two lines of
bash.

Fixes rust-lang/rustc_codegen_cranelift#1562
2025-03-06 14:43:29 +00:00
bjorn3
aa31d42b39 Remove no longer necessary disabling of dylib usage for run-make tests
Run-make tests are now fully compiled using the bootstrap compiler.
2025-03-06 12:51:22 +00:00
bjorn3
75109ec1ba FIx rustc test suite 2025-03-06 12:46:54 +00:00
bjorn3
f048c45018 Rustup to rustc 1.87.0-nightly (30f168ef8 2025-03-05) 2025-03-06 12:40:11 +00:00
bjorn3
41b355ac4b Sync from rust 30f168ef81 2025-03-06 12:16:04 +00:00
bjorn3
7eb0a99fc9 Fix jit mode testing 2025-03-05 15:55:41 +00:00
bjorn3
5cdb866356 Update rust-analyzer config
mod_bench no longer exists and there is no benefit to not having a
sysroot available for mini_core and mini_core_hello_world.
2025-03-05 15:51:35 +00:00
bjorn3
5d03df9431 Remove support for the lazy jit mode
I might re-implement it in the future, but would probably do so by
replacing cranelift-jit. cranelift-jit's api doesn't quite work well for
lazy jitting. And even so it adds complexity to cranelift-jit and breaks
cranelift-jit outside of x86_64.
2025-03-05 15:37:10 +00:00
bjorn3
0fcd068bec Refactor the cli of cg_clif 2025-03-05 15:12:57 +00:00
Trevor Gross
75485a2c09 Update compiler-builtins to 0.1.151
This enables `f16` builtins for loongarch [1] and adds support for
Cygwin [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/770
[2]: https://github.com/rust-lang/compiler-builtins/pull/774
2025-03-05 01:35:02 -05:00
Jubilee
ca89d80764 Rollup merge of #137634 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.149

Includes a change to make a subset of math symbols available on all platforms [1], and disables `f16` on aarch64 without neon [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/763
[2]: https://github.com/rust-lang/compiler-builtins/pull/775

try-job: aarch64-gnu
try-job: aarch64-gnu-debug
try-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: dist-aarch64-linux
try-job: dist-arm-linux
try-job: dist-armv7-linux
try-job: dist-x86_64-linux
try-job: test-various
2025-03-04 14:50:40 -08:00
Nicholas Nethercote
157137a64a Change signature of target_features_cfg.
Currently it is called twice, once with `allow_unstable` set to true and
once with it set to false. This results in some duplicated work. Most
notably, for the LLVM backend, `LLVMRustHasFeature` is called twice for
every feature, and it's moderately slow. For very short running
compilations on platforms with many features (e.g. a `check` build of
hello-world on x86) this is a significant fraction of runtime.

This commit changes `target_features_cfg` so it is only called once, and
it now returns a pair of feature sets. This halves the number of
`LLVMRustHasFeature` calls.
2025-03-05 09:49:17 +11:00
bjorn3
0f9c09fb3a Remoe has_ptr_meta in favor of tcx.type_has_metadata() 2025-03-03 12:43:05 +00:00
bjorn3
57767d6d99 Rustup to rustc 1.87.0-nightly (f4a216d28 2025-03-02) 2025-03-03 12:35:10 +00:00
bjorn3
a797db4883 Sync from rust f4a216d28e 2025-03-03 12:30:27 +00:00
Trevor Gross
5328983b07 Update compiler-builtins to 0.1.150
Includes a change to make a subset of math symbols available on all
platforms [1], and disables `f16` on aarch64 without neon [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/763
[2]: https://github.com/rust-lang/compiler-builtins/pull/775
2025-03-01 20:02:51 +00:00
Matthias Krüger
ee5bae8a12 Rollup merge of #137804 - RalfJung:backend-repr-simd-vector, r=workingjubilee
rename BackendRepr::Vector → SimdVector

For many Rustaceans, "vector" does not imply "SIMD", so let's be more clear in this type that is used pervasively in the compiler.

r? `@workingjubilee`
2025-03-01 16:03:10 +01:00
bors
f56e516575 Auto merge of #133250 - DianQK:embed-bitcode-pgo, r=nikic
The embedded bitcode should always be prepared for LTO/ThinLTO

Fixes #115344. Fixes #117220.

There are currently two methods for generating bitcode that used for LTO. One method involves using `-C linker-plugin-lto` to emit object files as bitcode, which is the typical setting used by cargo. The other method is through `-C embed-bitcode=yes`.

When using with `-C embed-bitcode=yes -C lto=no`, we run a complete non-LTO LLVM pipeline to obtain bitcode, then the bitcode is used for LTO. We run the Call Graph Profile Pass twice on the same module.

This PR is doing something similar to LLVM's `buildFatLTODefaultPipeline`, obtaining the bitcode for embedding after running `buildThinLTOPreLinkDefaultPipeline`.

r? nikic
2025-03-01 08:22:18 +00:00
Ralf Jung
b9ca52582b rename BackendRepr::Vector → SimdVector 2025-02-28 17:17:45 +01:00
Ben Kimock
af9f91696b Fill out links_from_incr_cache in cg_clif 2025-02-26 20:02:03 -05:00
bjorn3
30ece8da06 Make tiny-skia work on arm64 2025-02-26 13:06:01 +00:00
bjorn3
d27c67c941 Fix FIXME about unversioned macOS target names 2025-02-26 11:24:41 +00:00
bjorn3
994c8cfaf6 Skip downloading test crates in CI jobs that don't need them 2025-02-26 11:11:44 +00:00