Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#108240 Rename 'src/bootstrap/native.rs' to llvm.rs #109138

Closed

Conversation

rohaquinlop
Copy link
Contributor

Fixed #108240

Renamed 'native.rs' to 'llvm.rs', also moved TestHelpers to test.rs. Replaced all the native.rs occurrences at src/bootstrap files to llvm.rs

Jules-Bertholet and others added 30 commits December 11, 2022 01:20
Use rint intrinsic instead of roundeven to impement `round_ties_even`. They do the same thing when rounding mode is default, which Rust assumes.
And `rint` has better platform support.

Keeps `roundeven` around in `core::intrinsics`, it's doing no harm there.
This slightly improves performance on systems with many cores and
barely affects systems with few cores.

My laptop (2 core + HT):
Before:
Benchmark 2: RUSTC=rustc /home/bjorn/Projects/cg_clif2/./dist/cargo-clif build --manifest-path /home/bjorn/Projects/cg_clif2/./download/simple-raytracer/Cargo.toml --target-dir /home/bjorn/Projects/cg_clif2/./build/simple_raytracer
  Time (mean ± σ):     12.042 s ±  0.313 s    [User: 29.434 s, System: 4.720 s]
  Range (min … max):   11.670 s … 12.795 s    10 runs

After:
Benchmark 2: RUSTC=rustc /home/bjorn/Projects/cg_clif2/./dist/cargo-clif build --manifest-path /home/bjorn/Projects/cg_clif2/./download/simple-raytracer/Cargo.toml --target-dir /home/bjorn/Projects/cg_clif2/./build/simple_raytracer
  Time (mean ± σ):     12.037 s ±  0.384 s    [User: 29.960 s, System: 4.722 s]
  Range (min … max):   11.673 s … 12.769 s    10 runs

Dev desktop (32 cores)
Before:
Benchmark 2: RUSTC=rustc /home/gh-bjorn3/cg_clif/./dist/cargo-clif build --manifest-path /home/gh-bjorn3/cg_clif/./download/simple-raytracer/Cargo.toml --target-dir /home/gh-bjorn3/cg_clif/./build/simple_raytracer
  Time (mean ± σ):     10.425 s ±  0.104 s    [User: 25.877 s, System: 5.513 s]
  Range (min … max):   10.267 s … 10.640 s    10 runs

After:
Benchmark 2: RUSTC=rustc /home/gh-bjorn3/cg_clif/./dist/cargo-clif build --manifest-path /home/gh-bjorn3/cg_clif/./download/simple-raytracer/Cargo.toml --target-dir /home/gh-bjorn3/cg_clif/./build/simple_raytracer
  Time (mean ± σ):     10.212 s ±  0.100 s    [User: 25.918 s, System: 5.555 s]
  Range (min … max):   10.079 s … 10.362 s    10 runs
Don't ICE in `might_permit_raw_init` if reference is polymorphic

Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition.

