[llvm] r287717 - [StructurizeCFG] Use a for-each loop instead of iterators in runOnRegion.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 15:13:37 PST 2016


Author: jlebar
Date: Tue Nov 22 17:13:37 2016
New Revision: 287717

URL: http://llvm.org/viewvc/llvm-project?rev=287717&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp?rev=287717&r1=287716&r2=287717&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp Tue Nov 22 17:13:37 2016
@@ -939,12 +939,11 @@ bool StructurizeCFG::runOnRegion(Region
       // 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);
       }
 




More information about the llvm-commits mailing list