From 6e9c66e099654b63ed3648bda2daeaf0a862f047 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 7 Aug 2015 18:13:03 -0700 Subject: Fix a bug in the register allocator around pair allocation. We may get hints that do not work with the current implementation of register pairs, which forces the allocation of (low + 1) for the high register. For example, if the hint is EBX, we will allocate ESP for the high register. bug:23043730 (cherry picked from commit f29758111e71a7d14f3e52d78773561a5d59961f) Change-Id: Ib395e36616017a87d3055218d72417f4e9ff6501 --- compiler/optimizing/register_allocator.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index 8656ad5f8..d64e146ff 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -772,7 +772,10 @@ bool RegisterAllocator::TryAllocateFreeReg(LiveInterval* current) { } else { DCHECK(!current->IsHighInterval()); int hint = current->FindFirstRegisterHint(free_until, liveness_); - if (hint != kNoRegister) { + if ((hint != kNoRegister) + // For simplicity, if the hint we are getting for a pair cannot be used, + // we are just going to allocate a new pair. + && !(current->IsLowInterval() && IsBlocked(GetHighForLowRegister(hint)))) { DCHECK(!IsBlocked(hint)); reg = hint; } else if (current->IsLowInterval()) { -- cgit v1.2.3