[PATCH] D157938: Fix problem with SCC sort

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 17:17:19 PDT 2023


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: hoy, wenlei.
Herald added a project: All.
andrew.w.kaylor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch fixes a minor problem with SCC sorting wherein a value is compared to itself. The problem has been present since this code was introduced in D114204 <https://reviews.llvm.org/D114204>. It appears to be a simple typo.


https://reviews.llvm.org/D157938

Files:
  llvm/include/llvm/ADT/SCCIterator.h


Index: llvm/include/llvm/ADT/SCCIterator.h
===================================================================
--- llvm/include/llvm/ADT/SCCIterator.h
+++ llvm/include/llvm/ADT/SCCIterator.h
@@ -282,7 +282,7 @@
       return false;
 
     // Make the smaller rank tree a direct child or the root of high rank tree.
-    if (G1->Rank < G1->Rank)
+    if (G1->Rank < G2->Rank)
       G1->Group = G2;
     else {
       G2->Group = G1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157938.550149.patch
Type: text/x-patch
Size: 433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230815/a47f0725/attachment.bin>


More information about the llvm-commits mailing list