diff options
author | Vladimir Marko <vmarko@google.com> | 2021-05-10 15:44:24 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2021-05-13 08:49:06 +0000 |
commit | dac82393785d1d2fddae6bf6d8364b55b001925a (patch) | |
tree | 2870783966316c965d40c3a6cd4b2cadce632c79 /compiler/optimizing/load_store_analysis.h | |
parent | b1db5a110d312c5a51a52f7f6bc870f9205b6ff8 (diff) |
Fix array location aliasing checks in LSE.
Test: New tests in load_store_elimination_test.
Test: New test in 539-checker-lse.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 187487955
Change-Id: Iff66d5406cf1b36c3bebbce1d48117f83bb50553
Diffstat (limited to 'compiler/optimizing/load_store_analysis.h')
-rw-r--r-- | compiler/optimizing/load_store_analysis.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/optimizing/load_store_analysis.h b/compiler/optimizing/load_store_analysis.h index e81572743e..5fda8dfabe 100644 --- a/compiler/optimizing/load_store_analysis.h +++ b/compiler/optimizing/load_store_analysis.h @@ -417,20 +417,7 @@ class HeapLocationCollector : public HGraphVisitor { } } - private: - // An allocation cannot alias with a name which already exists at the point - // of the allocation, such as a parameter or a load happening before the allocation. - bool MayAliasWithPreexistenceChecking(ReferenceInfo* ref_info1, ReferenceInfo* ref_info2) const { - if (ref_info1->GetReference()->IsNewInstance() || ref_info1->GetReference()->IsNewArray()) { - // Any reference that can alias with the allocation must appear after it in the block/in - // the block's successors. In reverse post order, those instructions will be visited after - // the allocation. - return ref_info2->GetPosition() >= ref_info1->GetPosition(); - } - return true; - } - - bool CanReferencesAlias(ReferenceInfo* ref_info1, ReferenceInfo* ref_info2) const { + static bool CanReferencesAlias(ReferenceInfo* ref_info1, ReferenceInfo* ref_info2) { if (ref_info1 == ref_info2) { return true; } else if (ref_info1->IsSingleton()) { @@ -444,6 +431,19 @@ class HeapLocationCollector : public HGraphVisitor { return true; } + private: + // An allocation cannot alias with a name which already exists at the point + // of the allocation, such as a parameter or a load happening before the allocation. + static bool MayAliasWithPreexistenceChecking(ReferenceInfo* ref_info1, ReferenceInfo* ref_info2) { + if (ref_info1->GetReference()->IsNewInstance() || ref_info1->GetReference()->IsNewArray()) { + // Any reference that can alias with the allocation must appear after it in the block/in + // the block's successors. In reverse post order, those instructions will be visited after + // the allocation. + return ref_info2->GetPosition() >= ref_info1->GetPosition(); + } + return true; + } + bool CanArrayElementsAlias(const HInstruction* idx1, const size_t vector_length1, const HInstruction* idx2, |