summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2014-09-23 10:50:22 +0100
committerRoland Levillain <rpl@google.com>2014-09-23 10:50:22 +0100
commit7e53b415e5e587cd7961978f6da7347248f40b29 (patch)
tree383d8ab17f50abcc501410ba3b33600ec1a66d26 /compiler/optimizing
parent6b879ddc0959df1cec871f0d41f11cce35a11716 (diff)
downloadart-7e53b415e5e587cd7961978f6da7347248f40b29.zip
art-7e53b415e5e587cd7961978f6da7347248f40b29.tar.gz
art-7e53b415e5e587cd7961978f6da7347248f40b29.tar.bz2
Optimizing compiler: ensure loop header dominates loop's blocks.
Change-Id: I6b2f1fdaac9f91dc5d9901cc2ad4c83745e90e70
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/graph_checker.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index b05090b..e36b1cd 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -20,6 +20,8 @@
#include <map>
#include <sstream>
+#include "base/bit_vector-inl.h"
+
namespace art {
void GraphChecker::VisitBasicBlock(HBasicBlock* block) {
@@ -212,6 +214,19 @@ void SSAChecker::CheckLoop(HBasicBlock* loop_header) {
<< num_back_edges << " back edge(s).";
errors_.Insert(error.str());
}
+
+ // Ensure all blocks in the loop are dominated by the loop header.
+ const ArenaBitVector& loop_blocks =
+ loop_header->GetLoopInformation()->GetBlocks();
+ for (uint32_t i : loop_blocks.Indexes()) {
+ HBasicBlock* loop_block = GetGraph()->GetBlocks().Get(i);
+ if (!loop_header->Dominates(loop_block)) {
+ std::stringstream error;
+ error << "Loop block " << loop_block->GetBlockId()
+ << " not dominated by loop header " << id;
+ errors_.Insert(error.str());
+ }
+ }
}
void SSAChecker::VisitInstruction(HInstruction* instruction) {