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

Improve AdtDef interning. #94733

Merged
merged 1 commit into from
Mar 12, 2022
Merged

Conversation

nnethercote
Copy link
Contributor

This commit makes AdtDef use Interned. Much of the commit is tedious
changes to introduce getter functions. The interesting changes are in
compiler/rustc_middle/src/ty/adt.rs.

r? @fee1-dead

@rust-highfive
Copy link
Collaborator

Some changes occured to rustc_codegen_gcc

cc @antoyo

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occured to rustc_codegen_cranelift

cc @bjorn3

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 8, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 8, 2022
@fee1-dead
Copy link
Member

Since AdtDef already uses its DefId as a hash I don't think there is going to be any performance impact here, but it is nice to be safe.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 8, 2022
@bors
Copy link
Contributor

bors commented Mar 8, 2022

⌛ Trying commit 535c26fa26876bf6305d840b65b83a780b8d9128 with merge 97e4e12bccb6d65473261eb5813514d27e23a42f...

@bors
Copy link
Contributor

bors commented Mar 8, 2022

☀️ Try build successful - checks-actions
Build commit: 97e4e12bccb6d65473261eb5813514d27e23a42f (97e4e12bccb6d65473261eb5813514d27e23a42f)

@rust-timer
Copy link
Collaborator

Queued 97e4e12bccb6d65473261eb5813514d27e23a42f with parent d2710db, future comparison URL.

@camsteffen
Copy link
Contributor

These interning changes are neat.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (97e4e12bccb6d65473261eb5813514d27e23a42f): comparison url.

Summary: This benchmark run shows 17 relevant improvements 🎉 to instruction counts.

  • Arithmetic mean of relevant improvements: -0.5%
  • Largest improvement in instruction counts: -0.7% on full builds of wg-grammar check

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

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 8, 2022
@nnethercote nnethercote force-pushed the fix-AdtDef-interning branch 2 times, most recently from a8bddb7 to c0ca82f Compare March 11, 2022 01:41
@nnethercote
Copy link
Contributor Author

I have fixed the conflicts. I also introduced AdtDef::variant() and rewrote a bunch of def.variants()[n] expressions as def.variant(n).

@rust-log-analyzer

This comment has been minimized.

This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
@nnethercote nnethercote force-pushed the fix-AdtDef-interning branch from c0ca82f to ca5525d Compare March 11, 2022 02:31
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 11, 2022

📌 Commit ca5525d has been approved by fee1-dead

@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 Mar 11, 2022
@bors
Copy link
Contributor

bors commented Mar 12, 2022

⌛ Testing commit ca5525d with merge b0b618a6a8003ad7d8f573e7f20bfa790fc079b6...

@bors
Copy link
Contributor

bors commented Mar 12, 2022

💔 Test failed - checks-actions

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

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@fee1-dead
Copy link
Member

@bors retry apple builder vanished

@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 Mar 12, 2022
@bors
Copy link
Contributor

bors commented Mar 12, 2022

⌛ Testing commit ca5525d with merge 012720f...

@bors
Copy link
Contributor

bors commented Mar 12, 2022

☀️ Test successful - checks-actions
Approved by: fee1-dead
Pushing 012720f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 12, 2022
@bors bors merged commit 012720f into rust-lang:master Mar 12, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 12, 2022
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #94733!

Tested on commit 012720f.
Direct link to PR: #94733

💔 miri on windows: test-fail → build-fail (cc @eddyb @RalfJung @oli-obk).
💔 miri on linux: test-fail → build-fail (cc @eddyb @RalfJung @oli-obk).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Mar 12, 2022
Tested on commit rust-lang/rust@012720f.
Direct link to PR: <rust-lang/rust#94733>

💔 miri on windows: test-fail → build-fail (cc @eddyb @RalfJung @oli-obk).
💔 miri on linux: test-fail → build-fail (cc @eddyb @RalfJung @oli-obk).
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (012720f): comparison url.

Summary: This benchmark run shows 30 relevant improvements 🎉 to instruction counts.

  • Arithmetic mean of relevant improvements: -0.5%
  • Largest improvement in instruction counts: -1.2% on full builds of match-stress-enum doc

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

@rustbot label: -perf-regression

@nnethercote nnethercote deleted the fix-AdtDef-interning branch March 12, 2022 21:49
dario23 added a commit to dario23/rust-semverver that referenced this pull request May 4, 2022
dario23 added a commit to dario23/rust-semverver that referenced this pull request May 6, 2022
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants