From df45205204125727fa71b17b3f6bb3d8eb9bc20c Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Thu, 5 Mar 2015 15:34:41 +0000 Subject: [PATCH] ART: Fix test breakage Recent commit changed the direction of iteration over safepoints in the register allocator but contained a bug that skipped some of them at the boundaries of interval siblings. This patch fixes the bug. Change-Id: Ia7d4892536b5198e01c9bc3034f448227794ff72 --- compiler/optimizing/register_allocator.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index 0e9c4d6f6..748ab2259 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -1425,13 +1425,13 @@ void RegisterAllocator::ConnectSiblings(LiveInterval* interval) { // At each safepoint, we record stack and register information. // We iterate backwards to test safepoints in ascending order of positions, // which is what LiveInterval::Covers is optimized for. - while (safepoint_index > 0) { - HInstruction* safepoint = safepoints_.Get(--safepoint_index); + for (; safepoint_index > 0; --safepoint_index) { + HInstruction* safepoint = safepoints_.Get(safepoint_index - 1); size_t position = safepoint->GetLifetimePosition(); // Test that safepoints are ordered in the optimal way. - DCHECK(safepoint_index == 0 - || safepoints_.Get(safepoint_index - 1)->GetLifetimePosition() >= position); + DCHECK(safepoint_index == safepoints_.Size() + || safepoints_.Get(safepoint_index)->GetLifetimePosition() <= position); if (current->IsDeadAt(position)) { break; -- 2.11.0