Skip to content

Commit 20ae8d8

Browse files
Rollup merge of #151540 - Zoxc:color-get-opt, r=jieyouxu
Tweak bounds check in `DepNodeColorMap.get` This aligns the outer bounds check for a green color in `DepNodeColorMap.get` with the bounds check in `DepNodeIndex::from_u32`, allowing the latter to be optimized out.
2 parents cc2dcfe + 58dd2e5 commit 20ae8d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • compiler/rustc_query_system/src/dep_graph

compiler/rustc_query_system/src/dep_graph/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ impl DepNodeColorMap {
13961396
let value = self.values[index].load(Ordering::Acquire);
13971397
// Green is by far the most common case. Check for that first so we can succeed with a
13981398
// single comparison.
1399-
if value < COMPRESSED_RED {
1399+
if value <= DepNodeIndex::MAX_AS_U32 {
14001400
DepNodeColor::Green(DepNodeIndex::from_u32(value))
14011401
} else if value == COMPRESSED_RED {
14021402
DepNodeColor::Red

0 commit comments

Comments
 (0)