[PATCH] D98528: [AMDGPU] Use depth first iterator instead of recursive DFS. NFCI.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 03:33:13 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d48b45ce3bf: [AMDGPU] Use depth first iterator instead of recursive DFS. NFCI. (authored by foad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98528/new/

https://reviews.llvm.org/D98528

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
@@ -14,6 +14,7 @@
 
 #include "AMDGPU.h"
 #include "Utils/AMDGPUBaseInfo.h"
+#include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/Analysis/LegacyDivergenceAnalysis.h"
 #include "llvm/Analysis/LoopInfo.h"
@@ -75,12 +76,6 @@
   I->setMetadata("amdgpu.noclobber", MDNode::get(I->getContext(), {}));
 }
 
-static void DFS(BasicBlock *Root, SetVector<BasicBlock*> & Set) {
-  for (auto I : predecessors(Root))
-    if (Set.insert(I))
-      DFS(I, Set);
-}
-
 bool AMDGPUAnnotateUniformValues::isClobberedInFunction(LoadInst * Load) {
   // 1. get Loop for the Load->getparent();
   // 2. if it exists, collect all the BBs from the most outer
@@ -101,7 +96,7 @@
     Start = L->getHeader();
   }
 
-  DFS(Start, Checklist);
+  Checklist.insert(idf_begin(Start), idf_end(Start));
   for (auto &BB : Checklist) {
     BasicBlock::iterator StartIt = (!L && (BB == Load->getParent())) ?
       BasicBlock::iterator(Load) : BB->end();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98528.330595.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210315/aa359255/attachment.bin>


More information about the llvm-commits mailing list