]> git.lizzy.rs Git - rust.git/commitdiff
Don't inline query_cache_hit to reduce code size of the query hot path.
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Tue, 31 Jan 2023 17:15:42 +0000 (18:15 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Mon, 6 Feb 2023 12:52:17 +0000 (13:52 +0100)
compiler/rustc_data_structures/src/profiling.rs
compiler/rustc_query_system/src/query/plumbing.rs

index 393f173908128457c7f70f01c8eddbbc8240c7cf..20827c9fd1a4ff37eace5b12edbfdb03ffadc105 100644 (file)
@@ -393,7 +393,7 @@ pub fn query_provider(&self) -> TimingGuard<'_> {
     }
 
     /// Record a query in-memory cache hit.
-    #[inline(always)]
+    #[inline(never)]
     pub fn query_cache_hit(&self, query_invocation_id: QueryInvocationId) {
         self.instant_query_event(
             |profiler| profiler.query_cache_hit_event_kind,
index ffc413d15f52b0528d7c294b554be089940df5fc..2fde3c6075b74a7c12709d4c2f085d24ab6fdf7f 100644 (file)
@@ -722,7 +722,9 @@ fn ensure_must_run<Q, Qcx>(qcx: Qcx, key: &Q::Key) -> (bool, Option<DepNode<Qcx:
         }
         Some((_, dep_node_index)) => {
             dep_graph.read_index(dep_node_index);
-            qcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
+            if std::intrinsics::unlikely(qcx.dep_context().profiler().enabled()) {
+                qcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
+            }
             (false, None)
         }
     }