summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-07-01 11:36:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-01 11:36:38 +0000
commitf801a6a69bac4a767c3b11da78145cc11b9ef7ac (patch)
tree1fd6e1676ca9e9f374d49064c63d47e128c98be9 /compiler
parented6193a75b90ec3026622b2cbc146452a85b8d47 (diff)
parentfecc4659d0a4ac1e0e16e82b47e5592fff1d827f (diff)
downloadart-f801a6a69bac4a767c3b11da78145cc11b9ef7ac.zip
art-f801a6a69bac4a767c3b11da78145cc11b9ef7ac.tar.gz
art-f801a6a69bac4a767c3b11da78145cc11b9ef7ac.tar.bz2
Merge "Do not replace a live phi with a dead phi." into mnc-dev
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/ssa_builder.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc
index 9236f7c..3814e8f 100644
--- a/compiler/optimizing/ssa_builder.cc
+++ b/compiler/optimizing/ssa_builder.cc
@@ -213,7 +213,13 @@ void SsaBuilder::EquivalentPhisCleanup() {
HPhi* phi = it.Current()->AsPhi();
HPhi* next = phi->GetNextEquivalentPhiWithSameType();
if (next != nullptr) {
- phi->ReplaceWith(next);
+ // Make sure we do not replace a live phi with a dead phi. A live phi has been
+ // handled by the type propagation phase, unlike a dead phi.
+ if (next->IsLive()) {
+ phi->ReplaceWith(next);
+ } else {
+ next->ReplaceWith(phi);
+ }
DCHECK(next->GetNextEquivalentPhiWithSameType() == nullptr)
<< "More then one phi equivalent with type " << phi->GetType()
<< " found for phi" << phi->GetId();