[PATCH] D124069: [NFC][NewGVN] Add updateDFSNumbers().

Konstantina Mitropoulou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 23:44:13 PDT 2022


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

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124069

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp


Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -859,6 +859,7 @@
   // Utilities.
   void cleanupTables();
   std::pair<unsigned, unsigned> assignDFSNumbers(BasicBlock *, unsigned);
+  unsigned updateDFSNumbers(unsigned);
   void updateProcessedCount(const Value *V);
   void verifyMemoryCongruency() const;
   void verifyIterationSettled(Function &F);
@@ -3011,6 +3012,16 @@
   return std::make_pair(Start, End);
 }
 
+unsigned NewGVN::updateDFSNumbers(unsigned ICount) {
+  for (auto DTN : depth_first(DT->getRootNode())) {
+    BasicBlock *B = DTN->getBlock();
+    const auto &BlockRange = assignDFSNumbers(B, ICount);
+    BlockInstRange.insert({B, BlockRange});
+    ICount += BlockRange.second - BlockRange.first;
+  }
+  return ICount;
+}
+
 void NewGVN::updateProcessedCount(const Value *V) {
 #ifndef NDEBUG
   if (ProcessedCount.count(V) == 0) {
@@ -3449,12 +3460,7 @@
   }
 
   // Now a standard depth first ordering of the domtree is equivalent to RPO.
-  for (auto DTN : depth_first(DT->getRootNode())) {
-    BasicBlock *B = DTN->getBlock();
-    const auto &BlockRange = assignDFSNumbers(B, ICount);
-    BlockInstRange.insert({B, BlockRange});
-    ICount += BlockRange.second - BlockRange.first;
-  }
+  ICount = updateDFSNumbers(ICount);
   initializeCongruenceClasses(F);
 
   TouchedInstructions.resize(ICount);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124069.423823.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/7ab90bda/attachment.bin>


More information about the llvm-commits mailing list