Implement depth_first and inverse_depth_first range factory functions.

Also updated as many loops as I could find using df_begin/idf_begin -
strangely I found no uses of idf_begin. Is that just used out of tree?

Also a few places couldn't use df_begin because either they used the
member functions of the depth first iterators or had specific ordering
constraints (I added a comment in the latter case).

Based on a patch by Jim Grosbach. (Jim - you just had iterator_range<T>
where you needed iterator_range<idf_iterator<T>>)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206016 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-04-11 01:50:01 +00:00
parent ae64ab542a
commit 77cf856e56
10 changed files with 45 additions and 45 deletions

View File

@@ -1075,13 +1075,11 @@ int AMDGPUCFGStructurizer::ifPatternMatch(MachineBasicBlock *MBB) {
int AMDGPUCFGStructurizer::loopendPatternMatch() {
std::vector<MachineLoop *> NestedLoops;
for (MachineLoopInfo::iterator It = MLI->begin(), E = MLI->end();
It != E; ++It) {
df_iterator<MachineLoop *> LpIt = df_begin(*It),
LpE = df_end(*It);
for (; LpIt != LpE; ++LpIt)
NestedLoops.push_back(*LpIt);
}
for (MachineLoopInfo::iterator It = MLI->begin(), E = MLI->end(); It != E;
++It)
for (MachineLoop *ML : depth_first(*It))
NestedLoops.push_back(ML);
if (NestedLoops.size() == 0)
return 0;