[PATCH] D15679: [FIX] Schedule generation PR25879

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 06:15:44 PST 2016


grosser added a comment.

Hi Johannes,

for our discussion, here a code snippet that explains my worklist approach. It basically replaces the deque you anyway already added.


================
Comment at: lib/Analysis/ScopInfo.cpp:3463
@@ +3462,3 @@
+  // the iterator (if any) to guarantee progress. If it is not set we first try
+  // the next queded sub-region/blocks.
+  //
----------------
queued

================
Comment at: lib/Analysis/ScopInfo.cpp:3498
@@ -3454,1 +3497,3 @@
+      LoopStack.push_back(L);
+    }
 
----------------
jdoerfert wrote:
> But a workl list doesn't magically remove the different cases and iterators. The same logic is needed (if it is even that simple to decide if we need to delay a region node in case we do not yet build the schedule).
What do you think of the following piece of code? It passes for me all tests and at least avoids the need for LastRNWaiting as well as explicit iterators.

```
  ReversePostOrderTraversal<Region *> RTraversal(R);                             
  std::deque<RegionNode *> WorkList(RTraversal.begin(), RTraversal.end());       
                                                                                 
  while (!WorkList.empty()) {                                                    
    RegionNode *RN = WorkList.front();                                           
    WorkList.pop_front();                                                        
                                                                                 
    Loop *L = getRegionNodeLoop(RN, LI);                                         
    if (!getRegion().contains(L))                                                
      L = OuterScopLoop;                                                         
                                                                                 
    Loop *LastLoop = LoopStack.back();                                           
    if (LastLoop != L) {                                                         
      if (!LastLoop->contains(L)) {                                              
        WorkList.push_back(RN);                                                  
        continue;                                                                
      }                                                                          
      LoopStack.push_back(L);                                                    
    }
```


http://reviews.llvm.org/D15679





More information about the llvm-commits mailing list