summaryrefslogtreecommitdiff
path: root/compiler/optimizing/dominator_test.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-04-15 18:22:45 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-04-15 21:51:12 +0100
commitf776b92a0d52bb522043812dacb9c21ac11858e2 (patch)
tree619ae49853b201fc4ea9d0ac4b113c6226e3c339 /compiler/optimizing/dominator_test.cc
parentacf9b7b7616a9b104e6f2146051d8e14d9cb9030 (diff)
Remove dead blocks for the blocks_ array.
This prevents crashing because of structurally incorrect blocks. Also we now don't need to remove its instructions. Test case courtesy of Serguei I Katkov. Change-Id: Ia3ef9580549fc3546e8cd5f346079b1f0ceb2a61
Diffstat (limited to 'compiler/optimizing/dominator_test.cc')
-rw-r--r--compiler/optimizing/dominator_test.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/optimizing/dominator_test.cc b/compiler/optimizing/dominator_test.cc
index 7623e421fd..61a7697301 100644
--- a/compiler/optimizing/dominator_test.cc
+++ b/compiler/optimizing/dominator_test.cc
@@ -36,7 +36,13 @@ static void TestCode(const uint16_t* data, const int* blocks, size_t blocks_leng
ASSERT_EQ(graph->GetBlocks().Size(), blocks_length);
for (size_t i = 0, e = blocks_length; i < e; ++i) {
if (blocks[i] == -1) {
- ASSERT_EQ(nullptr, graph->GetBlocks().Get(i)->GetDominator());
+ if (graph->GetBlocks().Get(i) == nullptr) {
+ // Dead block.
+ } else {
+ // Only the entry block has no dominator.
+ ASSERT_EQ(nullptr, graph->GetBlocks().Get(i)->GetDominator());
+ ASSERT_TRUE(graph->GetBlocks().Get(i)->IsEntryBlock());
+ }
} else {
ASSERT_NE(nullptr, graph->GetBlocks().Get(i)->GetDominator());
ASSERT_EQ(blocks[i], graph->GetBlocks().Get(i)->GetDominator()->GetBlockId());