aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-10 10:00:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-10 10:00:40 +0200
commit6b672a290664a1ea25964af68906199a342528f3 (patch)
treee64e8401f364f5c34df73d5e3bc338cfbb095f89 /gcc
parent5392e447a273eca3e6f9a7b9e73c528f42c60a6e (diff)
downloadgcc-6b672a290664a1ea25964af68906199a342528f3.zip
gcc-6b672a290664a1ea25964af68906199a342528f3.tar.gz
gcc-6b672a290664a1ea25964af68906199a342528f3.tar.bz2
re PR tree-optimization/37353 (ICE: vector VEC(gimple,base) push domain error, in tree_call_cdce at tree-call-cdce.c:890)
PR tree-optimization/37353 * tree-call-cdce.c (cond_dead_built_in_calls): Remove. (shrink_wrap_conditional_dead_built_in_calls): Add calls argument, use calls instead of cond_dead_built_in_calls. (tree_call_cdce): Add cond_dead_built_in_calls automatic variable, initalize the vector only before adding first entry. Use VEC_safe_push instead of VEC_quick_push. Pass cond_dead_built_in_calls to shrink_wrap_conditional_dead_built_in_calls call. * gcc.dg/pr37353.c: New test. From-SVN: r140208
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr37353.c15
-rw-r--r--gcc/tree-call-cdce.c21
4 files changed, 43 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 93421f7..8c231a2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/37353
+ * tree-call-cdce.c (cond_dead_built_in_calls): Remove.
+ (shrink_wrap_conditional_dead_built_in_calls): Add calls argument, use
+ calls instead of cond_dead_built_in_calls.
+ (tree_call_cdce): Add cond_dead_built_in_calls automatic variable,
+ initalize the vector only before adding first entry. Use VEC_safe_push
+ instead of VEC_quick_push. Pass cond_dead_built_in_calls to
+ shrink_wrap_conditional_dead_built_in_calls call.
+
2008-09-10 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/37385
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b9e4442..51332f3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/37353
+ * gcc.dg/pr37353.c: New test.
+
2008-09-10 Martin Michlmayr <tbm@cyrius.com>
Ira Rosen <irar@il.ibm.com>
diff --git a/gcc/testsuite/gcc.dg/pr37353.c b/gcc/testsuite/gcc.dg/pr37353.c
new file mode 100644
index 0000000..07d73d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr37353.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/37353 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern double exp (double);
+
+#define A exp (arg);
+#define B A A A A A A A A A A
+#define C B B B B B B B B B B
+
+void
+foo (double arg)
+{
+ C
+}
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index f59f083..da66138 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -99,8 +99,6 @@ typedef struct input_domain
bool is_ub_inclusive;
} inp_domain;
-static VEC (gimple, heap) *cond_dead_built_in_calls;
-
/* A helper function to construct and return an input
domain object. LB is the lower bound, HAS_LB is
a boolean flag indicating if the lower bound exists,
@@ -844,18 +842,18 @@ shrink_wrap_one_built_in_call (gimple bi_call)
wrapping transformation. */
static bool
-shrink_wrap_conditional_dead_built_in_calls (void)
+shrink_wrap_conditional_dead_built_in_calls (VEC (gimple, heap) *calls)
{
bool changed = false;
unsigned i = 0;
- unsigned n = VEC_length (gimple, cond_dead_built_in_calls);
+ unsigned n = VEC_length (gimple, calls);
if (n == 0)
return false;
for (; i < n ; i++)
{
- gimple bi_call = VEC_index (gimple, cond_dead_built_in_calls, i);
+ gimple bi_call = VEC_index (gimple, calls, i);
changed |= shrink_wrap_one_built_in_call (bi_call);
}
@@ -870,8 +868,7 @@ tree_call_cdce (void)
basic_block bb;
gimple_stmt_iterator i;
bool something_changed = false;
- cond_dead_built_in_calls = VEC_alloc (gimple, heap, 64);
-
+ VEC (gimple, heap) *cond_dead_built_in_calls = NULL;
FOR_EACH_BB (bb)
{
/* Collect dead call candidates. */
@@ -887,12 +884,18 @@ tree_call_cdce (void)
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
- VEC_quick_push (gimple, cond_dead_built_in_calls, stmt);
+ if (cond_dead_built_in_calls == NULL)
+ cond_dead_built_in_calls = VEC_alloc (gimple, heap, 64);
+ VEC_safe_push (gimple, heap, cond_dead_built_in_calls, stmt);
}
}
}
- something_changed = shrink_wrap_conditional_dead_built_in_calls ();
+ if (cond_dead_built_in_calls == NULL)
+ return 0;
+
+ something_changed
+ = shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls);
VEC_free (gimple, heap, cond_dead_built_in_calls);