diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/escape.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/load_store_elimination.cc | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/compiler/optimizing/escape.cc b/compiler/optimizing/escape.cc index 9df5bf1017..88e9326093 100644 --- a/compiler/optimizing/escape.cc +++ b/compiler/optimizing/escape.cc @@ -51,7 +51,9 @@ void CalculateEscape(HInstruction* reference, *is_singleton_and_not_returned = false; *is_singleton_and_not_deopt_visible = false; return; - } else if (user->IsPhi() || user->IsSelect() || user->IsInvoke() || + } else if (user->IsPhi() || + user->IsSelect() || + (user->IsInvoke() && user->GetSideEffects().DoesAnyWrite()) || (user->IsInstanceFieldSet() && (reference == user->InputAt(1))) || (user->IsUnresolvedInstanceFieldSet() && (reference == user->InputAt(1))) || (user->IsStaticFieldSet() && (reference == user->InputAt(1))) || diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc index 7dff696e32..c041f56548 100644 --- a/compiler/optimizing/load_store_elimination.cc +++ b/compiler/optimizing/load_store_elimination.cc @@ -528,15 +528,21 @@ class LSEVisitor : public HGraphDelegateVisitor { } } - void HandleInvoke(HInstruction* invoke) { + void HandleInvoke(HInstruction* instruction) { + SideEffects side_effects = instruction->GetSideEffects(); ScopedArenaVector<HInstruction*>& heap_values = - heap_values_for_[invoke->GetBlock()->GetBlockId()]; + heap_values_for_[instruction->GetBlock()->GetBlockId()]; for (size_t i = 0; i < heap_values.size(); i++) { ReferenceInfo* ref_info = heap_location_collector_.GetHeapLocation(i)->GetReferenceInfo(); if (ref_info->IsSingleton()) { // Singleton references cannot be seen by the callee. } else { - heap_values[i] = kUnknownHeapValue; + if (side_effects.DoesAnyRead()) { + KeepIfIsStore(heap_values[i]); + } + if (side_effects.DoesAnyWrite()) { + heap_values[i] = kUnknownHeapValue; + } } } } |