summaryrefslogtreecommitdiffstats
path: root/compiler/dex/global_value_numbering.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-04-25 17:00:45 +0100
committerVladimir Marko <vmarko@google.com>2015-04-28 18:01:48 +0100
commitbe8f57d3a5ff121f1056791ed0910435c834b211 (patch)
tree2f3961518e95d2dfae188c04e34cde90cc5def79 /compiler/dex/global_value_numbering.cc
parent0dd76cd3f09f495a1b9a0e4f8712c09ff885c6fd (diff)
downloadart-be8f57d3a5ff121f1056791ed0910435c834b211.zip
art-be8f57d3a5ff121f1056791ed0910435c834b211.tar.gz
art-be8f57d3a5ff121f1056791ed0910435c834b211.tar.bz2
Quick: Avoid unnecessary GVN work in release builds.
In GVN's post-processing phase, compare LVNs only in debug builds as they should be equal anyway. Remove the Gate() from GVN cleanup pass and remove the DCHECK() from MIRGraph::GlobalValueNumberingCleanup() to make it a no-op if the GVN didn't run. Bug: 16398693 (cherry picked from commit f725550c8df90f8ec07395d9be5177a4be591c12) Change-Id: I518fba4a06c8d6d5ab16a6c122dc680b6d44814b
Diffstat (limited to 'compiler/dex/global_value_numbering.cc')
-rw-r--r--compiler/dex/global_value_numbering.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/dex/global_value_numbering.cc b/compiler/dex/global_value_numbering.cc
index 30e3ce0..e2b9987 100644
--- a/compiler/dex/global_value_numbering.cc
+++ b/compiler/dex/global_value_numbering.cc
@@ -128,8 +128,9 @@ bool GlobalValueNumbering::FinishBasicBlock(BasicBlock* bb) {
++bbs_processed_;
merge_lvns_.clear();
- bool change = (lvns_[bb->id] == nullptr) || !lvns_[bb->id]->Equals(*work_lvn_);
+ bool change = false;
if (mode_ == kModeGvn) {
+ change = (lvns_[bb->id] == nullptr) || !lvns_[bb->id]->Equals(*work_lvn_);
// In GVN mode, keep the latest LVN even if Equals() indicates no change. This is
// to keep the correct values of fields that do not contribute to Equals() as long
// as they depend only on predecessor LVNs' fields that do contribute to Equals().
@@ -137,6 +138,9 @@ bool GlobalValueNumbering::FinishBasicBlock(BasicBlock* bb) {
std::unique_ptr<const LocalValueNumbering> old_lvn(lvns_[bb->id]);
lvns_[bb->id] = work_lvn_.release();
} else {
+ DCHECK_EQ(mode_, kModeGvnPostProcessing); // kModeLvn doesn't use FinishBasicBlock().
+ DCHECK(lvns_[bb->id] != nullptr);
+ DCHECK(lvns_[bb->id]->Equals(*work_lvn_));
work_lvn_.reset();
}
return change;