summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-09 11:09:25 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-09 11:09:25 +0000
commitbbe1fc8fc4cc8514ddc35a113d93c882ea33142f (patch)
treea5a4fa014573b90d9d7e979aabb0ae0586189fe4 /gcc
parentfd49466951f7a9b62ec981be537381f35491904c (diff)
downloadgcc-bbe1fc8fc4cc8514ddc35a113d93c882ea33142f.tar.gz
PR middle-end/38981
* tree-ssa-coalesce.c (add_coalesce): Cap the costs of coalesce pairs at MUST_COALESCE_COST-1 instead of MUST_COALESCE_COST. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20090209-1.c61
-rw-r--r--gcc/tree-ssa-coalesce.c13
4 files changed, 77 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a6deff996a4..b1e2ae8b875 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/38981
+ * tree-ssa-coalesce.c (add_coalesce): Cap the costs of coalesce pairs
+ at MUST_COALESCE_COST-1 instead of MUST_COALESCE_COST.
+
2009-02-09 Richard Guenther <rguenther@suse.de>
PR middle-end/35202
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7cde83d6c5e..cd90ac8d78a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-02-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/compile/20090209-1.c: New test.
+
2009-02-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35147
diff --git a/gcc/testsuite/gcc.c-torture/compile/20090209-1.c b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c
new file mode 100644
index 00000000000..781a5e8fd0d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c
@@ -0,0 +1,61 @@
+/* PR middle-end/38981 */
+/* Reporter: Kamaraju Kusumanchi <kamaraju@gmail.com> */
+
+struct d_info
+{
+ int **subs;
+};
+
+static int *
+d_substitution (struct d_info *di, int prefix)
+{
+ char c;
+
+ c='_';
+
+ if (c == '_')
+ {
+ unsigned int id;
+
+ if (c != '_')
+ {
+ do
+ {
+ unsigned int new_id;
+
+ if (new_id < id)
+ return 0;
+ id = new_id;
+ }
+ while (c != '_');
+ }
+
+
+
+ return di->subs[id];
+ }
+ else
+ {
+ int verbose;
+ int code;
+ int simple_len;
+
+ code=0;
+ simple_len=0;
+ verbose=0;
+ if (! code && prefix)
+ {
+ char peek;
+ peek='A';
+
+ if (peek == 'C' || peek == 'D')
+ verbose = 1;
+ }
+
+ if (verbose)
+ {
+ code = simple_len;
+ }
+
+ }
+}
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 3af0c3285d8..8ac74f0c290 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -284,8 +284,7 @@ add_cost_one_coalesce (coalesce_list_p cl, int p1, int p2)
/* Add a coalesce between P1 and P2 in list CL with a cost of VALUE. */
static inline void
-add_coalesce (coalesce_list_p cl, int p1, int p2,
- int value)
+add_coalesce (coalesce_list_p cl, int p1, int p2, int value)
{
coalesce_pair_p node;
@@ -295,13 +294,13 @@ add_coalesce (coalesce_list_p cl, int p1, int p2,
node = find_coalesce_pair (cl, p1, p2, true);
- /* Once the value is MUST_COALESCE_COST, leave it that way. */
- if (node->cost != MUST_COALESCE_COST)
+ /* Once the value is at least MUST_COALESCE_COST - 1, leave it that way. */
+ if (node->cost < MUST_COALESCE_COST - 1)
{
- if (value == MUST_COALESCE_COST)
- node->cost = value;
- else
+ if (value < MUST_COALESCE_COST - 1)
node->cost += value;
+ else
+ node->cost = value;
}
}