From 483727da487c1cb97c6b23ce6eea37886a0df0e1 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 4 Feb 2014 19:19:07 +0000 Subject: [PATCH] cleanup: scc_iterator consumers should use isAtEnd No functional change. Updated loops from: for (I = scc_begin(), E = scc_end(); I != E; ++I) to: for (I = scc_begin(); !I.isAtEnd(); ++I) for teh win. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200789 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IPA/GlobalsModRef.cpp | 3 +-- lib/Target/R600/AMDILCFGStructurizer.cpp | 4 ++-- lib/Transforms/IPO/FunctionAttrs.cpp | 3 +-- lib/Transforms/Scalar/StructurizeCFG.cpp | 5 ++--- tools/opt/PrintSCC.cpp | 7 +++---- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index e0723026de7..2a8b96da069 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -367,8 +367,7 @@ bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) { void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) { // We do a bottom-up SCC traversal of the call graph. In other words, we // visit all callees before callers (leaf-first). - for (scc_iterator I = scc_begin(&CG), E = scc_end(&CG); I != E; - ++I) { + for (scc_iterator I = scc_begin(&CG); !I.isAtEnd(); ++I) { std::vector &SCC = *I; assert(!SCC.empty() && "SCC with no functions?"); diff --git a/lib/Target/R600/AMDILCFGStructurizer.cpp b/lib/Target/R600/AMDILCFGStructurizer.cpp index 69ced3c8f6c..90d541eedad 100644 --- a/lib/Target/R600/AMDILCFGStructurizer.cpp +++ b/lib/Target/R600/AMDILCFGStructurizer.cpp @@ -934,8 +934,8 @@ bool AMDGPUCFGStructurizer::run() { void AMDGPUCFGStructurizer::orderBlocks(MachineFunction *MF) { int SccNum = 0; MachineBasicBlock *MBB; - for (scc_iterator It = scc_begin(MF), E = scc_end(MF); - It != E; ++It, ++SccNum) { + for (scc_iterator It = scc_begin(MF); !It.isAtEnd(); + ++It, ++SccNum) { std::vector &SccNext = *It; for (std::vector::const_iterator blockIter = SccNext.begin(), blockEnd = SccNext.end(); diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp index 92d2f79fa73..5ff55b0169e 100644 --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/lib/Transforms/IPO/FunctionAttrs.cpp @@ -604,8 +604,7 @@ bool FunctionAttrs::AddArgumentAttrs(const CallGraphSCC &SCC) { // made. If the definition doesn't have a 'nocapture' attribute by now, it // captures. - for (scc_iterator I = scc_begin(&AG), E = scc_end(&AG); - I != E; ++I) { + for (scc_iterator I = scc_begin(&AG); !I.isAtEnd(); ++I) { std::vector &ArgumentSCC = *I; if (ArgumentSCC.size() == 1) { if (!ArgumentSCC[0]->Definition) continue; // synthetic root node diff --git a/lib/Transforms/Scalar/StructurizeCFG.cpp b/lib/Transforms/Scalar/StructurizeCFG.cpp index 707da30192c..60382889ef0 100644 --- a/lib/Transforms/Scalar/StructurizeCFG.cpp +++ b/lib/Transforms/Scalar/StructurizeCFG.cpp @@ -277,9 +277,8 @@ bool StructurizeCFG::doInitialization(Region *R, RGPassManager &RGM) { /// \brief Build up the general order of nodes void StructurizeCFG::orderNodes() { - scc_iterator I = scc_begin(ParentRegion), - E = scc_end(ParentRegion); - for (Order.clear(); I != E; ++I) { + scc_iterator I = scc_begin(ParentRegion); + for (Order.clear(); !I.isAtEnd(); ++I) { std::vector &Nodes = *I; Order.append(Nodes.begin(), Nodes.end()); } diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp index 9322cbceec3..00282140730 100644 --- a/tools/opt/PrintSCC.cpp +++ b/tools/opt/PrintSCC.cpp @@ -74,8 +74,7 @@ Z("print-callgraph-sccs", "Print SCCs of the Call Graph"); bool CFGSCC::runOnFunction(Function &F) { unsigned sccNum = 0; errs() << "SCCs for Function " << F.getName() << " in PostOrder:"; - for (scc_iterator SCCI = scc_begin(&F), - E = scc_end(&F); SCCI != E; ++SCCI) { + for (scc_iterator SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) { std::vector &nextSCC = *SCCI; errs() << "\nSCC #" << ++sccNum << " : "; for (std::vector::const_iterator I = nextSCC.begin(), @@ -95,8 +94,8 @@ bool CallGraphSCC::runOnModule(Module &M) { CallGraph &CG = getAnalysis().getCallGraph(); unsigned sccNum = 0; errs() << "SCCs for the program in PostOrder:"; - for (scc_iterator SCCI = scc_begin(&CG), - E = scc_end(&CG); SCCI != E; ++SCCI) { + for (scc_iterator SCCI = scc_begin(&CG); !SCCI.isAtEnd(); + ++SCCI) { const std::vector &nextSCC = *SCCI; errs() << "\nSCC #" << ++sccNum << " : "; for (std::vector::const_iterator I = nextSCC.begin(), -- 2.34.1