Revert "Support VecLoad and VecStore in LSE."
Somehow, this breaks:
./art/test/run-test --optimizing --64 --gcstress 667-checker-simd-alignment
This reverts commit 27dae5f3ce2d00b84eabf4cc4b7b2144af37a43a.
Change-Id: If552ebd8c14535c2eafbdc2ed0ff1f76ad29da35
diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc
index 66806d8..8678fab 100644
--- a/compiler/optimizing/load_store_elimination.cc
+++ b/compiler/optimizing/load_store_elimination.cc
@@ -83,8 +83,7 @@
DCHECK(load != nullptr);
DCHECK(load->IsInstanceFieldGet() ||
load->IsStaticFieldGet() ||
- load->IsArrayGet() ||
- load->IsVecLoad());
+ load->IsArrayGet());
HInstruction* substitute = substitute_instructions_for_loads_[i];
DCHECK(substitute != nullptr);
// Keep tracing substitute till one that's not removed.
@@ -99,10 +98,7 @@
// At this point, stores in possibly_removed_stores_ can be safely removed.
for (HInstruction* store : possibly_removed_stores_) {
- DCHECK(store->IsInstanceFieldSet() ||
- store->IsStaticFieldSet() ||
- store->IsArraySet() ||
- store->IsVecStore());
+ DCHECK(store->IsInstanceFieldSet() || store->IsStaticFieldSet() || store->IsArraySet());
store->GetBlock()->RemoveInstruction(store);
}
@@ -141,9 +137,7 @@
void KeepIfIsStore(HInstruction* heap_value) {
if (heap_value == kDefaultHeapValue ||
heap_value == kUnknownHeapValue ||
- !(heap_value->IsInstanceFieldSet() ||
- heap_value->IsArraySet() ||
- heap_value->IsVecStore())) {
+ !(heap_value->IsInstanceFieldSet() || heap_value->IsArraySet())) {
return;
}
auto idx = std::find(possibly_removed_stores_.begin(),
@@ -326,9 +320,7 @@
return;
}
if (heap_value != kUnknownHeapValue) {
- if (heap_value->IsInstanceFieldSet() ||
- heap_value->IsArraySet() ||
- heap_value->IsVecStore()) {
+ if (heap_value->IsInstanceFieldSet() || heap_value->IsArraySet()) {
HInstruction* store = heap_value;
// This load must be from a singleton since it's from the same
// field/element that a "removed" store puts the value. That store
@@ -424,9 +416,7 @@
if (!same_value) {
if (possibly_redundant) {
- DCHECK(instruction->IsInstanceFieldSet() ||
- instruction->IsArraySet() ||
- instruction->IsVecStore());
+ DCHECK(instruction->IsInstanceFieldSet() || instruction->IsArraySet());
// Put the store as the heap value. If the value is loaded from heap
// by a load later, this store isn't really redundant.
heap_values[idx] = instruction;
@@ -439,24 +429,8 @@
if (i == idx) {
continue;
}
- if (heap_values[i] == value && !instruction->IsVecOperation()) {
- // For field/array, same value should be kept even if aliasing happens.
- //
- // For vector values , this is NOT safe. For example:
- // packed_data = [0xA, 0xB, 0xC, 0xD]; <-- Different values in each lane.
- // VecStore array[i ,i+1,i+2,i+3] = packed_data;
- // VecStore array[i+1,i+2,i+3,i+4] = packed_data; <-- We are here (partial overlap).
- // VecLoad vx = array[i,i+1,i+2,i+3]; <-- Cannot be eliminated.
- //
- // TODO: to allow such 'same value' optimization on vector data,
- // LSA needs to report more fine-grain MAY alias information:
- // (1) May alias due to two vector data partial overlap.
- // e.g. a[i..i+3] and a[i+1,..,i+4].
- // (2) May alias due to two vector data may complete overlap each other.
- // e.g. a[i..i+3] and b[i..i+3].
- // (3) May alias but the exact relationship between two locations is unknown.
- // e.g. a[i..i+3] and b[j..j+3], where values of a,b,i,j are all unknown.
- // This 'same value' optimization can apply only on case (2).
+ if (heap_values[i] == value) {
+ // Same value should be kept even if aliasing happens.
continue;
}
if (heap_values[i] == kUnknownHeapValue) {
@@ -546,32 +520,6 @@
value);
}
- void VisitVecLoad(HVecLoad* instruction) OVERRIDE {
- HInstruction* array = instruction->InputAt(0);
- HInstruction* index = instruction->InputAt(1);
- size_t vector_length = instruction->GetVectorLength();
- VisitGetLocation(instruction,
- array,
- HeapLocation::kInvalidFieldOffset,
- index,
- vector_length,
- HeapLocation::kDeclaringClassDefIndexForArrays);
- }
-
- void VisitVecStore(HVecStore* instruction) OVERRIDE {
- HInstruction* array = instruction->InputAt(0);
- HInstruction* index = instruction->InputAt(1);
- HInstruction* value = instruction->InputAt(2);
- size_t vector_length = instruction->GetVectorLength();
- VisitSetLocation(instruction,
- array,
- HeapLocation::kInvalidFieldOffset,
- index,
- vector_length,
- HeapLocation::kDeclaringClassDefIndexForArrays,
- value);
- }
-
void VisitDeoptimize(HDeoptimize* instruction) {
const ScopedArenaVector<HInstruction*>& heap_values =
heap_values_for_[instruction->GetBlock()->GetBlockId()];
@@ -581,9 +529,7 @@
continue;
}
// A store is kept as the heap value for possibly removed stores.
- if (heap_value->IsInstanceFieldSet() ||
- heap_value->IsArraySet() ||
- heap_value->IsVecStore()) {
+ if (heap_value->IsInstanceFieldSet() || heap_value->IsArraySet()) {
// Check whether the reference for a store is used by an environment local of
// HDeoptimize.
HInstruction* reference = heap_value->InputAt(0);
@@ -741,6 +687,11 @@
return;
}
+ // TODO: analyze VecLoad/VecStore better.
+ if (graph_->HasSIMD()) {
+ return;
+ }
+
LSEVisitor lse_visitor(graph_, heap_location_collector, side_effects_, stats_);
for (HBasicBlock* block : graph_->GetReversePostOrder()) {
lse_visitor.VisitBasicBlock(block);