Skip to content

Commit 0dfce4d

Browse files
committed
Don't use anon for query erase_and_anonymize_regions_ty
According to its comment, this query was only using `anon` to save a little bit of work for a dep graph node that is expected to have no dependencies. Benchmarks indicate that the perf loss, if any, is small enough to be justified by the fact that we can now remove support for `anon` queries. Adding `no_hash` appears to give marginally better perf results.
1 parent 70f3e09 commit 0dfce4d

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

compiler/rustc_middle/src/queries.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,10 @@ rustc_queries! {
767767
/// Normally you would just use `tcx.erase_and_anonymize_regions(value)`,
768768
/// however, which uses this query as a kind of cache.
769769
query erase_and_anonymize_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
770-
// This query is not expected to have input -- as a result, it
771-
// is not a good candidates for "replay" because it is essentially a
772-
// pure function of its input (and hence the expectation is that
773-
// no caller would be green **apart** from just these
774-
// queries). Making it anonymous avoids hashing the result, which
775-
// may save a bit of time.
776-
anon
777770
desc { "erasing regions from `{}`", ty }
771+
// Not hashing the return value appears to give marginally better perf for this query,
772+
// which should always be marked green for having no dependencies anyway.
773+
no_hash
778774
}
779775

780776
query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {

0 commit comments

Comments
 (0)