summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
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
commitdac82393785d1d2fddae6bf6d8364b55b001925a (patch)
tree2870783966316c965d40c3a6cd4b2cadce632c79 /compiler/optimizing/nodes.cc
parentb1db5a110d312c5a51a52f7f6bc870f9205b6ff8 (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/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 215fa3e143..17080f0056 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -27,6 +27,7 @@
#include "base/bit_vector.h"
#include "base/iteration_range.h"
#include "base/logging.h"
+#include "base/malloc_arena_pool.h"
#include "base/scoped_arena_allocator.h"
#include "base/scoped_arena_containers.h"
#include "base/stl_util.h"
@@ -1314,14 +1315,25 @@ void HEnvironment::ReplaceInput(HInstruction* replacement, size_t index) {
}
std::ostream& HInstruction::Dump(std::ostream& os, bool dump_args) {
- HGraph* graph = GetBlock()->GetGraph();
+ // Note: Handle the case where the instruction has been removed from
+ // the graph to support debugging output for failed gtests.
+ HGraph* graph = (GetBlock() != nullptr) ? GetBlock()->GetGraph() : nullptr;
HGraphVisualizer::DumpInstruction(&os, graph, this);
if (dump_args) {
// Allocate memory from local ScopedArenaAllocator.
- ScopedArenaAllocator allocator(graph->GetArenaStack());
+ std::optional<MallocArenaPool> local_arena_pool;
+ std::optional<ArenaStack> local_arena_stack;
+ if (UNLIKELY(graph == nullptr)) {
+ local_arena_pool.emplace();
+ local_arena_stack.emplace(&local_arena_pool.value());
+ }
+ ScopedArenaAllocator allocator(
+ graph != nullptr ? graph->GetArenaStack() : &local_arena_stack.value());
// Instructions that we already visited. We print each instruction only once.
- ArenaBitVector visited(
- &allocator, graph->GetCurrentInstructionId(), /* expandable= */ false, kArenaAllocMisc);
+ ArenaBitVector visited(&allocator,
+ (graph != nullptr) ? graph->GetCurrentInstructionId() : 0u,
+ /* expandable= */ (graph == nullptr),
+ kArenaAllocMisc);
visited.ClearAllBits();
visited.SetBit(GetId());
// Keep a queue of instructions with their indentations.