This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14303] [tree-ssa] gcc.c-torture/execute/20020720-1.c is not fully folded
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Feb 2004 01:49:36 -0000
- Subject: [Bug optimization/14303] [tree-ssa] gcc.c-torture/execute/20020720-1.c is not fully folded
- References: <20040226014301.14303.kazu@cs.umass.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From steven at gcc dot gnu dot org 2004-02-29 01:49 -------
I would propose something along the lines of this if I knew when this
transformation is valid/safe...
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.213.2.75
diff -c -3 -p -r1.213.2.75 fold-const.c
*** fold-const.c 27 Feb 2004 21:50:48 -0000 1.213.2.75
--- fold-const.c 29 Feb 2004 01:44:44 -0000
*************** fold (tree expr)
*** 7245,7250 ****
--- 7245,7261 ----
return fold (build (code, type, arg0,
build_real (TREE_TYPE (arg1), dconst0)));
+ /* abs(x) < 0.0 -> false
+ abs(x) >= 0.0 -> true. */
+ if (REAL_VALUES_EQUAL (cst, dconst0)
+ && TREE_CODE (arg0) == ABS_EXPR)
+ {
+ if (code == LT_EXPR)
+ return boolean_false_node;
+ if (code == GE_EXPR)
+ return boolean_true_node;
+ }
+
/* x != NaN is always true, other ops are always false. */
if (REAL_VALUE_ISNAN (cst)
&& ! HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1))))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14303