diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-06-06 11:24:33 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-06-09 08:59:02 +0100 |
commit | ec7e4727e99aa1416398ac5a684f5024817a25c7 (patch) | |
tree | 3ad51887c890b5cbebf1ae8e4afec8d93b485168 /compiler/optimizing/live_ranges_test.cc | |
parent | 7a6b77f9a694ea4569fbf44493fdcaeea237a8be (diff) | |
download | art-ec7e4727e99aa1416398ac5a684f5024817a25c7.zip art-ec7e4727e99aa1416398ac5a684f5024817a25c7.tar.gz art-ec7e4727e99aa1416398ac5a684f5024817a25c7.tar.bz2 |
Fix some bugs in graph construction/simplification methods.
Also fix a brano during SSA construction. The code should
not have been commented out. Added a test to cover what the code
intends.
Change-Id: Ia00ae79dcf75eb0d412f07649d73e7f94dbfb6f0
Diffstat (limited to 'compiler/optimizing/live_ranges_test.cc')
-rw-r--r-- | compiler/optimizing/live_ranges_test.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc index c797497..017117a 100644 --- a/compiler/optimizing/live_ranges_test.cc +++ b/compiler/optimizing/live_ranges_test.cc @@ -152,22 +152,22 @@ TEST(LiveRangesTest, CFG3) { SsaLivenessAnalysis liveness(*graph); liveness.Analyze(); - // Test for the 0 constant. - LiveInterval* interval = liveness.GetInstructionFromSsaIndex(0)->GetLiveInterval(); + // Test for the 4 constant. + LiveInterval* interval = liveness.GetInstructionFromSsaIndex(1)->GetLiveInterval(); LiveRange* range = interval->GetFirstRange(); - ASSERT_EQ(2u, range->GetStart()); + ASSERT_EQ(4u, range->GetStart()); // Last use is the phi at the return block so instruction is live until // the end of the then block. ASSERT_EQ(18u, range->GetEnd()); ASSERT_TRUE(range->GetNext() == nullptr); - // Test for the 4 constant. - interval = liveness.GetInstructionFromSsaIndex(1)->GetLiveInterval(); + // Test for the 0 constant. + interval = liveness.GetInstructionFromSsaIndex(0)->GetLiveInterval(); // The then branch is a hole for this constant, therefore its interval has 2 ranges. // First range starts from the definition and ends at the if block. range = interval->GetFirstRange(); - ASSERT_EQ(4u, range->GetStart()); - // 9 is the end of the if block. + ASSERT_EQ(2u, range->GetStart()); + // 14 is the end of the if block. ASSERT_EQ(14u, range->GetEnd()); // Second range is the else block. range = range->GetNext(); @@ -179,6 +179,7 @@ TEST(LiveRangesTest, CFG3) { // Test for the phi. interval = liveness.GetInstructionFromSsaIndex(3)->GetLiveInterval(); range = interval->GetFirstRange(); + ASSERT_EQ(22u, liveness.GetInstructionFromSsaIndex(3)->GetLifetimePosition()); ASSERT_EQ(22u, range->GetStart()); ASSERT_EQ(24u, range->GetEnd()); ASSERT_TRUE(range->GetNext() == nullptr); |