summaryrefslogtreecommitdiff
path: root/compiler/optimizing/load_store_analysis.h
diff options
context:
space:
mode:
authorxueliang.zhong <xueliang.zhong@linaro.org>2017-05-12 18:16:31 +0100
committerxueliang.zhong <xueliang.zhong@linaro.org>2017-06-26 11:30:39 +0100
commit016c0f165dc6872d22c12c239d19b094983519f1 (patch)
treebef8e9912412d02b7aa3913f2750147835454b2e /compiler/optimizing/load_store_analysis.h
parentd1c983a5bc3ae50eab3af405ae8a415e1f36f532 (diff)
Improve array index analysis in LSA.
This CL improves analysis on array index in load store analysis. Test: m test-art-host Test: m test-art-target Test: m test-art-host-gtest-load_store_analysis_test Change-Id: Id5e5aa8b396c68e082db95809659494107985fa2
Diffstat (limited to 'compiler/optimizing/load_store_analysis.h')
-rw-r--r--compiler/optimizing/load_store_analysis.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/optimizing/load_store_analysis.h b/compiler/optimizing/load_store_analysis.h
index 4e940f30bf..86fb8e0165 100644
--- a/compiler/optimizing/load_store_analysis.h
+++ b/compiler/optimizing/load_store_analysis.h
@@ -214,6 +214,17 @@ class HeapLocationCollector : public HGraphVisitor {
return nullptr;
}
+ size_t GetArrayAccessHeapLocation(HInstruction* array, HInstruction* index) const {
+ DCHECK(array != nullptr);
+ DCHECK(index != nullptr);
+ HInstruction* original_ref = HuntForOriginalReference(array);
+ ReferenceInfo* ref_info = FindReferenceInfoOf(original_ref);
+ return FindHeapLocationIndex(ref_info,
+ HeapLocation::kInvalidFieldOffset,
+ index,
+ HeapLocation::kDeclaringClassDefIndexForArrays);
+ }
+
bool HasHeapStores() const {
return has_heap_stores_;
}
@@ -300,6 +311,8 @@ class HeapLocationCollector : public HGraphVisitor {
return true;
}
+ bool CanArrayIndicesAlias(const HInstruction* i1, const HInstruction* i2) const;
+
// `index1` and `index2` are indices in the array of collected heap locations.
// Returns the position in the bit vector that tracks whether the two heap
// locations may alias.
@@ -336,12 +349,7 @@ class HeapLocationCollector : public HGraphVisitor {
if (loc1->IsArrayElement() && loc2->IsArrayElement()) {
HInstruction* array_index1 = loc1->GetIndex();
HInstruction* array_index2 = loc2->GetIndex();
- DCHECK(array_index1 != nullptr);
- DCHECK(array_index2 != nullptr);
- if (array_index1->IsIntConstant() &&
- array_index2->IsIntConstant() &&
- array_index1->AsIntConstant()->GetValue() != array_index2->AsIntConstant()->GetValue()) {
- // Different constant indices do not alias.
+ if (!CanArrayIndicesAlias(array_index1, array_index2)) {
return false;
}
ReferenceInfo* ref_info = loc1->GetReferenceInfo();