aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2019-11-21 15:58:08 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-21 14:58:08 +0000
commitb0d5547612f08d7112d9284a7b5a862df3373570 (patch)
treeb47107257744ee912baa2c52e72eef798328f1f5 /gcc/ipa-cp.c
parent48ffab987ae013a642398ef4fe5ffdce71571ba5 (diff)
downloadgcc-b0d5547612f08d7112d9284a7b5a862df3373570.zip
gcc-b0d5547612f08d7112d9284a7b5a862df3373570.tar.gz
gcc-b0d5547612f08d7112d9284a7b5a862df3373570.tar.bz2
ipa-fnsummary.c (evaluate_conditions_for_known_args): Be ready for some vectors to not be allocated.
* ipa-fnsummary.c (evaluate_conditions_for_known_args): Be ready for some vectors to not be allocated. (evaluate_properties_for_edge): Document better; make known_vals and known_aggs caller allocated; avoid determining values of parameters which are not used. (ipa_merge_fn_summary_after_inlining): Pre allocate known_vals and known_aggs. * ipa-inline-analysis.c (do_estimate_edge_time): Likewise. (do_estimate_edge_size): Likewise. (do_estimate_edge_hints): Likewise. * ipa-cp.c (ipa_get_indirect_edge_target_1): Do not early exit when values are not known. (ipa_release_agg_values): Add option to not release vector itself. From-SVN: r278553
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 8372dfa..31a98a3 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2744,18 +2744,17 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
{
int param_index = ie->indirect_info->param_index;
HOST_WIDE_INT anc_offset;
- tree t;
+ tree t = NULL;
tree target = NULL;
*speculative = false;
- if (param_index == -1
- || known_csts.length () <= (unsigned int) param_index)
+ if (param_index == -1)
return NULL_TREE;
if (!ie->indirect_info->polymorphic)
{
- tree t;
+ tree t = NULL;
if (ie->indirect_info->agg_contents)
{
@@ -2782,7 +2781,11 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
else
agg = NULL;
bool from_global_constant;
- t = ipa_find_agg_cst_for_param (agg, known_csts[param_index],
+ t = ipa_find_agg_cst_for_param (agg,
+ (unsigned) param_index
+ < known_csts.length ()
+ ? known_csts[param_index]
+ : NULL,
ie->indirect_info->offset,
ie->indirect_info->by_ref,
&from_global_constant);
@@ -2792,7 +2795,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
t = NULL_TREE;
}
}
- else
+ else if ((unsigned) param_index < known_csts.length ())
t = known_csts[param_index];
if (t
@@ -2833,7 +2836,10 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
&& !ie->indirect_info->by_ref)
{
struct ipa_agg_value_set *agg = &known_aggs[param_index];
- t = ipa_find_agg_cst_for_param (agg, known_csts[param_index],
+ t = ipa_find_agg_cst_for_param (agg,
+ (unsigned) param_index
+ < known_csts.length ()
+ ? known_csts[param_index] : NULL,
ie->indirect_info->offset, true);
}
@@ -2867,7 +2873,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
}
/* Do we know the constant value of pointer? */
- if (!t)
+ if (!t && (unsigned) param_index < known_csts.length ())
t = known_csts[param_index];
gcc_checking_assert (!t || TREE_CODE (t) != TREE_BINFO);