From: Justin Lebar Date: Tue, 22 Nov 2016 23:13:37 +0000 (+0000) Subject: [StructurizeCFG] Use a for-each loop instead of iterators in runOnRegion. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9582fba0c07a7883b77301041596a4e5d8663ab2;p=llvm [StructurizeCFG] Use a for-each loop instead of iterators in runOnRegion. Summary: Reviewers: arsenm Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D26993 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287717 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/StructurizeCFG.cpp b/lib/Transforms/Scalar/StructurizeCFG.cpp index 57c1997863c..6232bef8079 100644 --- a/lib/Transforms/Scalar/StructurizeCFG.cpp +++ b/lib/Transforms/Scalar/StructurizeCFG.cpp @@ -939,12 +939,11 @@ bool StructurizeCFG::runOnRegion(Region *R, RGPassManager &RGM) { // sub-regions are treated more cleverly, indirect children are not // marked as uniform. MDNode *MD = MDNode::get(R->getEntry()->getParent()->getContext(), {}); - Region::element_iterator E = R->element_end(); - for (Region::element_iterator I = R->element_begin(); I != E; ++I) { - if (I->isSubRegion()) + for (RegionNode *E : R->elements()) { + if (E->isSubRegion()) continue; - if (Instruction *Term = I->getEntry()->getTerminator()) + if (Instruction *Term = E->getEntry()->getTerminator()) Term->setMetadata("structurizecfg.uniform", MD); }