[llvm] r232180 - r600: Use deque and simplify loops in AMDGPUCFGStructurizer
Jan Vesely
jan.vesely at rutgers.edu
Fri Mar 13 10:32:44 PDT 2015
Author: jvesely
Date: Fri Mar 13 12:32:43 2015
New Revision: 232180
URL: http://llvm.org/viewvc/llvm-project?rev=232180&view=rev
Log:
r600: Use deque and simplify loops in AMDGPUCFGStructurizer
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Matt Arsenault <Matthew.Arsenault at amd.com>
Modified:
llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp
Modified: llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp?rev=232180&r1=232179&r2=232180&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp Fri Mar 13 12:32:43 2015
@@ -8,6 +8,8 @@
/// \file
//==-----------------------------------------------------------------------===//
+#include <deque>
+
#include "AMDGPU.h"
#include "AMDGPUInstrInfo.h"
#include "R600InstrInfo.h"
@@ -1075,21 +1077,19 @@ int AMDGPUCFGStructurizer::ifPatternMatc
}
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(););
More information about the llvm-commits
mailing list