Commit Graph

4308 Commits

Author SHA1 Message Date
Scott McMurray
e654877b2f Also handle AggregateKind::RawPtr in cg_cranelift 2024-04-21 11:08:37 -07:00
bjorn3
72e6f0cc16 Remove a couple of items from the crate prelude 2024-04-21 17:35:09 +00:00
许杰友 Jieyou Xu (Joe)
be9d7ca977 Rollup merge of #123967 - RalfJung:static_mut_refs, r=Nilstrieb
static_mut_refs: use raw pointers to remove the remaining FIXME

Using `SyncUnsafeCell` would not make a lot of sense IMO.
2024-04-20 21:45:35 +01:00
bjorn3
9ad96205cb Don't create data object for zero sized allocations 2024-04-20 18:49:00 +00:00
bjorn3
82dd93fb57 Rustup to rustc 1.79.0-nightly (f9b161492 2024-04-19) 2024-04-20 17:25:06 +00:00
bjorn3
4027a520d2 Sync from rust f9b1614920 2024-04-20 17:19:28 +00:00
Maybe Waffle
d5273fff48 Do intrinsic changes in rustc_codegen_cranelift 2024-04-19 18:45:25 +00:00
bors
a2a949b031 Auto merge of #124113 - RalfJung:interpret-scalar-ops, r=oli-obk
interpret: use ScalarInt for bin-ops; avoid PartialOrd for ScalarInt

Best reviewed commit-by-commit

r? `@oli-obk`
2024-04-19 17:00:28 +00:00
Michael Baikov
0a298ed00b Show files produced by --emit foo in json artifact notifications 2024-04-19 08:31:41 -04:00
Ralf Jung
f532309674 ScalarInt: add methods to assert being a (u)int of given size 2024-04-19 13:51:52 +02:00
Chris Denton
fbac8ef01c Cranelift: Revert raw-dylib for Windows futex APIs 2024-04-16 15:53:35 +00:00
Ralf Jung
9e4e444a47 static_mut_refs: use raw pointers to remove the remaining FIXME 2024-04-15 18:45:56 +02:00
bjorn3
5075386e82 Rustup to rustc 1.79.0-nightly (0d8b3346a 2024-04-14) 2024-04-15 14:25:25 +00:00
bjorn3
49ad3ae2f8
Merge pull request #1481 from taiki-e/asm-maybe-uninit
Allow MaybeUninit in input and output of inline assembly
2024-04-14 11:50:53 +02:00
Taiki Endo
71e7414924 Allow MaybeUninit in input and output of inline assembly 2024-04-14 18:16:00 +09:00
bjorn3
bf02a87b24 Merge branch 'sync_from_rust' 2024-04-11 10:45:14 +00:00
bjorn3
e243f8d0e3 Merge commit '89f54caacf90e99fc8ba0d60a28bdadea3cfdf1e' into sync_cg_clif-2024-04-11 2024-04-11 10:42:48 +00:00
bjorn3
89f54caacf Reenable fixed rustc tests 2024-04-11 10:16:50 +00:00
bjorn3
d37f6d821d Fix rustc tests 2024-04-11 10:13:17 +00:00
bjorn3
8a5eecc897 Rustup to rustc 1.79.0-nightly (aa067fb98 2024-04-10) 2024-04-11 09:59:43 +00:00
bjorn3
c183c6194e Sync from rust aa067fb984 2024-04-11 09:45:27 +00:00
Ben Kimock
da09eadbab Only traverse mono-reachable blocks in cg_clif 2024-04-07 16:46:21 -04:00
bjorn3
f7cc528deb Restore required permission for the release job 2024-04-07 17:31:44 +00:00
bjorn3
6bab2e750b Fix showing error details in the dev release action 2024-04-07 17:31:26 +00:00
bjorn3
0328ee571b Fix caching on Cirrus CI 2024-04-07 16:36:41 +00:00
bjorn3
39b25b3d71 Don't emit unwind tables on macOS
They don't work anyway as object misses support for emitting the
particular format macOS expects. And on arm64 macOS it causes
compilation to abort due to an unsupported relocation type.

Fixes rust-lang/rustc_codegen_cranelift#1371
2024-04-07 16:29:04 +00:00
bors
5d765b8cc1 Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu
Save/restore more items in cache with incremental compilation

Right now they don't play very well together, consider a simple example:

```
$ export RUSTFLAGS="--emit asm"
$ cargo new --lib foo
     Created library `foo` package
$ cargo build -q
$ touch src/lib.rs
$ cargo build
error: could not copy
  "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.4qbzn9k8mosu50a5.rcgu.s"
  to "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.s":
  No such file or directory (os error 2)
```

Touch triggers the rebuild, incremental compilation detects no changes (yay) and everything explodes while trying to copy files were they should go.

This pull request fixes it by copying and restoring more files in the incremental compilation cache

Fixes https://github.com/rust-lang/rust/issues/89149
Fixes https://github.com/rust-lang/rust/issues/88829

Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
2024-04-07 10:46:50 +00:00
Ben Kimock
3549d9806d Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
Michael Baikov
6669758fb3 Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
bjorn3
0f1ee59ea5 Disable failing rand tests on FreeBSD 2024-04-06 14:05:30 +00:00
bjorn3
242b261585 Don't run should-fail rustc tests
These are expected to panic inside compiletest which fails when
compiletest is compiled with panic=abort.
2024-04-06 13:42:53 +00:00
bjorn3
c682535216 Merge branch 'sync_from_rust' 2024-04-05 16:27:07 +00:00
bjorn3
f91bd7882f Merge commit 'fbda869b4e230c788b6bce426038ba8419956f2d' into sync_cg_clif-2024-04-05 2024-04-05 16:20:23 +00:00
bjorn3
fbda869b4e Add a couple more sync impls to mini_core 2024-04-05 15:05:53 +00:00
bjorn3
454c87bdd4 Merge branch 'build_system_changes' 2024-04-05 15:01:30 +00:00
bjorn3
1bab6df32b Remove all checks for CI in the build system
And introduce the CG_CLIF_EXPENSIVE_CHECKS env var in the place.
2024-04-05 14:31:12 +00:00
bjorn3
f269cdd805 Move disabling incr comp and denying warnings to the CI config 2024-04-05 13:59:28 +00:00
bjorn3
603b2800f7 Revoke all permissions from GHA workflows where possible 2024-04-05 13:50:21 +00:00
bjorn3
65342df8cd Dedup default shell specification for GHA 2024-04-05 13:49:29 +00:00
bjorn3
91ffd74de4 Simplify GHA CI workflow 2024-04-05 13:49:29 +00:00
bjorn3
40d40fb229 Fix warning in mini_core 2024-04-05 12:25:08 +00:00
bjorn3
737421a25b Rustup to rustc 1.79.0-nightly (385fa9d84 2024-04-04) 2024-04-05 12:15:41 +00:00
bjorn3
5a9940fe3d Sync from rust 385fa9d845 2024-04-05 11:39:51 +00:00
Matthias Krüger
6728f2fef4 Rollup merge of #123419 - petrochenkov:zeroindex, r=compiler-errors
rustc_index: Add a `ZERO` constant to index types

It is commonly used.
2024-04-03 22:11:02 +02:00
bjorn3
64d6da5cda
Merge pull request #1476 from taiki-e/unchecked-shift
Fix ICE on unchecked shift
2024-04-03 19:54:56 +02:00
Vadim Petrochenkov
46fc398706 rustc_index: Add a ZERO constant to index types
It is commonly used.
2024-04-03 19:06:22 +03:00
joboet
b0710dc5f5 rename expose_addr to expose_provenance 2024-04-03 16:00:38 +02:00
Taiki Endo
4e4de3f5b7 Fix ICE on unchecked shift 2024-04-03 21:30:19 +09:00
Jacob Pratt
7a1a4565f2 Rollup merge of #122935 - RalfJung:with-exposed-provenance, r=Amanieu
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance

As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/To.20expose.20or.20not.20to.20expose/near/427757066).

The old name, `from_exposed_addr`, makes little sense as it's not the address that is exposed, it's the provenance. (`ptr.expose_addr()` stays unchanged as we haven't found a better option yet. The intended interpretation is "expose the provenance and return the address".)

The new name nicely matches `ptr::without_provenance`.
2024-04-02 20:37:39 -04:00
bors
79a1bddaf3 Auto merge of #118310 - scottmcm:three-way-compare, r=davidtwco
Add `Ord::cmp` for primitives as a `BinOp` in MIR

Update: most of this OP was written months ago.  See https://github.com/rust-lang/rust/pull/118310#issuecomment-2016940014 below for where we got to recently that made it ready for review.

---

There are dozens of reasonable ways to implement `Ord::cmp` for integers using comparison, bit-ops, and branches.  Those differences are irrelevant at the rust level, however, so we can make things better by adding `BinOp::Cmp` at the MIR level:

1. Exactly how to implement it is left up to the backends, so LLVM can use whatever pattern its optimizer best recognizes and cranelift can use whichever pattern codegens the fastest.
2. By not inlining those details for every use of `cmp`, we drastically reduce the amount of MIR generated for `derive`d `PartialOrd`, while also making it more amenable to MIR-level optimizations.

Having extremely careful `if` ordering to μoptimize resource usage on broadwell (#63767) is great, but it really feels to me like libcore is the wrong place to put that logic.  Similarly, using subtraction [tricks](https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign) (#105840) is arguably even nicer, but depends on the optimizer understanding it (https://github.com/llvm/llvm-project/issues/73417) to be practical.  Or maybe [bitor is better than add](https://discourse.llvm.org/t/representing-in-ir/67369/2?u=scottmcm)?  But maybe only on a future version that [has `or disjoint` support](https://discourse.llvm.org/t/rfc-add-or-disjoint-flag/75036?u=scottmcm)?  And just because one of those forms happens to be good for LLVM, there's no guarantee that it'd be the same form that GCC or Cranelift would rather see -- especially given their very different optimizers.  Not to mention that if LLVM gets a spaceship intrinsic -- [which it should](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Suboptimal.20inlining.20in.20std.20function.20.60binary_search.60/near/404250586) -- we'll need at least a rustc intrinsic to be able to call it.

As for simplifying it in Rust, we now regularly inline `{integer}::partial_cmp`, but it's quite a large amount of IR.  The best way to see that is with 8811efa88b (diff-d134c32d028fbe2bf835fef2df9aca9d13332dd82284ff21ee7ebf717bfa4765R113) -- I added a new pre-codegen MIR test for a simple 3-tuple struct, and this PR change it from 36 locals and 26 basic blocks down to 24 locals and 8 basic blocks.  Even better, as soon as the construct-`Some`-then-match-it-in-same-BB noise is cleaned up, this'll expose the `Cmp == 0` branches clearly in MIR, so that an InstCombine (#105808) can simplify that to just a `BinOp::Eq` and thus fix some of our generated code perf issues.  (Tracking that through today's `if a < b { Less } else if a == b { Equal } else { Greater }` would be *much* harder.)

---

r? `@ghost`
But first I should check that perf is ok with this
~~...and my true nemesis, tidy.~~
2024-04-02 19:21:44 +00:00