diff options
author | Alex Light <allight@google.com> | 2021-01-22 14:05:13 +0000 |
---|---|---|
committer | Alex Light <allight@google.com> | 2021-01-22 07:15:51 -0800 |
commit | fc1ce4e8be0d977e3d41699f5ec746d68f63c024 (patch) | |
tree | b656aa7c9e62aa181dfbf7fd4f2a0d32b8bf0704 /compiler/optimizing/scheduler.cc | |
parent | c6da1be58086e873c9695f8c4c1a3a8ca718696e (diff) |
Revert^2 "Partial Load Store Elimination"
This reverts commit 47ac53100303e7e864b7f6d65f17b23088ccf1d6.
There was a bug in LSE where we would incorrectly record the
shadow$_monitor_ field as not having a default initial value. This
caused partial LSE to be unable to compile the Object.identityHashCode
function, causing crashes. This issue was fixed in a parent CL. Also
updated all Offsets in LSE_test to be outside of the object header
regardless of configuration.
Test: ./test.py --host
Bug: 67037140
Reason for revert: Fixed issue with shadow$_monitor_ field and offsets
Change-Id: I4fb2afff4d410da818db38ed833927dfc0f6be33
Diffstat (limited to 'compiler/optimizing/scheduler.cc')
-rw-r--r-- | compiler/optimizing/scheduler.cc | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/compiler/optimizing/scheduler.cc b/compiler/optimizing/scheduler.cc index c1891de69a..7140e2424a 100644 --- a/compiler/optimizing/scheduler.cc +++ b/compiler/optimizing/scheduler.cc @@ -14,13 +14,14 @@ * limitations under the License. */ -#include <string> - #include "scheduler.h" +#include <string> + #include "base/scoped_arena_allocator.h" #include "base/scoped_arena_containers.h" #include "data_type-inl.h" +#include "optimizing/load_store_analysis.h" #include "prepare_for_register_allocation.h" #ifdef ART_ENABLE_CODEGEN_arm64 @@ -107,6 +108,7 @@ static bool IsArrayAccess(const HInstruction* instruction) { static bool IsInstanceFieldAccess(const HInstruction* instruction) { return instruction->IsInstanceFieldGet() || instruction->IsInstanceFieldSet() || + instruction->IsPredicatedInstanceFieldGet() || instruction->IsUnresolvedInstanceFieldGet() || instruction->IsUnresolvedInstanceFieldSet(); } @@ -121,6 +123,7 @@ static bool IsStaticFieldAccess(const HInstruction* instruction) { static bool IsResolvedFieldAccess(const HInstruction* instruction) { return instruction->IsInstanceFieldGet() || instruction->IsInstanceFieldSet() || + instruction->IsPredicatedInstanceFieldGet() || instruction->IsStaticFieldGet() || instruction->IsStaticFieldSet(); } @@ -137,18 +140,7 @@ static bool IsFieldAccess(const HInstruction* instruction) { } static const FieldInfo* GetFieldInfo(const HInstruction* instruction) { - if (instruction->IsInstanceFieldGet()) { - return &instruction->AsInstanceFieldGet()->GetFieldInfo(); - } else if (instruction->IsInstanceFieldSet()) { - return &instruction->AsInstanceFieldSet()->GetFieldInfo(); - } else if (instruction->IsStaticFieldGet()) { - return &instruction->AsStaticFieldGet()->GetFieldInfo(); - } else if (instruction->IsStaticFieldSet()) { - return &instruction->AsStaticFieldSet()->GetFieldInfo(); - } else { - LOG(FATAL) << "Unexpected field access type"; - UNREACHABLE(); - } + return &instruction->GetFieldInfo(); } size_t SideEffectDependencyAnalysis::MemoryDependencyAnalysis::FieldAccessHeapLocation( @@ -560,7 +552,7 @@ void HScheduler::Schedule(HGraph* graph) { // should run the analysis or not. const HeapLocationCollector* heap_location_collector = nullptr; ScopedArenaAllocator allocator(graph->GetArenaStack()); - LoadStoreAnalysis lsa(graph, /*stats=*/nullptr, &allocator, /*for_elimination=*/false); + LoadStoreAnalysis lsa(graph, /*stats=*/nullptr, &allocator, LoadStoreAnalysisType::kBasic); if (!only_optimize_loop_blocks_ || graph->HasLoops()) { lsa.Run(); heap_location_collector = &lsa.GetHeapLocationCollector(); @@ -730,35 +722,37 @@ bool HScheduler::IsSchedulable(const HInstruction* instruction) const { // TODO: Some of the instructions above may be safe to schedule (maybe as // scheduling barriers). return instruction->IsArrayGet() || - instruction->IsArraySet() || - instruction->IsArrayLength() || - instruction->IsBoundType() || - instruction->IsBoundsCheck() || - instruction->IsCheckCast() || - instruction->IsClassTableGet() || - instruction->IsCurrentMethod() || - instruction->IsDivZeroCheck() || - (instruction->IsInstanceFieldGet() && !instruction->AsInstanceFieldGet()->IsVolatile()) || - (instruction->IsInstanceFieldSet() && !instruction->AsInstanceFieldSet()->IsVolatile()) || - instruction->IsInstanceOf() || - instruction->IsInvokeInterface() || - instruction->IsInvokeStaticOrDirect() || - instruction->IsInvokeUnresolved() || - instruction->IsInvokeVirtual() || - instruction->IsLoadString() || - instruction->IsNewArray() || - instruction->IsNewInstance() || - instruction->IsNullCheck() || - instruction->IsPackedSwitch() || - instruction->IsParameterValue() || - instruction->IsPhi() || - instruction->IsReturn() || - instruction->IsReturnVoid() || - instruction->IsSelect() || - (instruction->IsStaticFieldGet() && !instruction->AsStaticFieldGet()->IsVolatile()) || - (instruction->IsStaticFieldSet() && !instruction->AsStaticFieldSet()->IsVolatile()) || - instruction->IsSuspendCheck() || - instruction->IsTypeConversion(); + instruction->IsArraySet() || + instruction->IsArrayLength() || + instruction->IsBoundType() || + instruction->IsBoundsCheck() || + instruction->IsCheckCast() || + instruction->IsClassTableGet() || + instruction->IsCurrentMethod() || + instruction->IsDivZeroCheck() || + (instruction->IsInstanceFieldGet() && !instruction->AsInstanceFieldGet()->IsVolatile()) || + (instruction->IsPredicatedInstanceFieldGet() && + !instruction->AsPredicatedInstanceFieldGet()->IsVolatile()) || + (instruction->IsInstanceFieldSet() && !instruction->AsInstanceFieldSet()->IsVolatile()) || + instruction->IsInstanceOf() || + instruction->IsInvokeInterface() || + instruction->IsInvokeStaticOrDirect() || + instruction->IsInvokeUnresolved() || + instruction->IsInvokeVirtual() || + instruction->IsLoadString() || + instruction->IsNewArray() || + instruction->IsNewInstance() || + instruction->IsNullCheck() || + instruction->IsPackedSwitch() || + instruction->IsParameterValue() || + instruction->IsPhi() || + instruction->IsReturn() || + instruction->IsReturnVoid() || + instruction->IsSelect() || + (instruction->IsStaticFieldGet() && !instruction->AsStaticFieldGet()->IsVolatile()) || + (instruction->IsStaticFieldSet() && !instruction->AsStaticFieldSet()->IsVolatile()) || + instruction->IsSuspendCheck() || + instruction->IsTypeConversion(); } bool HScheduler::IsSchedulable(const HBasicBlock* block) const { |