This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix SCCVN infinite memory use
- From: "Daniel Berlin" <dberlin at dberlin dot org>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 2 Jul 2007 23:22:17 -0400
- Subject: [PATCH]: Fix SCCVN infinite memory use
Due to the fact that we do not share floating point constants, we
sadly have to use operand_equal_p before declaring the SSA_VAL's
unequal.
I will commit as soon as bootstrap and regtesting finishes on i686-darwin.
The testcase was given to me on IRC by andrew pinski :)
2007-07-02 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-sccvn.c (set_ssa_val_to): Check for operand_equal_p
before declaring inequality.
Index: tree-ssa-sccvn.c
===================================================================
--- tree-ssa-sccvn.c (revision 126237)
+++ tree-ssa-sccvn.c (working copy)
@@ -1014,6 +1014,7 @@ print_scc (FILE *out, VEC (tree, heap) *
static inline bool
set_ssa_val_to (tree from, tree to)
{
+ tree currval;
gcc_assert (to != NULL);
/* Make sure we don't create chains of copies, so that we get the
@@ -1037,7 +1038,9 @@ set_ssa_val_to (tree from, tree to)
fprintf (dump_file, "\n");
}
- if (SSA_VAL (from) != to)
+ currval = SSA_VAL (from);
+
+ if (currval != to && !operand_equal_p (currval, to, OEP_PURE_SAME))
{
SSA_VAL (from) = to;
return true;
Index: ChangeLog
===================================================================
--- ChangeLog (revision 126237)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2007-07-02 Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-ssa-sccvn.c (set_ssa_val_to): Check for operand_equal_p
+ before declaring inequality.
+
2007-07-02 Eric Botcazou <ebotcazou@adacore.com>
* tree.h (alias_sets_might_conflict_p): Rename into
Index: testsuite/gcc.c-torture/compile/ssa-pre-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/ssa-pre-1.c (revision 0)
+++ testsuite/gcc.c-torture/compile/ssa-pre-1.c (revision 0)
@@ -0,0 +1,19 @@
+void washQtoM3(double m[9], double q[4]);
+double sqrt(double);
+int f(int samp)
+{
+ double clp[2], xyz[3], q[4], len;
+ double mRF[9];
+ int xi;
+ for (xi=0; xi<samp; xi++)
+ {
+ q[0] = 1.0;
+ q[1] = ( ((double)(1)-(-1))*((double)((float)xi)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1));
+ q[2] = ( ((double)(1)-(-1))*((double)((float)0)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1));
+ q[3] = ( ((double)(1)-(-1))*((double)((float)0)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1));
+ len = (sqrt((((q))[0]*((q))[0] + ((q))[1]*((q))[1] + ((q))[2]*((q))[2] + ((q))[3]*((q))[3])));
+ ((q)[0] = (q)[0]*1.0/len, (q)[1] = (q)[1]*1.0/len, (q)[2] = (q)[2]*1.0/len, (q)[3] = (q)[3]*1.0/len);
+ washQtoM3(mRF, q);
+ }
+ return 0;
+}
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 126237)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2007-07-02 Daniel Berlin <dberlin@dberlin.org>
+
+ * gcc.c-torture/compile/ssa-pre-1.c: New test.
+
2007-07-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/c99-math.h: Fix typo.