From: amonakov Date: Thu, 22 Apr 2010 12:44:30 +0000 (+0000) Subject: 2010-04-22 Alexander Monakov X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=cddf5ee2738c67f981c8cfddbc149b5989fd152e;hp=321a43b7fb462fcc5e031fb30a6421957db781d6 2010-04-22 Alexander Monakov * tree-ssa-reassoc.c (eliminate_plus_minus_pair): Handle BIT_NOT_EXPR to simplify a + ~a. * gfortran.dg/reassoc_6.f: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158645 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89624463e9d..7b111280ccf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-04-22 Alexander Monakov + + * tree-ssa-reassoc.c (eliminate_plus_minus_pair): Handle BIT_NOT_EXPR + to simplify a + ~a. + 2010-04-22 Laurynas Biveinis * tree-parloops.c (loop_parallel_p): New argument diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d87f0211bf9..b31b49724e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-04-22 Alexander Monakov + + * gfortran.dg/reassoc_6.f: New testcase. + 2010-04-22 Bernd Schmidt PR middle-end/29274 diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 560dea945f0..039ad6d96a8 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -489,11 +489,11 @@ eliminate_duplicate_pair (enum tree_code opcode, static VEC(tree, heap) *plus_negates; -/* If OPCODE is PLUS_EXPR, CURR->OP is really a negate expression, - look in OPS for a corresponding positive operation to cancel it - out. If we find one, remove the other from OPS, replace - OPS[CURRINDEX] with 0, and return true. Otherwise, return - false. */ +/* If OPCODE is PLUS_EXPR, CURR->OP is a negate expression or a bitwise not + expression, look in OPS for a corresponding positive operation to cancel + it out. If we find one, remove the other from OPS, replace + OPS[CURRINDEX] with 0 or -1, respectively, and return true. Otherwise, + return false. */ static bool eliminate_plus_minus_pair (enum tree_code opcode, @@ -567,7 +567,8 @@ eliminate_plus_minus_pair (enum tree_code opcode, /* CURR->OP is a negate expr in a plus expr: save it for later inspection in repropagate_negates(). */ - VEC_safe_push (tree, heap, plus_negates, curr->op); + if (negateop != NULL_TREE) + VEC_safe_push (tree, heap, plus_negates, curr->op); return false; }