Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Mathieu Chartier | b666f48 | 2015-02-18 14:33:14 -0800 | [diff] [blame] | 17 | #include "base/arena_allocator.h" |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 18 | #include "builder.h" |
| 19 | #include "dex_instruction.h" |
| 20 | #include "nodes.h" |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 21 | #include "optimizing_unit_test.h" |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 22 | |
| 23 | #include "gtest/gtest.h" |
| 24 | |
| 25 | namespace art { |
| 26 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 27 | class OptimizerTest : public CommonCompilerTest {}; |
| 28 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 29 | static void TestCode(const uint16_t* data, const uint32_t* blocks, size_t blocks_length) { |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 30 | ArenaPool pool; |
| 31 | ArenaAllocator allocator(&pool); |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 32 | HGraph* graph = CreateCFG(&allocator, data); |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 33 | ASSERT_EQ(graph->GetBlocks().size(), blocks_length); |
Nicolas Geoffray | 804d093 | 2014-05-02 08:46:00 +0100 | [diff] [blame] | 34 | for (size_t i = 0, e = blocks_length; i < e; ++i) { |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 35 | if (blocks[i] == kInvalidBlockId) { |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 36 | if (graph->GetBlocks()[i] == nullptr) { |
Nicolas Geoffray | f776b92 | 2015-04-15 18:22:45 +0100 | [diff] [blame] | 37 | // Dead block. |
| 38 | } else { |
| 39 | // Only the entry block has no dominator. |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 40 | ASSERT_EQ(nullptr, graph->GetBlocks()[i]->GetDominator()); |
| 41 | ASSERT_TRUE(graph->GetBlocks()[i]->IsEntryBlock()); |
Nicolas Geoffray | f776b92 | 2015-04-15 18:22:45 +0100 | [diff] [blame] | 42 | } |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 43 | } else { |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 44 | ASSERT_NE(nullptr, graph->GetBlocks()[i]->GetDominator()); |
| 45 | ASSERT_EQ(blocks[i], graph->GetBlocks()[i]->GetDominator()->GetBlockId()); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 50 | TEST_F(OptimizerTest, ReturnVoid) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 51 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
| 52 | Instruction::RETURN_VOID); // Block number 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 53 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 54 | const uint32_t dominators[] = { |
| 55 | kInvalidBlockId, |
| 56 | 0, |
| 57 | 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 58 | }; |
| 59 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 60 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 61 | } |
| 62 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 63 | TEST_F(OptimizerTest, CFG1) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 64 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 65 | Instruction::GOTO | 0x100, // Block number 1 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 66 | Instruction::RETURN_VOID); // Block number 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 67 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 68 | const uint32_t dominators[] = { |
| 69 | kInvalidBlockId, |
| 70 | 0, |
| 71 | 1, |
| 72 | 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 73 | }; |
| 74 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 75 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 76 | } |
| 77 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 78 | TEST_F(OptimizerTest, CFG2) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 79 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 80 | Instruction::GOTO | 0x100, // Block number 1 |
| 81 | Instruction::GOTO | 0x100, // Block number 2 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 82 | Instruction::RETURN_VOID); // Block number 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 83 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 84 | const uint32_t dominators[] = { |
| 85 | kInvalidBlockId, |
| 86 | 0, |
| 87 | 1, |
| 88 | 2, |
| 89 | 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 92 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 93 | } |
| 94 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 95 | TEST_F(OptimizerTest, CFG3) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 96 | const uint16_t data1[] = ZERO_REGISTER_CODE_ITEM( |
| 97 | Instruction::GOTO | 0x200, // Block number 1 |
| 98 | Instruction::RETURN_VOID, // Block number 2 |
| 99 | Instruction::GOTO | 0xFF00); // Block number 3 |
| 100 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 101 | const uint32_t dominators[] = { |
| 102 | kInvalidBlockId, |
| 103 | 0, |
| 104 | 3, |
| 105 | 1, |
| 106 | 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 107 | }; |
| 108 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 109 | TestCode(data1, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 110 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 111 | const uint16_t data2[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 112 | Instruction::GOTO_16, 3, |
| 113 | Instruction::RETURN_VOID, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 114 | Instruction::GOTO_16, 0xFFFF); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 115 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 116 | TestCode(data2, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 117 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 118 | const uint16_t data3[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 119 | Instruction::GOTO_32, 4, 0, |
| 120 | Instruction::RETURN_VOID, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 121 | Instruction::GOTO_32, 0xFFFF, 0xFFFF); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 122 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 123 | TestCode(data3, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 124 | } |
| 125 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 126 | TEST_F(OptimizerTest, CFG4) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 127 | const uint16_t data1[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 128 | Instruction::NOP, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 129 | Instruction::GOTO | 0xFF00); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 130 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 131 | const uint32_t dominators[] = { |
| 132 | kInvalidBlockId, |
Nicolas Geoffray | 788f2f0 | 2016-01-22 12:41:38 +0000 | [diff] [blame] | 133 | 3, |
| 134 | kInvalidBlockId, |
| 135 | 0 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 136 | }; |
| 137 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 138 | TestCode(data1, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 139 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 140 | const uint16_t data2[] = ZERO_REGISTER_CODE_ITEM( |
| 141 | Instruction::GOTO_32, 0, 0); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 142 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 143 | TestCode(data2, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 144 | } |
| 145 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 146 | TEST_F(OptimizerTest, CFG5) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 147 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
| 148 | Instruction::RETURN_VOID, // Block number 1 |
| 149 | Instruction::GOTO | 0x100, // Dead block |
| 150 | Instruction::GOTO | 0xFE00); // Block number 2 |
| 151 | |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 152 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 153 | const uint32_t dominators[] = { |
| 154 | kInvalidBlockId, |
| 155 | 0, |
| 156 | kInvalidBlockId, |
| 157 | 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 160 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 161 | } |
| 162 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 163 | TEST_F(OptimizerTest, CFG6) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 164 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 165 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 166 | Instruction::IF_EQ, 3, |
| 167 | Instruction::GOTO | 0x100, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 168 | Instruction::RETURN_VOID); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 169 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 170 | const uint32_t dominators[] = { |
| 171 | kInvalidBlockId, |
| 172 | 0, |
| 173 | 1, |
| 174 | 1, |
| 175 | 3, |
| 176 | 1, // Synthesized block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 177 | }; |
| 178 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 179 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 180 | } |
| 181 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 182 | TEST_F(OptimizerTest, CFG7) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 183 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 184 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 185 | Instruction::IF_EQ, 3, // Block number 1 |
| 186 | Instruction::GOTO | 0x100, // Block number 2 |
| 187 | Instruction::GOTO | 0xFF00); // Block number 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 188 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 189 | const uint32_t dominators[] = { |
| 190 | kInvalidBlockId, |
| 191 | 0, |
| 192 | 1, |
| 193 | 1, |
| 194 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 195 | 1, // block to avoid critical edge. |
| 196 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 197 | }; |
| 198 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 199 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 200 | } |
| 201 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 202 | TEST_F(OptimizerTest, CFG8) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 203 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 204 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 205 | Instruction::IF_EQ, 3, // Block number 1 |
| 206 | Instruction::GOTO | 0x200, // Block number 2 |
| 207 | Instruction::GOTO | 0x100, // Block number 3 |
| 208 | Instruction::GOTO | 0xFF00); // Block number 4 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 209 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 210 | const uint32_t dominators[] = { |
| 211 | kInvalidBlockId, |
| 212 | 0, |
| 213 | 1, |
| 214 | 1, |
| 215 | 1, |
| 216 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 217 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 218 | }; |
| 219 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 220 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 221 | } |
| 222 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 223 | TEST_F(OptimizerTest, CFG9) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 224 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 225 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 226 | Instruction::IF_EQ, 3, // Block number 1 |
| 227 | Instruction::GOTO | 0x200, // Block number 2 |
| 228 | Instruction::GOTO | 0x100, // Block number 3 |
| 229 | Instruction::GOTO | 0xFE00); // Block number 4 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 230 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 231 | const uint32_t dominators[] = { |
| 232 | kInvalidBlockId, |
| 233 | 0, |
| 234 | 1, |
| 235 | 1, |
| 236 | 1, |
| 237 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 238 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 239 | }; |
| 240 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 241 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 242 | } |
| 243 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 244 | TEST_F(OptimizerTest, CFG10) { |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 245 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
| 246 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 247 | Instruction::IF_EQ, 6, // Block number 1 |
| 248 | Instruction::IF_EQ, 3, // Block number 2 |
| 249 | Instruction::GOTO | 0x100, // Block number 3 |
| 250 | Instruction::GOTO | 0x100, // Block number 4 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 251 | Instruction::RETURN_VOID); // Block number 5 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 252 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 253 | const uint32_t dominators[] = { |
| 254 | kInvalidBlockId, |
| 255 | 0, |
| 256 | 1, |
| 257 | 2, |
| 258 | 2, |
| 259 | 1, |
| 260 | 5, // Block number 5 dominates exit block |
| 261 | 1, // block to avoid critical edge. |
| 262 | 2 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 265 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | } // namespace art |