[llvm] 3f8431e - [SCCIterator] Union MST node by rank correctly (#86389)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 02:32:00 PDT 2024
Author: XChy
Date: 2024-03-26T17:31:55+08:00
New Revision: 3f8431ec66ffcfaf1bd864261f425b12ab1b59b8
URL: https://github.com/llvm/llvm-project/commit/3f8431ec66ffcfaf1bd864261f425b12ab1b59b8
DIFF: https://github.com/llvm/llvm-project/commit/3f8431ec66ffcfaf1bd864261f425b12ab1b59b8.diff
LOG: [SCCIterator] Union MST node by rank correctly (#86389)
Fixes #85975
Added:
Modified:
llvm/include/llvm/ADT/SCCIterator.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h
index e743ae7c11edbc..3bd103c13f19f9 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;
}
More information about the llvm-commits
mailing list