summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-03-14 13:56:02 +0000
committer Vladimir Marko <vmarko@google.com> 2016-03-14 13:59:44 +0000
commitb75878e9dd1cfae1a0387fffe7716102522b41e8 (patch)
treec9ec3cfad4c7b1a5ac9288de1e89f3c4f1f87a3a /compiler/optimizing
parentfb8932eec4c09c34dfe759ba151e751293245c0d (diff)
Optimizing: Do not re-record standby checks for dynamic BCE.
Adding the checks to the standby vector invalidates the vector storage used by range-based loop in the BCEVisitor::Finish() as exposed by valgrind in image_test. Bug: 27597089 Change-Id: Ib0f0e8cdfdb7211a64a26836e085cb99fb2ce8b8
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/bounds_check_elimination.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index f2929bcc18..4e0c38c049 100644
--- a/compiler/optimizing/bounds_check_elimination.cc
+++ b/compiler/optimizing/bounds_check_elimination.cc
@@ -535,6 +535,7 @@ class BCEVisitor : public HGraphVisitor {
graph->GetArena()->Adapter(kArenaAllocBoundsCheckElimination)),
dynamic_bce_standby_(
graph->GetArena()->Adapter(kArenaAllocBoundsCheckElimination)),
+ record_dynamic_bce_standby_(true),
early_exit_loop_(
std::less<uint32_t>(),
graph->GetArena()->Adapter(kArenaAllocBoundsCheckElimination)),
@@ -556,6 +557,7 @@ class BCEVisitor : public HGraphVisitor {
void Finish() {
// Retry dynamic bce candidates on standby that are still in the graph.
+ record_dynamic_bce_standby_ = false;
for (HBoundsCheck* bounds_check : dynamic_bce_standby_) {
if (bounds_check->IsInBlock()) {
TryDynamicBCE(bounds_check);
@@ -1467,7 +1469,9 @@ class BCEVisitor : public HGraphVisitor {
}
// If bounds check made it this far, it is worthwhile to check later if
// the loop was forced finite by another candidate.
- dynamic_bce_standby_.push_back(check);
+ if (record_dynamic_bce_standby_) {
+ dynamic_bce_standby_.push_back(check);
+ }
return false;
}
return true;
@@ -1691,6 +1695,7 @@ class BCEVisitor : public HGraphVisitor {
// Stand by list for dynamic bce.
ArenaVector<HBoundsCheck*> dynamic_bce_standby_;
+ bool record_dynamic_bce_standby_;
// Early-exit loop bookkeeping.
ArenaSafeMap<uint32_t, bool> early_exit_loop_;