[PATCH] D145216: [llvm][Uniformity] correctly use a vector as a set by uniqifying elements

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 23:16:34 PST 2023


sameerds created this revision.
Herald added a subscriber: mgrang.
Herald added a project: All.
sameerds requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The search for temporal divergence needs to determine a dominance frontier
defined for a cycle. The implementation uses a temporary vector to store a set
of newly discovered successors. Failing to uniqify the elements in this vector
causes a very large regression in compile time due to an exponential number of
redundant visits.

This fixes github issue #61123


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145216

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


Index: llvm/include/llvm/ADT/GenericUniformityImpl.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -876,6 +876,11 @@
     }
     if (!Promoted)
       break;
+
+    // Restore the set property for the temporary vector
+    llvm::sort(Temp);
+    Temp.erase(std::unique(Temp.begin(), Temp.end()), Temp.end());
+
     DomFrontier = Temp;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145216.502056.patch
Type: text/x-patch
Size: 468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230303/c227ab9e/attachment.bin>


More information about the llvm-commits mailing list