From 7f4aff6705f46f411874b5ca8c4856b8ed5bfb13 Mon Sep 17 00:00:00 2001 From: Artem Serov Date: Wed, 21 Jun 2017 17:02:18 +0100 Subject: ART: Implement SuperblockCloner. SuperblockCloner provides a feature of cloning subgraphs in a smart, high level way without fine grain manipulation with IR; data flow and graph properties are resolved/adjusted automatically. The clone transformation is defined by specifying a set of basic blocks to copy and a set of rules how to treat edges, remap their successors. By using this approach such optimizations as Branch Target Expansion, Loop Peeling, Loop Unrolling can be implemented. Test: superblock_cloner_test.cc. Change-Id: Ibeede38195376ca35f44ba9015491e50b3a5b87e --- compiler/optimizing/nodes.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 727431a493..91e475d737 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -865,6 +865,15 @@ void HLoopInformation::Populate() { graph->SetHasLoops(true); } +void HLoopInformation::PopulateInnerLoopUpwards(HLoopInformation* inner_loop) { + DCHECK(inner_loop->GetPreHeader()->GetLoopInformation() == this); + blocks_.Union(&inner_loop->blocks_); + HLoopInformation* outer_loop = GetPreHeader()->GetLoopInformation(); + if (outer_loop != nullptr) { + outer_loop->PopulateInnerLoopUpwards(this); + } +} + HBasicBlock* HLoopInformation::GetPreHeader() const { HBasicBlock* block = header_->GetPredecessors()[0]; DCHECK(irreducible_ || (block == header_->GetDominator())); -- cgit v1.2.3-59-g8ed1b