summaryrefslogtreecommitdiff
path: root/compiler/optimizing/dominator_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/dominator_test.cc')
-rw-r--r--compiler/optimizing/dominator_test.cc158
1 files changed, 79 insertions, 79 deletions
diff --git a/compiler/optimizing/dominator_test.cc b/compiler/optimizing/dominator_test.cc
index 78ae1dd960..6b186508cd 100644
--- a/compiler/optimizing/dominator_test.cc
+++ b/compiler/optimizing/dominator_test.cc
@@ -24,7 +24,7 @@
namespace art {
-static void TestCode(const uint16_t* data, const int* blocks, size_t blocks_length) {
+static void TestCode(const uint16_t* data, const uint32_t* blocks, size_t blocks_length) {
ArenaPool pool;
ArenaAllocator allocator(&pool);
HGraph* graph = CreateGraph(&allocator);
@@ -33,19 +33,19 @@ static void TestCode(const uint16_t* data, const int* blocks, size_t blocks_leng
bool graph_built = builder.BuildGraph(*item);
ASSERT_TRUE(graph_built);
graph->BuildDominatorTree();
- ASSERT_EQ(graph->GetBlocks().Size(), blocks_length);
+ ASSERT_EQ(graph->GetBlocks().size(), blocks_length);
for (size_t i = 0, e = blocks_length; i < e; ++i) {
- if (blocks[i] == -1) {
- if (graph->GetBlocks().Get(i) == nullptr) {
+ if (blocks[i] == kInvalidBlockId) {
+ if (graph->GetBlock(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());
+ ASSERT_EQ(nullptr, graph->GetBlock(i)->GetDominator());
+ ASSERT_TRUE(graph->GetBlock(i)->IsEntryBlock());
}
} else {
- ASSERT_NE(nullptr, graph->GetBlocks().Get(i)->GetDominator());
- ASSERT_EQ(blocks[i], graph->GetBlocks().Get(i)->GetDominator()->GetBlockId());
+ ASSERT_NE(nullptr, graph->GetBlock(i)->GetDominator());
+ ASSERT_EQ(blocks[i], graph->GetBlock(i)->GetDominator()->GetBlockId());
}
}
}
@@ -54,10 +54,10 @@ TEST(OptimizerTest, ReturnVoid) {
const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(
Instruction::RETURN_VOID); // Block number 1
- const int dominators[] = {
- -1,
- 0,
- 1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -68,11 +68,11 @@ TEST(OptimizerTest, CFG1) {
Instruction::GOTO | 0x100, // Block number 1
Instruction::RETURN_VOID); // Block number 2
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -84,12 +84,12 @@ TEST(OptimizerTest, CFG2) {
Instruction::GOTO | 0x100, // Block number 2
Instruction::RETURN_VOID); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2,
- 3
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2,
+ 3
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -101,12 +101,12 @@ TEST(OptimizerTest, CFG3) {
Instruction::RETURN_VOID, // Block number 2
Instruction::GOTO | 0xFF00); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 3,
- 1,
- 2
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 3,
+ 1,
+ 2
};
TestCode(data1, dominators, sizeof(dominators) / sizeof(int));
@@ -131,10 +131,10 @@ TEST(OptimizerTest, CFG4) {
Instruction::NOP,
Instruction::GOTO | 0xFF00);
- const int dominators[] = {
- -1,
- 0,
- -1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ kInvalidBlockId
};
TestCode(data1, dominators, sizeof(dominators) / sizeof(int));
@@ -152,11 +152,11 @@ TEST(OptimizerTest, CFG5) {
Instruction::GOTO | 0xFE00); // Block number 2
- const int dominators[] = {
- -1,
- 0,
- -1,
- 1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ kInvalidBlockId,
+ 1
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -169,13 +169,13 @@ TEST(OptimizerTest, CFG6) {
Instruction::GOTO | 0x100,
Instruction::RETURN_VOID);
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 3,
- 1, // Synthesized block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 3,
+ 1, // Synthesized block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -188,14 +188,14 @@ TEST(OptimizerTest, CFG7) {
Instruction::GOTO | 0x100, // Block number 2
Instruction::GOTO | 0xFF00); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1, // block to avoid critical edge.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1, // block to avoid critical edge.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -209,14 +209,14 @@ TEST(OptimizerTest, CFG8) {
Instruction::GOTO | 0x100, // Block number 3
Instruction::GOTO | 0xFF00); // Block number 4
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -230,14 +230,14 @@ TEST(OptimizerTest, CFG9) {
Instruction::GOTO | 0x100, // Block number 3
Instruction::GOTO | 0xFE00); // Block number 4
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -252,16 +252,16 @@ TEST(OptimizerTest, CFG10) {
Instruction::GOTO | 0x100, // Block number 4
Instruction::RETURN_VOID); // Block number 5
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2,
- 2,
- 1,
- 5, // Block number 5 dominates exit block
- 1, // block to avoid critical edge.
- 2 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2,
+ 2,
+ 1,
+ 5, // Block number 5 dominates exit block
+ 1, // block to avoid critical edge.
+ 2 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));