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 -Zhir-stats #100398

Merged
merged 5 commits into from
Aug 11, 2022
Merged

Improve -Zhir-stats #100398

merged 5 commits into from
Aug 11, 2022

Conversation

nnethercote
Copy link
Contributor

Add testing, improve coverage, avoid some double counting, and add more detail.

r? @michaelwoerister

This will be very useful in subsequent commits where I will improve the
output.
This commit:
- Adds a comment explaining which `visit_*` methods should be
  implemented.
- Adds and removes some `visit_*` methods accordingly, improving
  coverage, and avoiding some double counting.
Currently it's reported as either `TraitItem` or `ImplItem`. This commit
changes it to `AssocItem`, because having the report match the type name
is (a) consistent with other types, and (b) the trait/impl split isn't
that important here.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 11, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 11, 2022
Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @nnethercote! This looks useful indeed.

I left a comment about a possible simplification below. Otherwise, feel free to r=me.

compiler/rustc_passes/src/hir_stats.rs Outdated Show resolved Hide resolved
This tells you which variants of the enums are most common, which is
very useful. I've only done it for the AST for now, HIR can be done
later.
@nnethercote
Copy link
Contributor Author

I made the suggested simplification.

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented Aug 11, 2022

📌 Commit 4f8a170 has been approved by michaelwoerister

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 Aug 11, 2022
@nnethercote
Copy link
Contributor Author

@bors rollup=always

Because these code changes are all behind the -Zhir-stats option, so don't affect normal execution.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 11, 2022
Rollup of 11 pull requests

Successful merges:

 - rust-lang#92744 (Check if enum from foreign crate has any non exhaustive variants when attempting a cast)
 - rust-lang#99110 (Determine match_has_guard from candidates instead of looking up thir table again)
 - rust-lang#100184 (Stabilize ptr_const_cast)
 - rust-lang#100192 ( Remove duplicated temporaries creating during box derefs elaboration)
 - rust-lang#100232 (Do not consider method call receiver as an argument in AST.)
 - rust-lang#100287 (linux: Use `pthread_setname_np` instead of `prctl`)
 - rust-lang#100351 (Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed)
 - rust-lang#100370 (Remove more Clean trait implementations)
 - rust-lang#100391 (Improve size assertions)
 - rust-lang#100398 (Improve `-Zhir-stats`)
 - rust-lang#100403 (Improve error messages when running rustdoc GUI tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ecc892 into rust-lang:master Aug 11, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 11, 2022
@nnethercote nnethercote deleted the improve-Zhir-stats branch August 11, 2022 21:10
@nnethercote nnethercote mentioned this pull request Aug 29, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 5, 2022
…avidtwco

Improve HIR stats

rust-lang#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 9, 2022
…avidtwco

Improve HIR stats

rust-lang#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants