Commit Graph

1444 Commits

Author SHA1 Message Date
Antoni Boucher
f9a0c3fb0f Fix PassMode::Indirect with params 2024-04-22 09:14:28 -04:00
许杰友 Jieyou Xu (Joe)
224285d9fc 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
Maybe Waffle
dd50f454c8 Fixup rustc_codegen_gcc test signature 2024-04-20 12:18:21 +00:00
antoyo
4a52f9579a
Merge pull request #500 from rust-lang/fix/type-kind
Implement more type kinds
2024-04-19 21:53:40 -04:00
antoyo
9941c3590d
Merge pull request #499 from rust-lang/fix/unreachable-in-get_fn
Fix panic when calling get_fn for a variable
2024-04-19 21:26:48 -04:00
Antoni Boucher
89ee0f997c Implement more type kinds 2024-04-19 21:23:56 -04:00
antoyo
e26e7aeb9a
Merge pull request #497 from rust-lang/fix/add-block-to-imported-main-function
Fix check for main function already declared
2024-04-19 21:20:16 -04:00
Antoni Boucher
9b628f8e82 Fix panic when calling get_fn for a variable 2024-04-19 20:57:40 -04:00
Antoni Boucher
7cd561efd6 Fix check for main function already declared 2024-04-19 20:55:59 -04:00
bors
0f17e5ae23 Auto merge of #117919 - daxpedda:wasm-c-abi, r=wesleywiser
Introduce perma-unstable `wasm-c-abi` flag

Now that `wasm-bindgen` v0.2.88 supports the spec-compliant C ABI, the idea is to switch to that in a future version of Rust. In the meantime it would be good to let people test and play around with it.

This PR introduces a new perma-unstable `-Zwasm-c-abi` compiler flag, which switches to the new spec-compliant C ABI when targeting `wasm32-unknown-unknown`.

Alternatively, we could also stabilize this and then deprecate it when we switch. I will leave this to the Rust maintainers to decide.

