From 2fd6aa5cb76f0c71cbdcd1189c76e68bf84e8308 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Mon, 2 Feb 2015 18:58:27 +0000 Subject: Fix broken gtests after SuspendCheck optimization Fixes hardcoded graph dumps in pretty printer tests and an assumption that non-zero branch offset in dex implies presence of HInstructions. Change-Id: Iee273c06b7b36410b4621107bef2f3592ece2f5b --- compiler/optimizing/builder.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'compiler/optimizing/builder.cc') diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index eed56146e..c50960666 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -1077,11 +1077,10 @@ void HGraphBuilder::PotentiallyAddSuspendCheck(HBasicBlock* target, uint32_t dex if (target_offset <= 0) { // DX generates back edges to the first encountered return. We can save // time of later passes by not adding redundant suspend checks. - if (target_offset != 0) { - DCHECK(target->GetLastInstruction() != nullptr); - if (target->GetLastInstruction()->IsReturn()) { - return; - } + HInstruction* last_in_target = target->GetLastInstruction(); + if (last_in_target != nullptr && + (last_in_target->IsReturn() || last_in_target->IsReturnVoid())) { + return; } // Add a suspend check to backward branches which may potentially loop. We -- cgit v1.2.3