Stop populating irreducible loop at header
Recent CL modified the (previously exponential) algorithm for
populating irreducible loops so as to not visit blocks multiple times.
However, the new condition for an early exit did not take into account
that it is not necessary to visit predecessors of the loop header.
The algorithm remains correct but does unnecessary work.
Bug: 27856014
Change-Id: If72f8be82e79838f0dd9678082a3bbaabb51e43b
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 6703695..679c274 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -609,6 +609,9 @@
graph->GetBlocks().size(),
/* expandable */ false,
kArenaAllocGraphBuilder);
+ // Stop marking blocks at the loop header.
+ visited.SetBit(header_->GetBlockId());
+
for (HBasicBlock* back_edge : GetBackEdges()) {
PopulateIrreducibleRecursive(back_edge, &visited);
}