From 799ea81c066e910da7efb1ad06bc7d2dbc966726 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Thu, 7 Mar 2024 14:46:40 +0000 Subject: Remove the environment from ArraySets which can't throw When clearing the NeedsTypeCheck flag in ArraySet instructions, we can remove the environment as it is no longer needed. Also add a check in GraphChecker that instructions have an environment iff they need one. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I698d9d88bc7c6c8569caf6397cbebf29b34585d5 --- compiler/optimizing/graph_checker.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/graph_checker.cc') diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index b061b401ff..f2662700c7 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -673,9 +673,15 @@ void GraphChecker::VisitInstruction(HInstruction* instruction) { } } - if (instruction->NeedsEnvironment() && !instruction->HasEnvironment()) { - AddError(StringPrintf("Instruction %s:%d in block %d requires an environment " - "but does not have one.", + if (instruction->NeedsEnvironment() != instruction->HasEnvironment()) { + const char* str; + if (instruction->NeedsEnvironment()) { + str = "Instruction %s:%d in block %d requires an environment but does not have one."; + } else { + str = "Instruction %s:%d in block %d doesn't require an environment but it has one."; + } + + AddError(StringPrintf(str, instruction->DebugName(), instruction->GetId(), current_block_->GetBlockId())); -- cgit v1.2.3-59-g8ed1b