diff options
author | Calin Juravle <calin@google.com> | 2015-04-16 15:53:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-16 15:53:23 +0000 |
commit | e7bee3b7d307508243f4a00b5cf8a8867fcaaff5 (patch) | |
tree | b9d350a3d1432d7546e5feab77e25807d328300a /compiler/optimizing/nodes.h | |
parent | 59bb47675b1f1bafbcababadb4a6ba1c345fec1a (diff) | |
parent | a4f8831d6533e4fe5aed18433099e1130d95a877 (diff) | |
download | art-e7bee3b7d307508243f4a00b5cf8a8867fcaaff5.tar.gz art-e7bee3b7d307508243f4a00b5cf8a8867fcaaff5.tar.bz2 art-e7bee3b7d307508243f4a00b5cf8a8867fcaaff5.zip |
Merge "Remove duplicates phis created during SSA transformation"
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index fe47939359..649038b532 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2752,6 +2752,20 @@ class HPhi : public HInstruction { bool IsDead() const { return !is_live_; } bool IsLive() const { return is_live_; } + // Returns the next equivalent phi (starting from the current one) or null if there is none. + // An equivalent phi is a phi having the same dex register and type. + // It assumes that phis with the same dex register are adjacent. + HPhi* GetNextEquivalentPhiWithSameType() { + HInstruction* next = GetNext(); + while (next != nullptr && next->AsPhi()->GetRegNumber() == reg_number_) { + if (next->GetType() == GetType()) { + return next->AsPhi(); + } + next = next->GetNext(); + } + return nullptr; + } + DECLARE_INSTRUCTION(Phi); protected: |