cc `@saethlin`
fixes rust-lang#107999
There are several `mk_foo`/`intern_foo` pairs, where the former takes an
iterator and the latter takes a slice. (This naming convention is bad,
but that's a fix for another PR.)

This commit changes several `mk_foo` occurrences into `intern_foo`,
avoiding the need for some `.iter()`/`.into_iter()` calls. Affected
cases:
- mk_type_list
- mk_tup
- mk_substs
- mk_const_list
bors and others added 16 commits March 15, 2023 11:44
… r=WaffleLapkin,JakobDegen

Ensure `ptr::read` gets all the same LLVM `load` metadata that dereferencing does

I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`.  Trying to narrow it down, it seems that was because `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist.

The root cause is that `ptr::read` is currently implemented via the *untyped* `copy_nonoverlapping`, and thus the `load` doesn't get any type-aware metadata: no `noundef`, no `!range`.  This PR solves that by lowering `ptr::read(p)` to `copy *p` in MIR, for which the backends already do the right thing.

Fortuitiously, this also improves the IR we give to LLVM for things like `mem::replace`, and fixes a couple of long-standing bugs where `ptr::read` on `Copy` types was worse than `*`ing them.

Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Move.20array.3A.3AIntoIter.20to.20ManuallyDrop/near/341189936>

cc `@erikdesjardins` `@JakobDegen` `@workingjubilee` `@the8472`

Fixes rust-lang#106369
Fixes rust-lang#73258
…arsan68

add `enable-warnings` flag for llvm, and disable it by default.

This flag allows to turn off warnings of llvm compilation for people who are not interested on those warnings.
…gn, r=Nilstrieb

Use `unused_generic_params` from crate metadata

Due to the way that `separate_provide_extern` interacted with the implementation of `<ty::InstanceDef<'tcx> as Key>::query_crate_is_local`, we actually never hit the foreign provider for `unused_generic_params`.

Additionally, since the *local* provider of `unused_generic_params` calls `should_polymorphize`, which always returns false if the def-id is foreign, this means that we never actually polymorphize monomorphic instances originating from foreign crates.

We don't actually encode `unused_generic_params` for items where all generics are used, so I had to tweak the foreign provider to fall back to `ty::UnusedGenericParams::new_all_used()` to avoid more ICEs when the above bugs were fixed.
…o-checking, r=oli-obk

Simplify proc macro signature validity check

Use an `ObligationCtxt` instead of `normalize_erasing_regions` + `DeepRejectCtxt`. This should both give us a more accurate error message, and also avoid issues like not-well-formed proc macro signatures. Also, let's fall back on the regular type mismatch error reporting for making these diagnostic notes, instead of hard-coding a bunch of specific diagnostics.

Fixes rust-lang#109129
Update cargo

14 commits in 7d3033d2e59383fd76193daf9423c3d141972a7d..4a3c588b1f0a8e2dc8dd8789dbf3b6a71b02ed49
2023-03-08 17:05:08 +0000 to 2023-03-14 14:05:36 +0000
- ci: make clean-test-output a script for reuse (rust-lang/cargo#11848)
- Accurately show status when downgrading dependencies (rust-lang/cargo#11839)
- docs(contrib): Move Design Principles earlier in the book (rust-lang/cargo#11842)
- docs(contrib): Point compilation docs to doc comments (rust-lang/cargo#11841)
- `cargo install --git` multiple packages with binaries found hint (rust-lang/cargo#11835)
- Disable flaky auth tests when `gitoxide` runs them (rust-lang/cargo#11830)
- Add some documentation on writing cross-compilation tests (rust-lang/cargo#11825)
- chore: Use sparse protocol on stable CI (rust-lang/cargo#11829)
- Notice for potential unexpected shell expansions in help text of `cargo-add` (rust-lang/cargo#11826)
- Add tracking issue to gitoxide unstable docs (rust-lang/cargo#11822)
- Bump crates-io to 0.36.0 (rust-lang/cargo#11820)
- Bump to 0.71.0; update changelog (rust-lang/cargo#11815)
- docs(contrib): Move overview to lib (rust-lang/cargo#11809)
- Fix semver check for 1.68 (rust-lang/cargo#11817)

r? `@ghost`
…mpiler-errors

Fix MappingToUnit  to support no span of arg_ty

Fixes rust-lang#109152
…crum

Remove mw from review rotation for a while

I'm triple booked right now 📚
This patched has been necessary for subtree syncs from the start, but
previously it was necessary to locally install tqc's patched git
version, which hasn't been updated for quite a while. I made a small
change to allow downloading it as script without requiring an entire git
installation for the patched version.
Rollup of 7 pull requests

Successful merges:

 - rust-lang#108991 (add `enable-warnings` flag for llvm, and disable it by default.)
 - rust-lang#109109 (Use `unused_generic_params` from crate metadata)
 - rust-lang#109111 (Create dirs for build_triple)
 - rust-lang#109136 (Simplify proc macro signature validity check)
 - rust-lang#109150 (Update cargo)
 - rust-lang#109154 (Fix MappingToUnit  to support no span of arg_ty)
 - rust-lang#109157 (Remove mw from review rotation for a while)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
…orn3

Sync rustc_codegen_cranelift

Bunch of bug fixes this time. Also an update to Cranelift 0.93 which adds a brand new optimization pass which cg_clif exposes when using `--release`. And various improvements to cg_clif's test suite, making it faster to run. And finally two small perf improvements.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
@bors
Copy link
Contributor

bors commented Mar 15, 2023

☔ The latest upstream changes (presumably #109164) made this pull request unmergeable. Please resolve the merge conflicts.

bors and others added 5 commits March 15, 2023 21:31
Implement checked Shl/Shr at MIR building.

This does not require any special handling by codegen backends,
as the overflow behaviour is entirely determined by the rhs (shift amount).

This allows MIR ConstProp to remove the overflow check for constant shifts.

~There is an existing different behaviour between cg_llvm and cg_clif (cc `@bjorn3).`
I took cg_llvm's one as reference: overflow if `rhs < 0 || rhs > number_of_bits_in_lhs_ty`.~

EDIT: `cg_llvm` and `cg_clif` implement the overflow check differently. This PR uses `cg_llvm`'s implementation based on a `BitAnd` instead of `cg_clif`'s one based on an unsigned comparison.
Revert rust-lang#107376 to fix potential `bincode` breakage and `rustc-perf` benchmark.

rust-lang#107376 caused `rustc-perf`'s `webrender` benchmark to break, by regressing on the `bincode-1.3.3` crate.

~~This PR is a draft revert in case we can't land a fix soon enough, and we'd like to land the revert instead~~

(Though I myself think it'd be safer to do the revert, and run crater when relanding rust-lang#107376.)

cc `@aliemjay`
fix ignore header in MSVC test

From `@pietroalbini's` [zulip message](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/better.20compiletest.20ignore.20messages/near/339845864)

> there are tests like `tests/ui/panic-runtime/unwind-tables-target-required.rs` which have `only-x86_64-windows-msvc` which I'm pretty sure is invalid

This test is currently ignored on x64 MSVC CI because of this incorrect target. We'll see if it still passes.

r? `@pietroalbini`
Renamed 'native.rs' to 'llvm.rs', also moved `TestHelpers` to `test.rs`.Replaced all the `native.rs` ocurrences at `src/bootstrap` files to `llvm.rs`
@rustbot rustbot added the A-meta Area: Issues & PRs about the rust-lang/rust repository itself label Mar 16, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 16, 2023

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

These commits modify the Cargo.lock file. Random changes to Cargo.lock can be introduced when switching branches and rebasing PRs.
This was probably unintentional and should be reverted before this PR is merged.

If this was intentional then you can ignore this comment.

This PR changes src/bootstrap/defaults/config.codegen.toml. If appropriate, please also update config.compiler.toml so the defaults are in sync.

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

Some changes occurred in src/tools/cargo

cc @ehuss

These commits modify compiler targets.
(See the Target Tier Policy.)

@Mark-Simulacrum
Copy link
Member

This seems to have included a merge or similar, you probably want to rebase. @rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 18, 2023
@bors
Copy link
Contributor

bors commented Mar 20, 2023

☔ The latest upstream changes (presumably #109384) made this pull request unmergeable. Please resolve the merge conflicts.

@rohaquinlop rohaquinlop deleted the rename-native.rs-to-llvm.rs branch March 20, 2023 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename src/bootstrap/native.rs to llvm.rs