OSDN Git Service

2010-04-22 Alexander Monakov <amonakov@ispras.ru>
authoramonakov <amonakov@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Apr 2010 12:44:30 +0000 (12:44 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:35:04 +0000 (14:35 +0900)
* 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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-ssa-reassoc.c

index 8962446..7b11128 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-22  Alexander Monakov  <amonakov@ispras.ru>
+
+       * tree-ssa-reassoc.c (eliminate_plus_minus_pair): Handle BIT_NOT_EXPR
+       to simplify a + ~a.
+
 2010-04-22  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
 
        * tree-parloops.c (loop_parallel_p): New argument
index d87f021..b31b497 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-22  Alexander Monakov  <amonakov@ispras.ru>
+
+       * gfortran.dg/reassoc_6.f: New testcase.
+
 2010-04-22  Bernd Schmidt  <bernds@codesourcery.com>
 
        PR middle-end/29274
index 560dea9..039ad6d 100644 (file)
@@ -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;
 }