From 8ddb00ca935733f5d3b07816e5bb33d6cabe6ec4 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Mon, 29 Sep 2014 12:00:40 +0100 Subject: Improve detection of lifetime holes. The check concluding that the next use was in a successor was too conservative: two blocks following each other in terms of liveness are not necessarily predecessor/sucessor. Change-Id: Ideec98046c812aa5fb63781141b5fde24c706d6d --- compiler/optimizing/liveness_test.cc | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'compiler/optimizing/liveness_test.cc') 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 -- cgit v1.2.3-59-g8ed1b