From f652917de5634b30c974c81d35a72871915b352a Mon Sep 17 00:00:00 2001 From: Mark Mendell Date: Tue, 17 Nov 2015 11:16:56 -0500 Subject: Simplify boolean condition compared to 0 CaffeineMarkRR Logic has some boolean flipping which can be helped by some simplification. Simplify non-FP (A COND_OP B) != 0 to A OPPOSITE_COND_OP B. This is better than the original code, which would use a HBooleanNot after the condition. Also simplify non-FP (A COND_OP B) == 1 to A OPPOSITE_COND_OP B. Move GetOppositeCondition to nodes.h/nodes.cc to share with Boolean Simplification, renaming it to InsertOppositeCondition, as it inserts the new HInstruction (unless it is a constant). Change-Id: I34ded7758836e375de0d6fdba9239d2d451928d0 Signed-off-by: Mark Mendell --- compiler/optimizing/nodes.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 4f894b07c7..744067f59a 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -371,6 +371,11 @@ class HGraph : public ArenaObject { bool HasTryCatch() const { return has_try_catch_; } void SetHasTryCatch(bool value) { has_try_catch_ = value; } + // Returns an instruction with the opposite boolean value from 'cond'. + // The instruction has been inserted into the graph, either as a constant, or + // before cursor. + HInstruction* InsertOppositeCondition(HInstruction* cond, HInstruction* cursor); + private: void FindBackEdges(ArenaBitVector* visited); void RemoveInstructionsAsUsersFromDeadBlocks(const ArenaBitVector& visited) const; -- cgit v1.2.3-59-g8ed1b