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
This commit is contained in:
Jakub Jelinek 2008-09-10 10:00:40 +02:00 committed by Jakub Jelinek
parent 5392e447a2
commit 6b672a2906
4 changed files with 43 additions and 9 deletions

View File

@ -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

View File

@ -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>

View File

@ -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
}

View File

@ -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);