Skip to content

Subtree update GCC backend #140015

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 123 commits into from
Apr 19, 2025

Conversation

GuillaumeGomez
Copy link
Member

cc @antoyo

m-ou-se and others added 30 commits January 7, 2025 16:04
Combined with [1], this will change the overflowing multiplication
operations to return an `extern "C"`-safe type.

Link: rust-lang/compiler-builtins#735 [1]
Make missing_abi lint warn-by-default.

This makes the missing_abi lint warn-by-default, as suggested here: rust-lang/rfcs#3722 (comment)

This needs a lang FCP.
…=bjorn3,antoyo

Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics

Combined with [1], this will change the overflowing multiplication operations to return an `extern "C"`-safe type.

Link: rust-lang/compiler-builtins#735 [1]
…tions with dummy spans instead of dropping them entirely

Revert most of rust-lang#133194 (except the test and the comment fixes). Then refix
not emitting locations at all when the correct location discriminator value
exceeds LLVM's capacity.
…rors

remove support for the (unstable) #[start] attribute

As explained by `@Noratrieb:`
`#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction.

I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple:
- `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail)
- `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways*

`#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is  a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program.
So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place.

Note that this feature has **not** been RFCed in the first place.

*This comment was posted [in May](rust-lang#29633 (comment)) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.*

Closes rust-lang#29633

try-job: x86_64-gnu-nopt
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: test-various
Separate Builder methods from tcx

As part of the autodiff upstreaming we noticed, that it would be nice to have various builder methods available without the TypeContext, which prevents the normal CodegenCx to be passed around between threads.
We introduce a SimpleCx which just owns the llvm module and llvm context, to encapsulate them.
The previous CodegenCx now implements deref and forwards access to the llvm module or context to it's SimpleCx sub-struct. This gives us a bit more flexibility, because now we can pass (or construct) the SimpleCx in locations where we don't have enough information to construct a CodegenCx, or are not able to pass it around due to the tcx lifetimes (and it not implementing send/sync).

This also introduces an SBuilder, similar to the SimpleCx. The SBuilder uses a SimpleCx, whereas the existing Builder uses the larger CodegenCx. I will push updates to make  implementations generic (where possible) to be implemented once and work for either of the two. I'll also clean up the leftover code.

`call` is a bit tricky, because it requires a tcx, I probably need to duplicate it after all.

Tracking:

- rust-lang#124509
This has been unstably const since [1], but a tracking issue was never
created. Per discussion on Zulip [2], there should not be any blockers
to making this const-stable. The function does not provide any
functionality at compile time but does allow code reuse between const-
and non-const functions, so stabilize it here.

[1]: rust-lang#92226
[2]: https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const_black_box
…llaumeGomez

Update rustc_codegen_gcc subtree

cc `@antoyo`
…, r=dtolnay

Stabilize `const_black_box`

This has been unstably const since rust-lang#92226, but a tracking issue was never created. Per [discussion on Zulip][zulip], there should not be any blockers to making this const-stable. The function does not provide any functionality at compile time but does allow code reuse between const- and non-const functions, so stabilize it here.

[zulip]: https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const_black_box
Rollup of 8 pull requests

Successful merges:

 - rust-lang#135414 (Stabilize `const_black_box`)
 - rust-lang#136150 (ci: use windows 2025 for i686-mingw)
 - rust-lang#136258 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 11))
 - rust-lang#136270 (Remove `NamedVarMap`.)
 - rust-lang#136278 (add constraint graph to polonius MIR dump)
 - rust-lang#136287 (LLVM changed the nocapture attribute to captures(none))
 - rust-lang#136291 (some test suite cleanups)
 - rust-lang#136296 (float::min/max: mention the non-determinism around signed 0)

r? `@ghost`
`@rustbot` modify labels: rollup
Add success job for all CI workflows
There shouldn't be a need to run all CI jobs on all pushes.
Remove duplicated CI triggers
Move back to a success job so because the required checks only work without a matrix
As discussed on chat, there currently is the bug where certain suffixes are interpreted by the (m68k) assembler.

Example: `move.l #global.w,-44(%fp)`
`.w` is interpreted by the assembler as a size hint for `#global`.
Add M68000 entry to arch_to_gcc
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@GuillaumeGomez
Copy link
Member Author

r? ghost

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the subtree-update_cg_gcc_2025-04-18 branch from 7340179 to cc359b8 Compare April 18, 2025 22:08
@GuillaumeGomez
Copy link
Member Author

@bors delegate=antoyo

@bors
Copy link
Collaborator

bors commented Apr 18, 2025

✌️ @antoyo, you can now approve this pull request!

If @GuillaumeGomez told you to "r=me" after making some further change, please make that change, then do @bors r=@GuillaumeGomez

@antoyo
Copy link
Contributor

antoyo commented Apr 18, 2025

@bors r+ p=1 rollup=never

@bors
Copy link
Collaborator

bors commented Apr 18, 2025

📌 Commit cc359b8 has been approved by antoyo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2025
@bors
Copy link
Collaborator

bors commented Apr 19, 2025

⌛ Testing commit cc359b8 with merge 2ef7858...

@bors
Copy link
Collaborator

bors commented Apr 19, 2025

☀️ Test successful - checks-actions
Approved by: antoyo
Pushing 2ef7858 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 19, 2025
@bors bors merged commit 2ef7858 into rust-lang:master Apr 19, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 19, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 191df20 (parent) -> 2ef7858 (this PR)

Test differences

No test diffs found

Job duration changes

  1. dist-x86_64-apple: 7152.2s -> 10601.5s (48.2%)
  2. dist-aarch64-linux: 7710.2s -> 5282.2s (-31.5%)
  3. dist-apple-various: 7662.0s -> 6128.4s (-20.0%)
  4. dist-armv7-linux: 5380.2s -> 5781.1s (7.5%)
  5. x86_64-apple-2: 5135.4s -> 4845.3s (-5.6%)
  6. test-various: 4365.1s -> 4132.0s (-5.3%)
  7. i686-msvc-2: 7413.5s -> 7032.3s (-5.1%)
  8. x86_64-msvc-ext1: 7040.9s -> 7351.3s (4.4%)
  9. x86_64-msvc-1: 8985.4s -> 8595.5s (-4.3%)
  10. dist-powerpc64-linux: 5552.9s -> 5324.4s (-4.1%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2ef7858): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 0.5%, secondary 2.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.0% [0.4%, 2.9%] 8
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-2.8%, 2.9%] 9

Cycles

Results (primary 0.6%, secondary 2.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.4%, 0.7%] 11
Regressions ❌
(secondary)
2.8% [2.2%, 3.3%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.4%, 0.7%] 11

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 772.31s -> 774.105s (0.23%)
Artifact size: 365.02 MiB -> 365.05 MiB (0.01%)

@GuillaumeGomez GuillaumeGomez deleted the subtree-update_cg_gcc_2025-04-18 branch April 19, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.