[PATCH] D26993: [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 13:44:34 PST 2016
jlebar created this revision.
jlebar added a reviewer: arsenm.
jlebar added a subscriber: llvm-commits.
Herald added a subscriber: wdng.
This also changes the order of iteration. The old code was iterating in
reverse order, but as far as I can tell there's no reason for that.
https://reviews.llvm.org/D26993
Files:
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
Index: llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -939,12 +939,11 @@
// 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26993.78937.patch
Type: text/x-patch
Size: 887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161122/488b11e5/attachment.bin>
More information about the llvm-commits
mailing list