This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should gcc-4.0 apply mathematical associative rules for addition or multiplication



On Oct 4, 2004, at 4:48 PM, Roger Sayle wrote:



On Mon, 4 Oct 2004, Andrew Pinski wrote:
Obviously I mean:
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.58
diff -u -p -r2.58 tree-ssa-dom.c
--- tree-ssa-dom.c 4 Oct 2004 13:19:20 -0000 2.58
+++ tree-ssa-dom.c 4 Oct 2004 23:19:07 -0000
@@ -1598,7 +1598,9 @@ simplify_rhs_and_lookup_avail_expr (stru
assignment. Add minus to this, as we handle it specially below.
*/
if ((associative_tree_code (rhs_code) || rhs_code == MINUS_EXPR)
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && is_gimple_min_invariant (TREE_OPERAND (rhs, 1)))
+ && is_gimple_min_invariant (TREE_OPERAND (rhs, 1))
+ && (!FLOAT_TYPE_P (TREE_TYPE (rhs))
+ || flag_unsafe_math_optimizations))
{
tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));



Ok for mainline, after bootstrap and regression testing, with a ChangeLog
entry and a suitable test case for the testsuite.

associative_tree_code also returns true for MIN_EXPR/MAX_EXPR. I think we want to only
exclude PLUS_EXPR/MULT_EXPR.


- fariborz



Roger --



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]