summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-03-24 19:24:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-24 19:24:10 +0000
commitebfd062af849a915bd75eebd81c6fdea15b1d8d5 (patch)
tree9f53251569ed32af7add31cf16206f255261b97e /compiler/optimizing
parent3e690d11d26b3ae3891a03cdef88e7c2272109f5 (diff)
parent10f56cb6b4e39ed0032e9a23b179b557463e65ad (diff)
downloadandroid_art-ebfd062af849a915bd75eebd81c6fdea15b1d8d5.tar.gz
android_art-ebfd062af849a915bd75eebd81c6fdea15b1d8d5.tar.bz2
android_art-ebfd062af849a915bd75eebd81c6fdea15b1d8d5.zip
Merge "ART: Fix crash in gtests"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/codegen_test.cc1
-rw-r--r--compiler/optimizing/nodes.h10
-rw-r--r--compiler/optimizing/register_allocator_test.cc6
3 files changed, 15 insertions, 2 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index 868fc5b867..40f0adc63d 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -145,6 +145,7 @@ static void RunCodeOptimized(CodeGenerator* codegen,
std::function<void(HGraph*)> hook_before_codegen,
bool has_result,
Expected expected) {
+ graph->BuildDominatorTree();
SsaLivenessAnalysis liveness(*graph, codegen);
liveness.Analyze();
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 97ade0dc62..db7873b14e 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -3483,7 +3483,10 @@ class HInsertionOrderIterator : public ValueObject {
class HReversePostOrderIterator : public ValueObject {
public:
- explicit HReversePostOrderIterator(const HGraph& graph) : graph_(graph), index_(0) {}
+ explicit HReversePostOrderIterator(const HGraph& graph) : graph_(graph), index_(0) {
+ // Check that reverse post order of the graph has been built.
+ DCHECK(!graph.GetReversePostOrder().IsEmpty());
+ }
bool Done() const { return index_ == graph_.GetReversePostOrder().Size(); }
HBasicBlock* Current() const { return graph_.GetReversePostOrder().Get(index_); }
@@ -3499,7 +3502,10 @@ class HReversePostOrderIterator : public ValueObject {
class HPostOrderIterator : public ValueObject {
public:
explicit HPostOrderIterator(const HGraph& graph)
- : graph_(graph), index_(graph_.GetReversePostOrder().Size()) {}
+ : graph_(graph), index_(graph_.GetReversePostOrder().Size()) {
+ // Check that reverse post order of the graph has been built.
+ DCHECK(!graph.GetReversePostOrder().IsEmpty());
+ }
bool Done() const { return index_ == 0; }
HBasicBlock* Current() const { return graph_.GetReversePostOrder().Get(index_ - 1); }
diff --git a/compiler/optimizing/register_allocator_test.cc b/compiler/optimizing/register_allocator_test.cc
index b757a3b9b9..7a2d84b056 100644
--- a/compiler/optimizing/register_allocator_test.cc
+++ b/compiler/optimizing/register_allocator_test.cc
@@ -596,6 +596,8 @@ static HGraph* BuildFieldReturn(ArenaAllocator* allocator,
graph->AddBlock(exit);
block->AddSuccessor(exit);
exit->AddInstruction(new (allocator) HExit());
+
+ graph->BuildDominatorTree();
return graph;
}
@@ -658,6 +660,8 @@ static HGraph* BuildTwoSubs(ArenaAllocator* allocator,
block->AddInstruction(*second_sub);
block->AddInstruction(new (allocator) HExit());
+
+ graph->BuildDominatorTree();
return graph;
}
@@ -719,6 +723,8 @@ static HGraph* BuildDiv(ArenaAllocator* allocator,
block->AddInstruction(*div);
block->AddInstruction(new (allocator) HExit());
+
+ graph->BuildDominatorTree();
return graph;
}