Skip to content

Stop collecting unmentioned constants #142893

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 1 commit into from
Jun 27, 2025

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Jun 22, 2025

This avoids generating useless dead LLVM IR. This appears to have regressed and/or been introduced in #53821 (unfortunately a very large PR - I don't see any direct discussion there of this particular change), but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions. The adjusted codegen-units test has comments explicitly noting that these items should not be collected ("These are not referenced, so they do not produce mono-items").

I noticed this while looking at libcore LLVM IR we generate, which contained dead code references to the NOOP Waker item, which is never used inside libcore. Producing LLVM IR for it during libcore's compilation, only for that IR to get deleted by LLVM as unused, isn't useful. Note that the IR is generally all marked internal, too.

This avoids generating useless dead LLVM IR.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 22, 2025
@Mark-Simulacrum
Copy link
Member Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 22, 2025

⌛ Trying commit 928564c with merge 499813f

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 22, 2025
Stop collecting unmentioned constants

This avoids generating useless dead LLVM IR. This appears to have regressed and/or been introduced in #53821 (unfortunately a very large PR - I don't see any direct discussion there of this particular change), but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions. The adjusted codegen-units test has comments explicitly noting that these items should *not* be collected ("These are not referenced, so they do not produce mono-items").

I noticed this while looking at libcore LLVM IR we generate, which contained dead code references to the NOOP Waker item, which is never used inside libcore. Producing LLVM IR for it during libcore's compilation, only for that IR to get deleted by LLVM as unused, isn't useful. Note that the IR is generally all marked internal, too.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 22, 2025
@rust-bors
Copy link

rust-bors bot commented Jun 23, 2025

☀️ Try build successful (CI)
Build commit: 499813f (499813f1e930d596afe1c2fc1ec25fcff26a6473, parent: 111e9bc64bbdce14122e3676978f2ceefa5bff1a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (499813f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
13.0% [0.7%, 21.2%] 3
Regressions ❌
(secondary)
9.0% [5.9%, 13.4%] 5
Improvements ✅
(primary)
-1.5% [-2.2%, -0.8%] 9
Improvements ✅
(secondary)
-34.3% [-67.9%, -0.2%] 4
All ❌✅ (primary) 2.1% [-2.2%, 21.2%] 12

Max RSS (memory usage)

Results (primary -5.6%, secondary -0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
-5.6% [-5.6%, -5.6%] 1
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) -5.6% [-5.6%, -5.6%] 1

Cycles

Results (primary 3.3%, secondary -11.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
15.0% [12.8%, 17.1%] 2
Regressions ❌
(secondary)
8.1% [5.0%, 12.0%] 5
Improvements ✅
(primary)
-2.5% [-2.7%, -2.1%] 4
Improvements ✅
(secondary)
-58.8% [-58.8%, -58.8%] 2
All ❌✅ (primary) 3.3% [-2.7%, 17.1%] 6

Binary size

Results (primary -0.1%, secondary 12.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
12.3% [11.7%, 14.0%] 4
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 9
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.2%, 0.1%] 10

Bootstrap: 689.093s -> 689.162s (0.01%)
Artifact size: 371.98 MiB -> 371.87 MiB (-0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 23, 2025
@Mark-Simulacrum
Copy link
Member Author

Mark-Simulacrum commented Jun 23, 2025

The regressions look likely to be noise - specifically codegen unit shuffling - (I'll look in more detail later) but overall this seems like what we want, ctfe-stress improvement in particular looks exactly like what we want to see here.

Marking as waiting on review.

@Mark-Simulacrum Mark-Simulacrum marked this pull request as ready for review June 23, 2025 12:13
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
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 the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Jun 24, 2025

but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions.

we walk all free constants and evaluate them, so we won't miss them this way (as we want to evaluate even unused free constants). But we definitely don't need to collect and codegen them

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 24, 2025

📌 Commit 928564c has been approved by oli-obk

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 Jun 24, 2025
@workingjubilee
Copy link
Member

Everyone takes another turn

@bors p=1

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

⌛ Testing commit 928564c with merge 13c46fd...

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 13c46fd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 27, 2025
@bors bors merged commit 13c46fd into rust-lang:master Jun 27, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jun 27, 2025
Copy link
Contributor

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 d51b6f9 (parent) -> 13c46fd (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 13c46fd0b089360922a557d8e18a63a2c41dfbeb --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-2: 4098.2s -> 6082.6s (48.4%)
  2. dist-apple-various: 7470.2s -> 8759.0s (17.3%)
  3. dist-x86_64-apple: 8441.0s -> 9693.8s (14.8%)
  4. dist-x86_64-netbsd: 4609.1s -> 5188.0s (12.6%)
  5. dist-ohos-x86_64: 4022.2s -> 4387.9s (9.1%)
  6. aarch64-apple: 4603.9s -> 4955.7s (7.6%)
  7. x86_64-apple-1: 8062.9s -> 8638.6s (7.1%)
  8. dist-aarch64-apple: 5986.6s -> 5571.8s (-6.9%)
  9. dist-i586-gnu-i586-i686-musl: 5106.7s -> 5453.2s (6.8%)
  10. x86_64-msvc-ext3: 5881.1s -> 6253.0s (6.3%)
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 (13c46fd): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
19.2% [17.2%, 21.2%] 2
Regressions ❌
(secondary)
9.1% [6.0%, 13.4%] 5
Improvements ✅
(primary)
-1.6% [-2.3%, -0.8%] 8
Improvements ✅
(secondary)
-67.8% [-67.9%, -67.8%] 2
All ❌✅ (primary) 2.6% [-2.3%, 21.2%] 10

Max RSS (memory usage)

Results (primary -1.7%, secondary 1.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.0% [4.0%, 4.0%] 1
Regressions ❌
(secondary)
4.9% [2.4%, 9.4%] 3
Improvements ✅
(primary)
-4.5% [-5.0%, -4.0%] 2
Improvements ✅
(secondary)
-4.0% [-4.1%, -3.9%] 2
All ❌✅ (primary) -1.7% [-5.0%, 4.0%] 3

Cycles

Results (primary 2.4%, secondary -8.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
14.9% [13.0%, 16.9%] 2
Regressions ❌
(secondary)
7.2% [2.5%, 13.2%] 6
Improvements ✅
(primary)
-2.7% [-3.1%, -2.0%] 5
Improvements ✅
(secondary)
-41.0% [-59.0%, -4.9%] 3
All ❌✅ (primary) 2.4% [-3.1%, 16.9%] 7

Binary size

Results (primary -0.2%, secondary 12.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
12.3% [11.7%, 14.0%] 4
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 15
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-0.3%, 0.1%] 16

Bootstrap: 692.293s -> 690.533s (-0.25%)
Artifact size: 372.06 MiB -> 372.10 MiB (0.01%)

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. perf-regression Performance regression. 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