diff options
author | Jan Vesely <jan.vesely@rutgers.edu> | 2015-03-13 17:32:43 +0000 |
---|---|---|
committer | Jan Vesely <jan.vesely@rutgers.edu> | 2015-03-13 17:32:43 +0000 |
commit | 18b289f590b8be1ac77373079d903cc4b0487631 (patch) | |
tree | 3be5bde1c3f2f7ceb949f4d539976695912ab311 /llvm/lib/Target/R600 | |
parent | 510feca1b86530f4c48fb69180a612cdb47fcaf2 (diff) | |
download | bcm5719-llvm-18b289f590b8be1ac77373079d903cc4b0487631.tar.gz bcm5719-llvm-18b289f590b8be1ac77373079d903cc4b0487631.zip |
r600: Use deque and simplify loops in AMDGPUCFGStructurizer
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Matt Arsenault <Matthew.Arsenault@amd.com>
llvm-svn: 232180
Diffstat (limited to 'llvm/lib/Target/R600')
-rw-r--r-- | llvm/lib/Target/R600/AMDILCFGStructurizer.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp b/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp index ee6e8ecfb29..18effba29ea 100644 --- a/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp +++ b/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp @@ -8,6 +8,8 @@ /// \file //==-----------------------------------------------------------------------===// +#include <deque> + #include "AMDGPU.h" #include "AMDGPUInstrInfo.h" #include "R600InstrInfo.h" @@ -1075,21 +1077,19 @@ int AMDGPUCFGStructurizer::ifPatternMatch(MachineBasicBlock *MBB) { } int AMDGPUCFGStructurizer::loopendPatternMatch() { - std::vector<MachineLoop *> NestedLoops; - for (MachineLoopInfo::iterator It = MLI->begin(), E = MLI->end(); It != E; - ++It) - for (MachineLoop *ML : depth_first(*It)) - NestedLoops.push_back(ML); + std::deque<MachineLoop *> NestedLoops; + for (auto &It: *MLI) + for (MachineLoop *ML : depth_first(It)) + NestedLoops.push_front(ML); if (NestedLoops.size() == 0) return 0; - // Process nested loop outside->inside, so "continue" to a outside loop won't - // be mistaken as "break" of the current loop. + // Process nested loop outside->inside (we did push_front), + // so "continue" to a outside loop won't be mistaken as "break" + // of the current loop. int Num = 0; - for (std::vector<MachineLoop *>::reverse_iterator It = NestedLoops.rbegin(), - E = NestedLoops.rend(); It != E; ++It) { - MachineLoop *ExaminedLoop = *It; + for (MachineLoop *ExaminedLoop : NestedLoops) { if (ExaminedLoop->getNumBlocks() == 0 || Visited[ExaminedLoop]) continue; DEBUG(dbgs() << "Processing:\n"; ExaminedLoop->dump();); |