summaryrefslogtreecommitdiff
path: root/compiler/optimizing/bounds_check_elimination.cc
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2022-12-16 19:28:47 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2023-01-13 16:19:02 +0000
commit74da668328e1c501742a864d23ba8c114ece5e64 (patch)
treea8e6d643230ff9bec8ae8878cd8d1021b813a3e5 /compiler/optimizing/bounds_check_elimination.cc
parent1f3861de4cacb51eacbb624e377b9dc7d7f96cc1 (diff)
Update the graph flags and check consistency
Check that the flags are up to date in graph checker. Mainly a correctness check CL but it brings slight code size reduction (e.g. not needing vreg info if HasMonitorOperations is false). Update loop_optimization_test to stop using `LocalRun` directly as it meant that it was breaking assumptions (i.e. top_loop_ was nullptr when it was expected to have a value). Bug: 264278131 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I29765b3be46d4bd7c91ea9c80f7565a3c88fae2e
Diffstat (limited to 'compiler/optimizing/bounds_check_elimination.cc')
-rw-r--r--compiler/optimizing/bounds_check_elimination.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index 66a3b8b506..52f1e9a934 100644
--- a/compiler/optimizing/bounds_check_elimination.cc
+++ b/compiler/optimizing/bounds_check_elimination.cc
@@ -564,6 +564,19 @@ class BCEVisitor : public HGraphVisitor {
early_exit_loop_.clear();
taken_test_loop_.clear();
finite_loop_.clear();
+
+ // We may have eliminated all bounds checks so we should update the flag.
+ // TODO(solanes): Do this without a linear pass of the graph?
+ GetGraph()->SetHasBoundsChecks(false);
+ for (HBasicBlock* block : GetGraph()->GetReversePostOrder()) {
+ for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
+ HInstruction* instruction = it.Current();
+ if (instruction->IsBoundsCheck()) {
+ GetGraph()->SetHasBoundsChecks(true);
+ return;
+ }
+ }
+ }
}
private: