Improvement on array element aliasing analysis.
More robust array element aliasing analysis which covers aliasing
between all heap locations.
Test: run-test on host.
Test: 530-checker-lse/load_store_analysis_test.cc cover array index aliasing.
Change-Id: Ie0d1696bedb7811c6a4bc0786ef93ca724493de2
diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc
index 66806d8..7d953c0 100644
--- a/compiler/optimizing/load_store_elimination.cc
+++ b/compiler/optimizing/load_store_elimination.cc
@@ -392,8 +392,10 @@
if (Equal(heap_value, value)) {
// Store into the heap location with the same value.
same_value = true;
- } else if (index != nullptr && ref_info->HasIndexAliasing()) {
- // For array element, don't eliminate stores if the index can be aliased.
+ } else if (index != nullptr &&
+ heap_location_collector_.GetHeapLocation(idx)->HasAliasedLocations()) {
+ // For array element, don't eliminate stores if the location can be aliased
+ // (due to either ref or index aliasing).
} else if (ref_info->IsSingleton()) {
// Store into a field/element of a singleton. The value cannot be killed due to
// aliasing/invocation. It can be redundant since future loads can