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

Remove LocalDefId <-> HirId global maps #89278

Closed
wants to merge 3 commits into from

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Sep 26, 2021

Based on #89124.

The LocalDefId <-> HirId maps were globally accessed through tcx.definitions. They are now encoded using the HIR queries.

  • For HirId -> LocalDefId, a side map is added inside hir_owner_nodes(hir_id.owner), indexed by hir_id.local_id.
  • For LocalDefId -> HirId, the mapping is obvious if the local_def_id is an HIR owner, ie. if hir_owner is Some. Therefore, we use the None case to store the non-owning HirId.

There is a special case with use trees, which can have a LocalDefId, which should be an HIR owner, but with no associated HIR data structure. In that case, we store the information like non-owning definitions.

@rust-highfive
Copy link
Collaborator

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 26, 2021
@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 added A-incr-comp Area: Incremental compilation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 26, 2021
@bors

This comment has been minimized.

@bors

This comment has been minimized.

@cjgillot cjgillot force-pushed the owner-did branch 2 times, most recently from 2ea6352 to 28329e9 Compare October 4, 2021 20:32
@oli-obk oli-obk added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Oct 6, 2021
@bors

This comment has been minimized.

@cjgillot cjgillot removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Oct 19, 2021
@cjgillot
Copy link
Contributor Author

cc @michaelwoerister since you reviewed #89124.

@cjgillot
Copy link
Contributor Author

@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 Oct 19, 2021
@bors
Copy link
Contributor

bors commented Oct 19, 2021

⌛ Trying commit e314d9902736731bde1bf07b455e2b62cbc93b57 with merge 9d51250e101ca95958b481c7c0e36210a39dabec...

@bors
Copy link
Contributor

bors commented Oct 19, 2021

☀️ Try build successful - checks-actions
Build commit: 9d51250e101ca95958b481c7c0e36210a39dabec (9d51250e101ca95958b481c7c0e36210a39dabec)

@rust-timer
Copy link
Collaborator

Queued 9d51250e101ca95958b481c7c0e36210a39dabec with parent 1af55d1, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9d51250e101ca95958b481c7c0e36210a39dabec): comparison url.

Summary: This change led to very large relevant regressions 😿 in compiler performance.

  • Very large regression in instruction counts (up to 9.0% on incr-unchanged builds of match-stress-enum)

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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 19, 2021
@jackh726 jackh726 removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2021
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor Author

@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 Jan 29, 2022
@bors
Copy link
Contributor

bors commented Jan 29, 2022

⌛ Trying commit 6805235 with merge b3336bc040e749560ae2b328fc7bf69d5f9a17d8...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

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

running 165 tests
...................................i..............

command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-i686-unknown-linux-gnu" "--suite" "mir-opt" "--mode" "mir-opt" "--target" "i686-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-12/bin/FileCheck" "--nodejs" "/usr/bin/node" "--linker" "cc" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "12.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel hellonew hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"
expected success, got: signal: 11 (core dumped)

Build completed unsuccessfully in 0:01:33

@bors
Copy link
Contributor

bors commented Jan 29, 2022

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

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 29, 2022

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

@rust-timer
Copy link
Collaborator

Queued b3336bc040e749560ae2b328fc7bf69d5f9a17d8 with parent d08e816, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b3336bc040e749560ae2b328fc7bf69d5f9a17d8): comparison url.

Summary: This benchmark run shows 166 relevant regressions 😿 to instruction counts.

  • Average relevant regression: 0.9%
  • Largest regression in instruction counts: 6.9% on incr-unchanged builds of match-stress-enum 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@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 Jan 29, 2022
@cjgillot
Copy link
Contributor Author

Replaced by #93373.

@cjgillot cjgillot closed this Jan 29, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2022
… r=oli-obk

Store def_id_to_hir_id as variant in hir_owner.

If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0.
If the HIR node does not exist, we store Phantom.
Otherwise, we store the HirId associated to the LocalDefId.

Related to rust-lang#89278

r? `@oli-obk`
@cjgillot cjgillot deleted the owner-did branch February 11, 2022 19:55
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2022
…, r=oli-obk

Node id to hir id refactor

Related to rust-lang#89278

r? `@oli-obk`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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. 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.