Skip to content

Commit

Permalink
Add 'unlikely' annotation to branch in crate DepNodeIndex caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Oct 10, 2019
1 parent 0ee6a96 commit a9853fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_metadata/decoder.rs
Expand Up @@ -1372,7 +1372,7 @@ impl<'a, 'tcx> CrateMetadata {
pub(super) fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex {
let mut dep_node_index = self.dep_node_index.load();

if dep_node_index == DepNodeIndex::INVALID {
if unlikely!(dep_node_index == DepNodeIndex::INVALID) {
// We have not cached the DepNodeIndex for this upstream crate yet,
// so use the dep-graph to find it out and cache it.
// Note that multiple threads can enter this block concurrently.
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_metadata/lib.rs
@@ -1,6 +1,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

#![feature(box_patterns)]
#![feature(core_intrinsics)]
#![feature(crate_visibility_modifier)]
#![feature(drain_filter)]
#![feature(in_band_lifetimes)]
Expand All @@ -11,6 +12,7 @@
#![feature(rustc_private)]
#![feature(slice_patterns)]
#![feature(specialization)]
#![feature(stmt_expr_attributes)]

#![recursion_limit="256"]

Expand Down

0 comments on commit a9853fc

Please sign in to comment.