Skip to content

Sync rustc_codegen_cranelift #97057

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

Merged
merged 30 commits into from
May 15, 2022
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 15, 2022

Since the last sync there have mostly been fixes of various sorts. I also changed cg_clif from using a custom driver to -Zcodegen-backend when built as separate project. When built as part of rust it was already using -Zcodegen-backend.

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler

bjorn3 and others added 30 commits April 22, 2022 21:11
#[no_mangle] doesn't resolve when the codegen backend is opened with RTLD_LOCAL
Use -Zcodegen-backend instead of a custom rustc driver
Cargo now disables optimizations for build scripts by default anyway, so
they aren't really useful anymore.
Cranelift currently only supports JIT on x86_64 targets.
Disable JIT tests on all other targets, so that failing tests are
ignored.
Only enable JIT tests on x86_64
Rustbuild uses --check-cfg without allowing disabled as cfg name
Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`.  Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`.

As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives.  That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change.

This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE.  It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend labels May 15, 2022
@bjorn3
Copy link
Member Author

bjorn3 commented May 15, 2022

@bors r+ subtree sync

@bors
Copy link
Collaborator

bors commented May 15, 2022

📌 Commit ecd8fa1 has been approved by bjorn3

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 15, 2022
@bors
Copy link
Collaborator

bors commented May 15, 2022

⌛ Testing commit ecd8fa1 with merge 42e1761...

@bors
Copy link
Collaborator

bors commented May 15, 2022

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing 42e1761 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 15, 2022
@bors bors merged commit 42e1761 into rust-lang:master May 15, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 15, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (42e1761): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@bjorn3 bjorn3 deleted the sync_cg_clif-2022-05-15 branch May 16, 2022 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants