ART: Improve range search caching in LiveInterval
Register allocator spends too long in LiveInterval queries. This patch
builds on previously introduced caching of range search results to
further speed up LiveInterval's Covers and FindIntersectionWith.
Only calls which are guaranteed to query the current->GetStart()
position are cached. Other calls are replaced with CoversSlow which
searches through the entire list of ranges.
Change-Id: I84d92b526e174caa70d6477497a06afd85016c4a
diff --git a/compiler/optimizing/live_interval_test.cc b/compiler/optimizing/live_interval_test.cc
index 28000c1..405f261 100644
--- a/compiler/optimizing/live_interval_test.cc
+++ b/compiler/optimizing/live_interval_test.cc
@@ -84,13 +84,13 @@
{
static constexpr size_t ranges[][2] = {{4, 12}, {14, 16}};
LiveInterval* interval = BuildInterval(ranges, arraysize(ranges), &allocator);
+ ASSERT_FALSE(interval->Covers(0));
ASSERT_TRUE(interval->Covers(4));
ASSERT_TRUE(interval->Covers(11));
- ASSERT_TRUE(interval->Covers(14));
- ASSERT_TRUE(interval->Covers(15));
- ASSERT_FALSE(interval->Covers(0));
ASSERT_FALSE(interval->Covers(12));
ASSERT_FALSE(interval->Covers(13));
+ ASSERT_TRUE(interval->Covers(14));
+ ASSERT_TRUE(interval->Covers(15));
ASSERT_FALSE(interval->Covers(16));
}
}