summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2022-12-16 14:37:11 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2023-01-03 15:11:58 +0000
commitd3389a31c8beba969238693ef6573096360526b5 (patch)
treebd03134d9c33c4421112fee6cc707c29d9aabc63 /compiler/optimizing
parent4a526080aa905803fe0e4061e09c4d7607e3f0ac (diff)
GraphChecker: Call VisitInstruction in VisitConstant
Fix some LSE gtests that were adding some instructions in the entry block which don't belong there in normal graphs (e.g. ArraySet, NewInstance) Bug: 262862764 Fixes: 262862764 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: m test-art-host-gtest-art_compiler_tests64 Change-Id: I1ea4f3eaf79d4b98b441dcf89f73c7009a6fa9b4
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/graph_checker.cc4
-rw-r--r--compiler/optimizing/load_store_elimination_test.cc21
2 files changed, 12 insertions, 13 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index 32b3bc1d9b..b20b53178f 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -1159,9 +1159,7 @@ void GraphChecker::VisitBinaryOperation(HBinaryOperation* op) {
}
void GraphChecker::VisitConstant(HConstant* instruction) {
- // TODO(solanes, 262862764): We should call VisitInstruction here but doing so makes the
- // LoadStoreEliminationTest gtests fail.
- // VisitInstruction(instruction);
+ VisitInstruction(instruction);
HBasicBlock* block = instruction->GetBlock();
if (!block->IsEntryBlock()) {
diff --git a/compiler/optimizing/load_store_elimination_test.cc b/compiler/optimizing/load_store_elimination_test.cc
index d19b079991..b1c48050f0 100644
--- a/compiler/optimizing/load_store_elimination_test.cc
+++ b/compiler/optimizing/load_store_elimination_test.cc
@@ -894,7 +894,7 @@ TEST_F(LoadStoreEliminationTest, StoreAfterLoopWithSideEffects2) {
// loop:
// array2[i] = array[i]
// array[0] = 2
- HInstruction* store1 = AddArraySet(entry_block_, array_, c0, c2);
+ HInstruction* store1 = AddArraySet(pre_header_, array_, c0, c2);
HInstruction* load = AddArrayGet(loop_, array_, phi_);
HInstruction* store2 = AddArraySet(loop_, array2, phi_, load);
@@ -4829,8 +4829,9 @@ TEST_P(PartialComparisonTestGroup, PartialComparisonBeforeCohort) {
CreateGraph(/*handles=*/&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry",
"exit",
- {{"entry", "critical_break"},
- {"entry", "partial"},
+ {{"entry", "first_block"},
+ {"first_block", "critical_break"},
+ {"first_block", "partial"},
{"partial", "merge"},
{"critical_break", "merge"},
{"merge", "left"},
@@ -4839,7 +4840,7 @@ TEST_P(PartialComparisonTestGroup, PartialComparisonBeforeCohort) {
{"right", "breturn"},
{"breturn", "exit"}}));
#define GET_BLOCK(name) HBasicBlock* name = blks.Get(#name)
- GET_BLOCK(entry);
+ GET_BLOCK(first_block);
GET_BLOCK(merge);
GET_BLOCK(partial);
GET_BLOCK(critical_break);
@@ -4858,12 +4859,12 @@ TEST_P(PartialComparisonTestGroup, PartialComparisonBeforeCohort) {
HInstruction* write_entry = MakeIFieldSet(new_inst, c3, MemberOffset(32));
ComparisonInstructions cmp_instructions = GetComparisonInstructions(new_inst);
HInstruction* if_inst = new (GetAllocator()) HIf(cmp_instructions.cmp_);
- entry->AddInstruction(cls);
- entry->AddInstruction(new_inst);
- entry->AddInstruction(write_entry);
- cmp_instructions.AddSetup(entry);
- entry->AddInstruction(cmp_instructions.cmp_);
- entry->AddInstruction(if_inst);
+ first_block->AddInstruction(cls);
+ first_block->AddInstruction(new_inst);
+ first_block->AddInstruction(write_entry);
+ cmp_instructions.AddSetup(first_block);
+ first_block->AddInstruction(cmp_instructions.cmp_);
+ first_block->AddInstruction(if_inst);
ManuallyBuildEnvFor(cls, {});
cmp_instructions.AddEnvironment(cls->GetEnvironment());
new_inst->CopyEnvironmentFrom(cls->GetEnvironment());