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 | |
Vladimir Marko | ca6fff8 | 2017-10-03 14:49:14 +0100 | [diff] [blame] | 27 | class OptimizerTest : public OptimizingUnitTest { |
| 28 | protected: |
| 29 | void TestCode(const uint16_t* data, const uint32_t* blocks, size_t blocks_length); |
| 30 | }; |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 31 | |
Vladimir Marko | ca6fff8 | 2017-10-03 14:49:14 +0100 | [diff] [blame] | 32 | void OptimizerTest::TestCode(const uint16_t* data, const uint32_t* blocks, size_t blocks_length) { |
| 33 | HGraph* graph = CreateCFG(data); |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 34 | ASSERT_EQ(graph->GetBlocks().size(), blocks_length); |
Nicolas Geoffray | 804d093 | 2014-05-02 08:46:00 +0100 | [diff] [blame] | 35 | for (size_t i = 0, e = blocks_length; i < e; ++i) { |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 36 | if (blocks[i] == kInvalidBlockId) { |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 37 | if (graph->GetBlocks()[i] == nullptr) { |
Nicolas Geoffray | f776b92 | 2015-04-15 18:22:45 +0100 | [diff] [blame] | 38 | // Dead block. |
| 39 | } else { |
| 40 | // Only the entry block has no dominator. |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 41 | ASSERT_EQ(nullptr, graph->GetBlocks()[i]->GetDominator()); |
| 42 | ASSERT_TRUE(graph->GetBlocks()[i]->IsEntryBlock()); |
Nicolas Geoffray | f776b92 | 2015-04-15 18:22:45 +0100 | [diff] [blame] | 43 | } |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 44 | } else { |
Vladimir Marko | ec7802a | 2015-10-01 20:57:57 +0100 | [diff] [blame] | 45 | ASSERT_NE(nullptr, graph->GetBlocks()[i]->GetDominator()); |
| 46 | ASSERT_EQ(blocks[i], graph->GetBlocks()[i]->GetDominator()->GetBlockId()); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 51 | TEST_F(OptimizerTest, ReturnVoid) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 52 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
| 53 | Instruction::RETURN_VOID); // Block number 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 54 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 55 | const uint32_t dominators[] = { |
| 56 | kInvalidBlockId, |
| 57 | 0, |
| 58 | 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 61 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 62 | } |
| 63 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 64 | TEST_F(OptimizerTest, CFG1) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 65 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 66 | Instruction::GOTO | 0x100, // Block number 1 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 67 | Instruction::RETURN_VOID); // Block number 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 68 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 69 | const uint32_t dominators[] = { |
| 70 | kInvalidBlockId, |
| 71 | 0, |
| 72 | 1, |
| 73 | 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 74 | }; |
| 75 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 76 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 77 | } |
| 78 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 79 | TEST_F(OptimizerTest, CFG2) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 80 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 81 | Instruction::GOTO | 0x100, // Block number 1 |
| 82 | Instruction::GOTO | 0x100, // Block number 2 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 83 | Instruction::RETURN_VOID); // Block number 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 84 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 85 | const uint32_t dominators[] = { |
| 86 | kInvalidBlockId, |
| 87 | 0, |
| 88 | 1, |
| 89 | 2, |
| 90 | 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 93 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 94 | } |
| 95 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 96 | TEST_F(OptimizerTest, CFG3) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 97 | const uint16_t data1[] = ZERO_REGISTER_CODE_ITEM( |
| 98 | Instruction::GOTO | 0x200, // Block number 1 |
| 99 | Instruction::RETURN_VOID, // Block number 2 |
| 100 | Instruction::GOTO | 0xFF00); // Block number 3 |
| 101 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 102 | const uint32_t dominators[] = { |
| 103 | kInvalidBlockId, |
| 104 | 0, |
| 105 | 3, |
| 106 | 1, |
| 107 | 2 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 108 | }; |
| 109 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 110 | TestCode(data1, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 111 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 112 | const uint16_t data2[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 113 | Instruction::GOTO_16, 3, |
| 114 | Instruction::RETURN_VOID, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 115 | Instruction::GOTO_16, 0xFFFF); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 116 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 117 | TestCode(data2, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 118 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 119 | const uint16_t data3[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 120 | Instruction::GOTO_32, 4, 0, |
| 121 | Instruction::RETURN_VOID, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 122 | Instruction::GOTO_32, 0xFFFF, 0xFFFF); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 123 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 124 | TestCode(data3, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 125 | } |
| 126 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 127 | TEST_F(OptimizerTest, CFG4) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 128 | const uint16_t data1[] = ZERO_REGISTER_CODE_ITEM( |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 129 | Instruction::NOP, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 130 | Instruction::GOTO | 0xFF00); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 131 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 132 | const uint32_t dominators[] = { |
| 133 | kInvalidBlockId, |
Nicolas Geoffray | 788f2f0 | 2016-01-22 12:41:38 +0000 | [diff] [blame] | 134 | 3, |
| 135 | kInvalidBlockId, |
| 136 | 0 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 137 | }; |
| 138 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 139 | TestCode(data1, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 140 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 141 | const uint16_t data2[] = ZERO_REGISTER_CODE_ITEM( |
| 142 | Instruction::GOTO_32, 0, 0); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 143 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 144 | TestCode(data2, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 145 | } |
| 146 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 147 | TEST_F(OptimizerTest, CFG5) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 148 | const uint16_t data[] = ZERO_REGISTER_CODE_ITEM( |
| 149 | Instruction::RETURN_VOID, // Block number 1 |
| 150 | Instruction::GOTO | 0x100, // Dead block |
| 151 | Instruction::GOTO | 0xFE00); // Block number 2 |
| 152 | |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 153 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 154 | const uint32_t dominators[] = { |
| 155 | kInvalidBlockId, |
| 156 | 0, |
| 157 | kInvalidBlockId, |
| 158 | 1 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 159 | }; |
| 160 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 161 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 162 | } |
| 163 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 164 | TEST_F(OptimizerTest, CFG6) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 165 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 166 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 167 | Instruction::IF_EQ, 3, |
| 168 | Instruction::GOTO | 0x100, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 169 | Instruction::RETURN_VOID); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 170 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 171 | const uint32_t dominators[] = { |
| 172 | kInvalidBlockId, |
| 173 | 0, |
| 174 | 1, |
| 175 | 1, |
| 176 | 3, |
| 177 | 1, // Synthesized block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 178 | }; |
| 179 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 180 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 181 | } |
| 182 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 183 | TEST_F(OptimizerTest, CFG7) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 184 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 185 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 186 | Instruction::IF_EQ, 3, // Block number 1 |
| 187 | Instruction::GOTO | 0x100, // Block number 2 |
| 188 | Instruction::GOTO | 0xFF00); // Block number 3 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 189 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 190 | const uint32_t dominators[] = { |
| 191 | kInvalidBlockId, |
| 192 | 0, |
| 193 | 1, |
| 194 | 1, |
| 195 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 196 | 1, // block to avoid critical edge. |
| 197 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 198 | }; |
| 199 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 200 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 201 | } |
| 202 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 203 | TEST_F(OptimizerTest, CFG8) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 204 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 205 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 206 | Instruction::IF_EQ, 3, // Block number 1 |
| 207 | Instruction::GOTO | 0x200, // Block number 2 |
| 208 | Instruction::GOTO | 0x100, // Block number 3 |
| 209 | Instruction::GOTO | 0xFF00); // Block number 4 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 210 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 211 | const uint32_t dominators[] = { |
| 212 | kInvalidBlockId, |
| 213 | 0, |
| 214 | 1, |
| 215 | 1, |
| 216 | 1, |
| 217 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 218 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 219 | }; |
| 220 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 221 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 222 | } |
| 223 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 224 | TEST_F(OptimizerTest, CFG9) { |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 225 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 226 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 227 | Instruction::IF_EQ, 3, // Block number 1 |
| 228 | Instruction::GOTO | 0x200, // Block number 2 |
| 229 | Instruction::GOTO | 0x100, // Block number 3 |
| 230 | Instruction::GOTO | 0xFE00); // Block number 4 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 231 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 232 | const uint32_t dominators[] = { |
| 233 | kInvalidBlockId, |
| 234 | 0, |
| 235 | 1, |
| 236 | 1, |
| 237 | 1, |
| 238 | kInvalidBlockId, // exit block is not dominated by any block due to the spin loop. |
| 239 | 1 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 240 | }; |
| 241 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 242 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 243 | } |
| 244 | |
David Brazdil | badd826 | 2016-02-02 16:28:56 +0000 | [diff] [blame] | 245 | TEST_F(OptimizerTest, CFG10) { |
Nicolas Geoffray | 788aaad | 2014-03-10 12:00:43 +0000 | [diff] [blame] | 246 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
| 247 | Instruction::CONST_4 | 0 | 0, |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 248 | Instruction::IF_EQ, 6, // Block number 1 |
| 249 | Instruction::IF_EQ, 3, // Block number 2 |
| 250 | Instruction::GOTO | 0x100, // Block number 3 |
| 251 | Instruction::GOTO | 0x100, // Block number 4 |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 252 | Instruction::RETURN_VOID); // Block number 5 |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 253 | |
Vladimir Marko | fa6b93c | 2015-09-15 10:15:55 +0100 | [diff] [blame] | 254 | const uint32_t dominators[] = { |
| 255 | kInvalidBlockId, |
| 256 | 0, |
| 257 | 1, |
| 258 | 2, |
| 259 | 2, |
| 260 | 1, |
| 261 | 5, // Block number 5 dominates exit block |
| 262 | 1, // block to avoid critical edge. |
| 263 | 2 // block to avoid critical edge. |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 264 | }; |
| 265 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 266 | TestCode(data, dominators, sizeof(dominators) / sizeof(int)); |
Nicolas Geoffray | be9a92a | 2014-02-25 14:22:56 +0000 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | } // namespace art |