Hello, This patch does rename break_up_subtract_bb to break_up_expr_bb, and it modifies build_and_add_sum so that unary expression can be created by it, too. The patch is a prerequisit of the following 6 additional patches.
ChangeLog 2011-10-07 Kai Tietz <kti...@redhat.com> * tree-ssa-reassoc.c (break_up_subtract_bb): Rename to (break_up_expr_bb): as function name. (build_and_add_sum): Add support for unary statement creation. Index: gcc/gcc/tree-ssa-reassoc.c =================================================================== --- gcc.orig/gcc/tree-ssa-reassoc.c +++ gcc/gcc/tree-ssa-reassoc.c @@ -44,6 +44,9 @@ along with GCC; see the file COPYING3. #include "params.h" #include "diagnostic-core.h" +/* Forwarders. */ +static gimple build_and_add_sum (tree, tree, tree, enum tree_code); + /* This is a simple global reassociation pass. It is, in part, based on the LLVM pass of the same name (They do some things more/less than we do, in different orders, etc). @@ -1018,8 +1021,8 @@ zero_one_operation (tree *def, enum tree while (1); } -/* Builds one statement performing OP1 OPCODE OP2 using TMPVAR for - the result. Places the statement after the definition of either +/* Builds one statement performing OP1 OPCODE OP2, or OPCODE OP1 using + TMPVAR for the result. Places the statement after the definition of either OP1 or OP2. Returns the new statement. */ static gimple @@ -1038,7 +1041,7 @@ build_and_add_sum (tree tmpvar, tree op1 /* Find an insertion place and insert. */ if (TREE_CODE (op1) == SSA_NAME) op1def = SSA_NAME_DEF_STMT (op1); - if (TREE_CODE (op2) == SSA_NAME) + if (op2 && TREE_CODE (op2) == SSA_NAME) op2def = SSA_NAME_DEF_STMT (op2); if ((!op1def || gimple_nop_p (op1def)) && (!op2def || gimple_nop_p (op2def))) @@ -2777,7 +2780,7 @@ can_reassociate_p (tree op) En passant, clear the GIMPLE visited flag on every statement. */ static void -break_up_subtract_bb (basic_block bb) +break_up_expr_bb (basic_block bb) { gimple_stmt_iterator gsi; basic_block son; @@ -2812,7 +2815,7 @@ break_up_subtract_bb (basic_block bb) for (son = first_dom_son (CDI_DOMINATORS, bb); son; son = next_dom_son (CDI_DOMINATORS, son)) - break_up_subtract_bb (son); + break_up_expr_bb (son); } /* Reassociate expressions in basic block BB and its post-dominator as @@ -2981,7 +2984,7 @@ debug_ops_vector (VEC (operand_entry_t, static void do_reassoc (void) { - break_up_subtract_bb (ENTRY_BLOCK_PTR); + break_up_expr_bb (ENTRY_BLOCK_PTR); reassociate_bb (EXIT_BLOCK_PTR); }