summaryrefslogtreecommitdiff
path: root/gcc/tree-call-cdce.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-10 08:00:40 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-10 08:00:40 +0000
commit86ed2c774c6524ddd483848d613c79d9d078d18d (patch)
treee64e8401f364f5c34df73d5e3bc338cfbb095f89 /gcc/tree-call-cdce.c
parentf22f3f12ec431f1903625d8c9a25966e14581f63 (diff)
downloadgcc-86ed2c774c6524ddd483848d613c79d9d078d18d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-call-cdce.c')
-rw-r--r--gcc/tree-call-cdce.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index f59f083d5c9..da66138a466 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);