Index: tree-ssa-dom.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v retrieving revision 2.56 diff -c -p -r2.56 tree-ssa-dom.c *** tree-ssa-dom.c 29 Sep 2004 02:50:46 -0000 2.56 --- tree-ssa-dom.c 5 Oct 2004 19:51:39 -0000 *************** static void restore_currdefs_to_original *** 266,271 **** --- 266,272 ---- static void register_definitions_for_stmt (tree); static edge single_incoming_edge_ignoring_loop_edges (basic_block); static void restore_nonzero_vars_to_original_value (void); + static inline bool unsafe_associative_fp_binop (tree); /* Local version of fold that doesn't introduce cruft. */ *************** record_equality (tree x, tree y) *** 1547,1552 **** --- 1548,1563 ---- record_const_or_copy_1 (x, y, prev_x); } + /* return true, if it is ok to do folding of an associative expression */ + static inline bool + unsafe_associative_fp_binop (tree exp) + { + enum tree_code code = TREE_CODE (exp); + return !(!flag_unsafe_math_optimizations + && (code == MULT_EXPR || code == PLUS_EXPR) + && FLOAT_TYPE_P (TREE_TYPE (exp))); + } + /* STMT is a MODIFY_EXPR for which we were unable to find RHS in the hash tables. Try to simplify the RHS using whatever equivalences we may have recorded. *************** simplify_rhs_and_lookup_avail_expr (stru *** 1606,1612 **** tree rhs_def_rhs = TREE_OPERAND (rhs_def_stmt, 1); enum tree_code rhs_def_code = TREE_CODE (rhs_def_rhs); ! if (rhs_code == rhs_def_code || (rhs_code == PLUS_EXPR && rhs_def_code == MINUS_EXPR) || (rhs_code == MINUS_EXPR && rhs_def_code == PLUS_EXPR)) { --- 1617,1623 ---- tree rhs_def_rhs = TREE_OPERAND (rhs_def_stmt, 1); enum tree_code rhs_def_code = TREE_CODE (rhs_def_rhs); ! if ((rhs_code == rhs_def_code && unsafe_associative_fp_binop (rhs)) || (rhs_code == PLUS_EXPR && rhs_def_code == MINUS_EXPR) || (rhs_code == MINUS_EXPR && rhs_def_code == PLUS_EXPR)) {