This is a companion PR to #117918, but they could be merged independently.
MCP: https://github.com/rust-lang/compiler-team/issues/703
Tracking issue: https://github.com/rust-lang/rust/issues/122532
2024-04-19 03:35:10 +00:00
antoyo
ab7d138d16
Merge pull request #493 from darcagn/master
Fix passing custom CG_RUSTFLAGS when building sysroot
2024-04-17 18:11:52 -04:00
Gerson
6e5395a414
Updating readme instructions (#489) 2024-04-17 11:31:18 -04:00
darc
50a0d5b816 Fix passing custom CG_RUSTFLAGS when building sysroot 2024-04-17 10:02:10 -05:00
antoyo
56a022f5e5
Merge pull request #492 from antoyo/master
Sync fork
2024-04-17 08:26:57 -04:00
antoyo
f3ff769dd5
Merge pull request #18 from GuillaumeGomez/default-download
Default to `download-gccjit` instead of `gcc-path`
2024-04-17 07:40:57 -04:00
アレーク
5584f5f1a2
updated build system script commands (#490)
updated build system script commands
2024-04-16 23:59:47 +02:00
Ralf Jung
6f36e82594 static_mut_refs: use raw pointers to remove the remaining FIXME 2024-04-15 18:45:56 +02:00
Guillaume Gomez
a3cd6e7a31 Default to download-gccjit instead of gcc-path 2024-04-13 21:31:57 +02:00
Erik Desjardins
50a147152d restore location in gcc alloca codegen 2024-04-12 08:36:22 -04:00
Erik Desjardins
4ea338942b use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
Scott McMurray
cccf379a5b Put PlaceValue into OperandValue::Ref, rather than 3 tuple fields 2024-04-11 00:10:10 -07:00
Scott McMurray
b9b05d5a23 Make PlaceRef hold a PlaceValue for the non-layout fields (like OperandRef does) 2024-04-11 00:10:10 -07:00
Shashank Trivedi
8692192582
build sysroot flag (#16) 2024-04-10 08:23:51 -04:00
antoyo
7531a22bbe
Merge pull request #486 from antoyo/master
Merge fork
2024-04-07 08:56:18 -04:00
antoyo
c7f1d5d409
Merge pull request #15 from GuillaumeGomez/add-rustc-command
Add rustc command to build system
2024-04-06 23:05:10 -04:00
Guillaume Gomez
2a99110297 Update documentation to recommend using y.sh rustc instead of rustc and all its flags 2024-04-06 20:00:21 +02:00
Guillaume Gomez
00ad2634d5 Add rustc command to build system 2024-04-06 20:00:21 +02:00
Michael Baikov
040afd36f3 Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
Guillaume Gomez
5eb8d854d1 Rename cargo.rs into rust_tools.rs to prepare the addition of the rustc command 2024-04-05 17:18:55 +02:00
Guillaume Gomez
f7a6ac1c9a Rollup merge of #122334 - GuillaumeGomez:vendor-cg_gcc, r=Mark-Simulacrum
Vendor rustc_codegen_gcc

I used https://github.com/rust-lang/rust/pull/115274 as base for this update.

r? `@bjorn3`
2024-04-05 16:38:49 +02:00
bors
27ba1bad27 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
antoyo
75f0ab5c55
Merge pull request #482 from antoyo/master
Sync from fork
2024-03-30 09:51:27 -04:00
antoyo
287894f374
Merge pull request #14 from antoyo/fix/vm-link-and-stdarch-tests
Fix vm link and stdarch tests
2024-03-30 09:05:45 -04:00
Antoni Boucher
c7ac792687 Add newlines 2024-03-30 08:18:56 -04:00
Antoni Boucher
92be47bef5 Add back y.sh to run stdarch tests 2024-03-30 08:16:03 -04:00
Antoni Boucher
03f299bce0 Fix VM artifact link 2024-03-30 08:14:53 -04:00
Aria Beingessner
cc98f86d4d stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate
This is an alternative to #121920
2024-03-29 19:59:46 -04:00
bors
211b585c60 Auto merge of #122671 - Mark-Simulacrum:const-panic-msg, r=Nilstrieb
Codegen const panic messages as function calls

This skips emitting extra arguments at every callsite (of which there
can be many). For a librustc_driver build with overflow checks enabled,
this cuts 0.7MB from the resulting shared library (see [perf]).

A sample improvement from nightly:

```
        leaq    str.0(%rip), %rdi
        leaq    .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdx
        movl    $25, %esi
        callq   *_ZN4core9panicking5panic17h17cabb89c5bcc999E@GOTPCREL(%rip)
```

to this PR:

```
        leaq    .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdi
        callq   *_RNvNtNtCsduqIKoij8JB_4core9panicking11panic_const23panic_const_div_by_zero@GOTPCREL(%rip)
```

[perf]: https://perf.rust-lang.org/compare.html?start=a7e4de13c1785819f4d61da41f6704ed69d5f203&end=64fbb4f0b2d621ff46d559d1e9f5ad89a8d7789b&stat=instructions:u
2024-03-29 00:24:01 +00:00
Robert Zakrzewski
111b3395a8
Execute tests using a target defined as a JSON spec (#12) 2024-03-27 17:37:19 -04:00
Shashank Trivedi
2a88451d6b
run-make tests initialized (#7) 2024-03-25 11:39:26 -04:00
antoyo
fda1ffd38f
Merge pull request #8 from zedar/I60_asm_conversion_from_register_to_gcc
Add missing mappings from register classes to dummy output types
2024-03-24 14:39:10 -04:00
Robert Zakrzewski
94ca8283af add missing mappings from register classes to dummy output types
fix formatting

Replace LLVM with GCC
2024-03-24 17:22:40 +01:00
Matthias Krüger
1ee4ae9eb2 Rollup merge of #122937 - Zalathar:unbox, r=oli-obk
Unbox and unwrap the contents of `StatementKind::Coverage`

The payload of coverage statements was historically a structure with several fields, so it was boxed to avoid bloating `StatementKind`.

Now that the payload is a single relatively-small enum, we can replace `Box<Coverage>` with just `CoverageKind`.

This patch also adds a size assertion for `StatementKind`, to avoid accidentally bloating it in the future.

``@rustbot`` label +A-code-coverage
2024-03-24 17:08:16 +01:00
Scott McMurray
1a05106f94 Add+Use mir::BinOp::Cmp 2024-03-23 23:23:41 -07:00
antoyo
51eae7e6e8
Merge pull request #5 from mubarak23/remove-pass-test
Remove pass test
2024-03-23 17:45:16 -04:00
mubarak23
a67cd0c4fd add fn-arg-incomplete-pattern-drop-order.rs to the list 2024-03-23 22:18:22 +01:00
Matthew Maurer
abbe1ba6f2 CFI: Use Instance at callsites
We already use `Instance` at declaration sites when available to glean
additional information about possible abstractions of the type in use.
This does the same when possible at callsites as well.

The primary purpose of this change is to allow CFI to alter how it
generates type information for indirect calls through `Virtual`
instances.
2024-03-23 18:30:39 +00:00
mubarak23
0319a80c5b remove more test that have passed 2024-03-23 19:21:45 +01:00
mubarak23
56eab3c484 remove trailing space 2024-03-23 18:09:18 +01:00
mubarak23
9c81910732 fix rebase 2024-03-23 13:27:33 +01:00