diff options
Diffstat (limited to 'compiler/optimizing/liveness_test.cc')
-rw-r--r-- | compiler/optimizing/liveness_test.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/compiler/optimizing/liveness_test.cc b/compiler/optimizing/liveness_test.cc index 84b2e33ee7..2d861696bb 100644 --- a/compiler/optimizing/liveness_test.cc +++ b/compiler/optimizing/liveness_test.cc @@ -546,4 +546,51 @@ TEST(LivenessTest, Loop7) { TestCode(data, expected); } +TEST(LivenessTest, Loop8) { + // var a = 0; + // while (a == a) { + // a = a + a; + // } + // return a; + // + // We want to test that the ins of the loop exit + // does contain the phi. + // Bitsets are made of: + // (constant0, phi, add) + const char* expected = + "Block 0\n" + " live in: (000)\n" + " live out: (100)\n" + " kill: (100)\n" + "Block 1\n" // pre loop header + " live in: (100)\n" + " live out: (000)\n" + " kill: (000)\n" + "Block 2\n" // loop header + " live in: (000)\n" + " live out: (010)\n" + " kill: (010)\n" + "Block 3\n" // back edge + " live in: (010)\n" + " live out: (000)\n" + " kill: (001)\n" + "Block 4\n" // return block + " live in: (010)\n" + " live out: (000)\n" + " kill: (000)\n" + "Block 5\n" // exit block + " live in: (000)\n" + " live out: (000)\n" + " kill: (000)\n"; + + const uint16_t data[] = ONE_REGISTER_CODE_ITEM( + Instruction::CONST_4 | 0 | 0, + Instruction::IF_EQ, 6, + Instruction::ADD_INT, 0, 0, + Instruction::GOTO | 0xFB00, + Instruction::RETURN | 0 << 8); + + TestCode(data, expected); +} + } // namespace art |