diff options
author | 2015-04-27 13:54:09 +0100 | |
---|---|---|
committer | 2015-04-27 17:00:58 +0100 | |
commit | 769c9e539da8ca80aa914cd12276aa5bd79148ee (patch) | |
tree | 9aadf98a3fcbf7909f76c53fa2ee036ebda00304 /compiler/optimizing/nodes.h | |
parent | 0fbfe6f92a2481daf914043262b5854e65d8c3cc (diff) |
ART: Simplify Ifs with BooleanNot condition
If statements with negated condition can be simplified by removing the
negation and swapping the true and false branches.
Change-Id: I197afbc79fb7344d73b7b85d3611e7ca2519717f
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 753c95b477..863b0b9c3a 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -526,6 +526,13 @@ class HBasicBlock : public ArenaObject<kArenaAllocMisc> { predecessors_.Put(1, temp); } + void SwapSuccessors() { + DCHECK_EQ(successors_.Size(), 2u); + HBasicBlock* temp = successors_.Get(0); + successors_.Put(0, successors_.Get(1)); + successors_.Put(1, temp); + } + size_t GetPredecessorIndexOf(HBasicBlock* predecessor) { for (size_t i = 0, e = predecessors_.Size(); i < e; ++i) { if (predecessors_.Get(i) == predecessor) { |