summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/NaryReassociate.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/NaryReassociate.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
index 5bde45f1779..e2081f7bb8f 100644
--- a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
@@ -207,11 +207,11 @@ static bool isPotentiallyNaryReassociable(Instruction *I) {
bool NaryReassociatePass::doOneIteration(Function &F) {
bool Changed = false;
SeenExprs.clear();
- // Process the basic blocks in pre-order of the dominator tree. This order
- // ensures that all bases of a candidate are in Candidates when we process it.
- for (auto Node = GraphTraits<DominatorTree *>::nodes_begin(DT);
- Node != GraphTraits<DominatorTree *>::nodes_end(DT); ++Node) {
- BasicBlock *BB = (*Node)->getBlock();
+ // Process the basic blocks in a depth first traversal of the dominator
+ // tree. This order ensures that all bases of a candidate are in Candidates
+ // when we process it.
+ for (const auto Node : depth_first(DT)) {
+ BasicBlock *BB = Node->getBlock();
for (auto I = BB->begin(); I != BB->end(); ++I) {
if (SE->isSCEVable(I->getType()) && isPotentiallyNaryReassociable(&*I)) {
const SCEV *OldSCEV = SE->getSCEV(&*I);
OpenPOWER on IntegriCloud