From 5a620590e5cf6d6817693edffd661371555de88b Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Thu, 5 May 2016 11:27:03 +0100 Subject: 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 --- compiler/optimizing/nodes.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 6703695484..679c274e62 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -609,6 +609,9 @@ void HLoopInformation::Populate() { 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); } -- cgit v1.2.3-59-g8ed1b