[llvm] [SCCIterator] Union MST node by rank correctly (PR #86389)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Mar 23 03:15:43 PDT 2024
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: XChy (XChy)
<details>
<summary>Changes</summary>
Fixes #<!-- -->85975
---
Full diff: https://github.com/llvm/llvm-project/pull/86389.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/SCCIterator.h (+3-3) 
``````````diff
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;
   }
``````````
</details>
https://github.com/llvm/llvm-project/pull/86389
    
    
More information about the llvm-commits
mailing list