OSDN Git Service

Fix checks for kLiteral in local optimizations.
authorDave Allison <dallison@google.com>
Wed, 6 Aug 2014 04:32:46 +0000 (21:32 -0700)
committerDave Allison <dallison@google.com>
Wed, 6 Aug 2014 19:40:27 +0000 (19:40 +0000)
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

index eec2b32..e0f4691 100644 (file)
@@ -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)) {