Skip to content

Commit

Permalink
[SCCIterator] Union MST node by rank correctly (#86389)
Browse files Browse the repository at this point in the history
Fixes #85975
  • Loading branch information
XChy committed Mar 26, 2024
1 parent eb70b48 commit 3f8431e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/include/llvm/ADT/SCCIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ class scc_member_iterator {
if (G1 == G2)
return false;

// Make the smaller rank tree a direct child or the root of high rank tree.
if (G1->Rank < G1->Rank)
// Make the smaller rank tree a direct child of high rank tree.
if (G1->Rank < G2->Rank)
G1->Group = G2;
else {
G2->Group = G1;
// If the ranks are the same, increment root of one tree by one.
if (G1->Rank == G2->Rank)
G2->Rank++;
G1->Rank++;
}
return true;
}
Expand Down

0 comments on commit 3f8431e

Please sign in to comment.