summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/optimizing_unit_test.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-01-15 15:37:37 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-01-16 08:37:59 +0000
commitdd8f887e81b894bc8075d8bacdb223747b6a8018 (patch)
tree2358f04f707177fc5b1a8463973ddd5f295d6e72 /compiler/optimizing/optimizing_unit_test.h
parent63991dd7c9bd68f23121e420c005628d7307cba3 (diff)
downloadart-dd8f887e81b894bc8075d8bacdb223747b6a8018.tar.gz
art-dd8f887e81b894bc8075d8bacdb223747b6a8018.tar.bz2
art-dd8f887e81b894bc8075d8bacdb223747b6a8018.zip
Fix a bug in the register allocator.
When allocating a register blocked by existing intervals, we need to split inactive intervals at the end of their lifetime hole, and not at the next intersection. Otherwise, the allocation for following intervals will not see that a register is being used by the split interval. Change-Id: I40cc79dde541c07392a7cf4c6f0b291dd1ce1819
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r--compiler/optimizing/optimizing_unit_test.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 04b56345c4..b3eb1e2d51 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -45,8 +45,12 @@ namespace art {
LiveInterval* BuildInterval(const size_t ranges[][2],
size_t number_of_ranges,
ArenaAllocator* allocator,
- int reg = -1) {
- LiveInterval* interval = LiveInterval::MakeInterval(allocator, Primitive::kPrimInt);
+ int reg = -1,
+ HInstruction* defined_by = nullptr) {
+ LiveInterval* interval = LiveInterval::MakeInterval(allocator, Primitive::kPrimInt, defined_by);
+ if (defined_by != nullptr) {
+ defined_by->SetLiveInterval(interval);
+ }
for (size_t i = number_of_ranges; i > 0; --i) {
interval->AddRange(ranges[i - 1][0], ranges[i - 1][1]);
}