OSDN Git Service

Fix gtest by adding fake lifetime positions.
authorNicolas Geoffray <ngeoffray@google.com>
Mon, 1 Jun 2015 17:12:38 +0000 (18:12 +0100)
committerNicolas Geoffray <ngeoffray@google.com>
Mon, 1 Jun 2015 17:12:38 +0000 (18:12 +0100)
Change-Id: I7cd89143103ac3e372406dff5d3837c9d91bb00d

compiler/optimizing/register_allocator_test.cc
compiler/optimizing/ssa_liveness_analysis.h

index d07a14a..67525e6 100644 (file)
@@ -426,6 +426,13 @@ TEST(RegisterAllocatorTest, FreeUntil) {
   // Add an artifical range to cover the temps that will be put in the unhandled list.
   LiveInterval* unhandled = graph->GetEntryBlock()->GetFirstInstruction()->GetLiveInterval();
   unhandled->AddLoopRange(0, 60);
+
+   // Populate the instructions in the liveness object, to please the register allocator.
+  for (size_t i = 0; i < 60; ++i) {
+    liveness.instructions_from_lifetime_position_.Add(
+        graph->GetEntryBlock()->GetFirstInstruction());
+  }
+
   // For SSA value intervals, only an interval resulted from a split may intersect
   // with inactive intervals.
   unhandled = register_allocator.Split(unhandled, 5);
index 4cbe29a..4667825 100644 (file)
@@ -1219,6 +1219,7 @@ class SsaLivenessAnalysis : public ValueObject {
   size_t number_of_ssa_values_;
 
   ART_FRIEND_TEST(RegisterAllocatorTest, SpillInactive);
+  ART_FRIEND_TEST(RegisterAllocatorTest, FreeUntil);
 
   DISALLOW_COPY_AND_ASSIGN(SsaLivenessAnalysis);
 };