diff options
author | XChy <xxs_chy@outlook.com> | 2024-03-26 17:31:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 17:31:55 +0800 |
commit | 3f8431ec66ffcfaf1bd864261f425b12ab1b59b8 (patch) | |
tree | cc4e37e8eb3e3c2183372a11ce84f68405194303 | |
parent | eb70b485a91361eee83d3744d1bd3e4c3a23692f (diff) | |
download | llvm-3f8431ec66ffcfaf1bd864261f425b12ab1b59b8.zip llvm-3f8431ec66ffcfaf1bd864261f425b12ab1b59b8.tar.gz llvm-3f8431ec66ffcfaf1bd864261f425b12ab1b59b8.tar.bz2 |
[SCCIterator] Union MST node by rank correctly (#86389)
Fixes #85975
-rw-r--r-- | llvm/include/llvm/ADT/SCCIterator.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h index e743ae7..3bd103c 100644 --- a/llvm/include/llvm/ADT/SCCIterator.h +++ b/llvm/include/llvm/ADT/SCCIterator.h @@ -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; } |