diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-29 14:34:46 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-29 22:21:51 +0100 |
commit | fecc4659d0a4ac1e0e16e82b47e5592fff1d827f (patch) | |
tree | 88b5aba678a4abb911b4995a47661df12f6a4d03 /compiler | |
parent | d735c41e95a5d89cc9dad0c78d7d052579d8bd41 (diff) | |
download | art-fecc4659d0a4ac1e0e16e82b47e5592fff1d827f.zip art-fecc4659d0a4ac1e0e16e82b47e5592fff1d827f.tar.gz art-fecc4659d0a4ac1e0e16e82b47e5592fff1d827f.tar.bz2 |
Do not replace a live phi with a dead phi.
A dead phi is not properly typed. Therefore, always use the live phi
equivalent instead.
bug:21865466
(cherry picked from commit 4230e1895b915a22363452823b0e51eabe92cb60)
Change-Id: If9a3313fc953c2eb4be85b625676e48112fcb1f6
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 8 |
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(); |