From adc73cbe869f9560cf84bda2e953a2b267b1438f Mon Sep 17 00:00:00 2001 From: Dave Allison Date: Tue, 5 Aug 2014 21:32:46 -0700 Subject: [PATCH] Fix checks for kLiteral in local optimizations. The check for kLiteral (literal load) just checked the kLiteral bit in the def mask. The kEncodeAll mask has the kLiteral bit set so this check was triggering. The fix is to check for only the kLiteral bit being set and no other special bits. The semantics of the special bits in the use/def mask is that only one of them can be set at the same time. Bug: 16824330 Change-Id: I0f1c1157e017870414ffef11767e5433d1fd4401 --- compiler/dex/quick/local_optimizations.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/dex/quick/local_optimizations.cc b/compiler/dex/quick/local_optimizations.cc index eec2b3272..e0f469106 100644 --- a/compiler/dex/quick/local_optimizations.cc +++ b/compiler/dex/quick/local_optimizations.cc @@ -200,7 +200,7 @@ void Mir2Lir::ApplyLoadStoreElimination(LIR* head_lir, LIR* tail_lir) { /* Initialize alias list */ alias_list.clear(); ResourceMask alias_reg_list_mask = kEncodeNone; - if (!this_mem_mask.Intersects(kEncodeLiteral)) { + if (!this_mem_mask.Intersects(kEncodeMem) && !this_mem_mask.Intersects(kEncodeLiteral)) { alias_list.push_back(dest_reg_id); SetupRegMask(&alias_reg_list_mask, dest_reg_id); } @@ -248,7 +248,7 @@ void Mir2Lir::ApplyLoadStoreElimination(LIR* head_lir, LIR* tail_lir) { bool is_check_lir_load = check_flags & IS_LOAD; bool reg_compatible = RegStorage::SameRegType(check_lir->operands[0], native_reg_id); - if (alias_mem_mask.Equals(kEncodeLiteral)) { + if (!alias_mem_mask.Intersects(kEncodeMem) && alias_mem_mask.Equals(kEncodeLiteral)) { DCHECK(check_flags & IS_LOAD); /* Same value && same register type */ if (reg_compatible && (this_lir->target == check_lir->target)) { -- 2.11.0