diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 1079 |
2 files changed, 541 insertions, 542 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e565b0..f7b15c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-01-01 Jan Hubicka <jh@suse.cz> + + * ipa-inline-analysis.c: Fix formatting. + 2013-01-01 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/55831 diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 8f5b1f2..3e03b31 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -1,5 +1,5 @@ /* Inlining decision heuristics. - Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011 + Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Jan Hubicka @@ -127,8 +127,7 @@ static void inline_node_duplication_hook (struct cgraph_node *, struct cgraph_node *, void *); static void inline_edge_removal_hook (struct cgraph_edge *, void *); static void inline_edge_duplication_hook (struct cgraph_edge *, - struct cgraph_edge *, - void *); + struct cgraph_edge *, void *); /* VECtor holding inline summaries. In GGC memory because conditions might point to constant trees. */ @@ -200,6 +199,7 @@ false_predicate_p (struct predicate *p) /* Return predicate that is set true when function is not inlined. */ + static inline struct predicate not_inlined_predicate (void) { @@ -254,7 +254,7 @@ add_condition (struct inline_summary *summary, int operand_num, && c->val == val && c->agg_contents == agg_contents && (!agg_contents || (c->offset == offset && c->by_ref == by_ref))) - return single_cond_predicate (i + predicate_first_dynamic_condition); + return single_cond_predicate (i + predicate_first_dynamic_condition); } /* Too many conditions. Give up and return constant true. */ if (i == NUM_CONDITIONS - predicate_first_dynamic_condition) @@ -321,7 +321,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause) insert_here = i2; /* If clause implies p->clause[i], then p->clause[i] becomes redundant. - Otherwise the p->clause[i] has to stay. */ + Otherwise the p->clause[i] has to stay. */ if ((p->clause[i] & clause) != clause) i2++; } @@ -335,26 +335,27 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause) continue; cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition]; /* We have no way to represent !CHANGED and !IS_NOT_CONSTANT - and thus there is no point for looking for them. */ - if (cc1->code == CHANGED - || cc1->code == IS_NOT_CONSTANT) + and thus there is no point for looking for them. */ + if (cc1->code == CHANGED || cc1->code == IS_NOT_CONSTANT) continue; for (c2 = c1 + 1; c2 <= NUM_CONDITIONS; c2++) if (clause & (1 << c2)) { - condition *cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition]; - condition *cc2 = &(*conditions)[c2 - predicate_first_dynamic_condition]; + condition *cc1 = + &(*conditions)[c1 - predicate_first_dynamic_condition]; + condition *cc2 = + &(*conditions)[c2 - predicate_first_dynamic_condition]; if (cc1->operand_num == cc2->operand_num && cc1->val == cc2->val && cc2->code != IS_NOT_CONSTANT && cc2->code != CHANGED - && cc1->code == invert_tree_comparison - (cc2->code, - HONOR_NANS (TYPE_MODE (TREE_TYPE (cc1->val))))) + && cc1->code == invert_tree_comparison + (cc2->code, + HONOR_NANS (TYPE_MODE (TREE_TYPE (cc1->val))))) return; } } - + /* We run out of variants. Be conservative in positive direction. */ if (i2 == MAX_CLAUSES) @@ -362,7 +363,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause) /* Keep clauses in decreasing order. This makes equivalence testing easy. */ p->clause[i2 + 1] = 0; if (insert_here >= 0) - for (;i2 > insert_here; i2--) + for (; i2 > insert_here; i2--) p->clause[i2] = p->clause[i2 - 1]; else insert_here = i2; @@ -390,7 +391,7 @@ and_predicates (conditions conditions, { gcc_checking_assert (i < MAX_CLAUSES); } - + /* Combine the predicates rest. */ for (; p2->clause[i]; i++) { @@ -410,11 +411,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2) for (i = 0; p->clause[i]; i++) { gcc_checking_assert (i < MAX_CLAUSES); - gcc_checking_assert (p->clause [i] > p->clause[i + 1]); + gcc_checking_assert (p->clause[i] > p->clause[i + 1]); gcc_checking_assert (!p2->clause[i] - || p2->clause [i] > p2->clause[i + 1]); + || p2->clause[i] > p2->clause[i + 1]); if (p->clause[i] != p2->clause[i]) - return false; + return false; } return !p2->clause[i]; } @@ -423,10 +424,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2) /* Return P | P2. */ static struct predicate -or_predicates (conditions conditions, struct predicate *p, struct predicate *p2) +or_predicates (conditions conditions, + struct predicate *p, struct predicate *p2) { struct predicate out = true_predicate (); - int i,j; + int i, j; /* Avoid busy work. */ if (false_predicate_p (p2) || true_predicate_p (p)) @@ -440,8 +442,8 @@ or_predicates (conditions conditions, struct predicate *p, struct predicate *p2) for (i = 0; p->clause[i]; i++) for (j = 0; p2->clause[j]; j++) { - gcc_checking_assert (i < MAX_CLAUSES && j < MAX_CLAUSES); - add_clause (conditions, &out, p->clause[i] | p2->clause[j]); + gcc_checking_assert (i < MAX_CLAUSES && j < MAX_CLAUSES); + add_clause (conditions, &out, p->clause[i] | p2->clause[j]); } return out; } @@ -466,7 +468,7 @@ evaluate_predicate (struct predicate *p, clause_t possible_truths) { gcc_checking_assert (i < MAX_CLAUSES); if (!(p->clause[i] & possible_truths)) - return false; + return false; } return true; } @@ -508,23 +510,25 @@ predicate_probability (conditions conds, { if (i2 >= predicate_first_dynamic_condition) { - condition *c = &(*conds)[i2 - predicate_first_dynamic_condition]; + condition *c = + &(*conds)[i2 - predicate_first_dynamic_condition]; if (c->code == CHANGED - && (c->operand_num - < (int) inline_param_summary.length ())) + && (c->operand_num < + (int) inline_param_summary.length ())) { - int iprob = inline_param_summary[c->operand_num].change_prob; + int iprob = + inline_param_summary[c->operand_num].change_prob; this_prob = MAX (this_prob, iprob); } else this_prob = REG_BR_PROB_BASE; - } - else - this_prob = REG_BR_PROB_BASE; + } + else + this_prob = REG_BR_PROB_BASE; } combined_prob = MIN (this_prob, combined_prob); if (!combined_prob) - return 0; + return 0; } } return combined_prob; @@ -580,7 +584,7 @@ dump_clause (FILE *f, conditions conds, clause_t clause) if (found) fprintf (f, " || "); found = true; - dump_condition (f, conds, i); + dump_condition (f, conds, i); } fprintf (f, ")"); } @@ -599,7 +603,7 @@ dump_predicate (FILE *f, conditions conds, struct predicate *pred) { if (i) fprintf (f, " && "); - dump_clause (f, conds, pred->clause[i]); + dump_clause (f, conds, pred->clause[i]); } fprintf (f, "\n"); } @@ -683,7 +687,7 @@ account_size_time (struct inline_summary *summary, int size, int time, if (predicates_equal_p (&e->predicate, pred)) { found = true; - break; + break; } if (i == 256) { @@ -692,14 +696,16 @@ account_size_time (struct inline_summary *summary, int size, int time, e = &(*summary->entry)[0]; gcc_assert (!e->predicate.clause[0]); if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\t\tReached limit on number of entries, ignoring the predicate."); + fprintf (dump_file, + "\t\tReached limit on number of entries, " + "ignoring the predicate."); } if (dump_file && (dump_flags & TDF_DETAILS) && (time || size)) { - fprintf (dump_file, "\t\tAccounting size:%3.2f, time:%3.2f on %spredicate:", - ((double)size) / INLINE_SIZE_SCALE, - ((double)time) / INLINE_TIME_SCALE, - found ? "" : "new "); + fprintf (dump_file, + "\t\tAccounting size:%3.2f, time:%3.2f on %spredicate:", + ((double) size) / INLINE_SIZE_SCALE, + ((double) time) / INLINE_TIME_SCALE, found ? "" : "new "); dump_predicate (dump_file, summary->conds, pred); } if (!found) @@ -728,13 +734,13 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate) if (predicate && !true_predicate_p (predicate)) { if (!es->predicate) - es->predicate = (struct predicate *)pool_alloc (edge_predicate_pool); + es->predicate = (struct predicate *) pool_alloc (edge_predicate_pool); *es->predicate = *predicate; } else { if (es->predicate) - pool_free (edge_predicate_pool, es->predicate); + pool_free (edge_predicate_pool, es->predicate); es->predicate = NULL; } } @@ -744,8 +750,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate) static void set_hint_predicate (struct predicate **p, struct predicate new_predicate) { - if (false_predicate_p (&new_predicate) - || true_predicate_p (&new_predicate)) + if (false_predicate_p (&new_predicate) || true_predicate_p (&new_predicate)) { if (*p) pool_free (edge_predicate_pool, *p); @@ -754,7 +759,7 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate) else { if (!*p) - *p = (struct predicate *)pool_alloc (edge_predicate_pool); + *p = (struct predicate *) pool_alloc (edge_predicate_pool); **p = new_predicate; } } @@ -769,9 +774,10 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate) static clause_t evaluate_conditions_for_known_args (struct cgraph_node *node, - bool inline_p, - vec<tree> known_vals, - vec<ipa_agg_jump_function_p> known_aggs) + bool inline_p, + vec<tree> known_vals, + vec<ipa_agg_jump_function_p> + known_aggs) { clause_t clause = inline_p ? 0 : 1 << predicate_not_inlined_condition; struct inline_summary *info = inline_summary (node); @@ -784,9 +790,9 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, tree res; /* We allow call stmt to have fewer arguments than the callee function - (especially for K&R style programs). So bound check here (we assume - known_aggs vector, if non-NULL, has the same length as - known_vals). */ + (especially for K&R style programs). So bound check here (we assume + known_aggs vector, if non-NULL, has the same length as + known_vals). */ gcc_checking_assert (!known_aggs.exists () || (known_vals.length () == known_aggs.length ())); if (c->operand_num >= (int) known_vals.length ()) @@ -801,8 +807,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, if (c->code == CHANGED && !c->by_ref - && (known_vals[c->operand_num] - == error_mark_node)) + && (known_vals[c->operand_num] == error_mark_node)) continue; if (known_aggs.exists ()) @@ -828,8 +833,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, if (c->code == IS_NOT_CONSTANT || c->code == CHANGED) continue; res = fold_binary_to_constant (c->code, boolean_type_node, val, c->val); - if (res - && integer_zerop (res)) + if (res && integer_zerop (res)) continue; clause |= 1 << (i + predicate_first_dynamic_condition); } @@ -841,12 +845,13 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, static void evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, - clause_t *clause_ptr, - vec<tree> *known_vals_ptr, - vec<tree> *known_binfos_ptr, - vec<ipa_agg_jump_function_p> *known_aggs_ptr) + clause_t *clause_ptr, + vec<tree> *known_vals_ptr, + vec<tree> *known_binfos_ptr, + vec<ipa_agg_jump_function_p> *known_aggs_ptr) { - struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL); + struct cgraph_node *callee = + cgraph_function_or_thunk_node (e->callee, NULL); struct inline_summary *info = inline_summary (callee); vec<tree> known_vals = vNULL; vec<ipa_agg_jump_function_p> known_aggs = vNULL; @@ -860,8 +865,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, if (ipa_node_params_vector.exists () && !e->call_stmt_cannot_inline_p - && ((clause_ptr && info->conds) - || known_vals_ptr || known_binfos_ptr)) + && ((clause_ptr && info->conds) || known_vals_ptr || known_binfos_ptr)) { struct ipa_node_params *parms_info; struct ipa_edge_args *args = IPA_EDGE_REF (e); @@ -869,9 +873,9 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, int i, count = ipa_get_cs_argument_count (args); if (e->caller->global.inlined_to) - parms_info = IPA_NODE_REF (e->caller->global.inlined_to); + parms_info = IPA_NODE_REF (e->caller->global.inlined_to); else - parms_info = IPA_NODE_REF (e->caller); + parms_info = IPA_NODE_REF (e->caller); if (count && (info->conds || known_vals_ptr)) known_vals.safe_grow_cleared (count); @@ -888,7 +892,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, { if (known_vals.exists () && TREE_CODE (cst) != TREE_BINFO) known_vals[i] = cst; - else if (known_binfos_ptr != NULL && TREE_CODE (cst) == TREE_BINFO) + else if (known_binfos_ptr != NULL + && TREE_CODE (cst) == TREE_BINFO) (*known_binfos_ptr)[i] = cst; } else if (inline_p && !es->param[i].change_prob) @@ -940,8 +945,7 @@ inline_summary_alloc (void) inline_edge_summary_vec.safe_grow_cleared (cgraph_edge_max_uid + 1); if (!edge_predicate_pool) edge_predicate_pool = create_alloc_pool ("edge predicates", - sizeof (struct predicate), - 10); + sizeof (struct predicate), 10); } /* We are called multiple time for given function; clear @@ -950,7 +954,7 @@ inline_summary_alloc (void) static void reset_inline_edge_summary (struct cgraph_edge *e) { - if (e->uid < (int)inline_edge_summary_vec.length ()) + if (e->uid < (int) inline_edge_summary_vec.length ()) { struct inline_edge_summary *es = inline_edge_summary (e); @@ -1005,10 +1009,11 @@ reset_inline_summary (struct cgraph_node *node) /* Hook that is called by cgraph.c when a node is removed. */ static void -inline_node_removal_hook (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) +inline_node_removal_hook (struct cgraph_node *node, + void *data ATTRIBUTE_UNUSED) { struct inline_summary *info; - if (vec_safe_length (inline_summary_vec) <= (unsigned)node->uid) + if (vec_safe_length (inline_summary_vec) <= (unsigned) node->uid) return; info = inline_summary (node); reset_inline_summary (node); @@ -1054,8 +1059,7 @@ remap_hint_predicate_after_duplication (struct predicate **p, return; new_predicate = remap_predicate_after_duplication (*p, - possible_truths, - info); + possible_truths, info); /* We do not want to free previous predicate; it is used by node origin. */ *p = NULL; set_hint_predicate (p, new_predicate); @@ -1065,29 +1069,28 @@ remap_hint_predicate_after_duplication (struct predicate **p, /* Hook that is called by cgraph.c when a node is duplicated. */ static void -inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, +inline_node_duplication_hook (struct cgraph_node *src, + struct cgraph_node *dst, ATTRIBUTE_UNUSED void *data) { struct inline_summary *info; inline_summary_alloc (); info = inline_summary (dst); - memcpy (info, inline_summary (src), - sizeof (struct inline_summary)); + memcpy (info, inline_summary (src), sizeof (struct inline_summary)); /* TODO: as an optimization, we may avoid copying conditions that are known to be false or true. */ info->conds = vec_safe_copy (info->conds); /* When there are any replacements in the function body, see if we can figure out that something was optimized out. */ - if (ipa_node_params_vector.exists () - && dst->clone.tree_map) + if (ipa_node_params_vector.exists () && dst->clone.tree_map) { vec<size_time_entry, va_gc> *entry = info->entry; /* Use SRC parm info since it may not be copied yet. */ struct ipa_node_params *parms_info = IPA_NODE_REF (src); vec<tree> known_vals = vNULL; int count = ipa_get_param_count (parms_info); - int i,j; + int i, j; clause_t possible_truths; struct predicate true_pred = true_predicate (); size_time_entry *e; @@ -1098,15 +1101,13 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, info->entry = 0; known_vals.safe_grow_cleared (count); for (i = 0; i < count; i++) - { + { tree t = ipa_get_param (parms_info, i); struct ipa_replace_map *r; for (j = 0; vec_safe_iterate (dst->clone.tree_map, j, &r); j++) { - if (r->old_tree == t - && r->replace_p - && !r->ref_p) + if (r->old_tree == t && r->replace_p && !r->ref_p) { known_vals[i] = r->new_tree; break; @@ -1114,16 +1115,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, } } possible_truths = evaluate_conditions_for_known_args (dst, false, - known_vals, vNULL); + known_vals, + vNULL); known_vals.release (); account_size_time (info, 0, 0, &true_pred); /* Remap size_time vectors. - Simplify the predicate by prunning out alternatives that are known - to be false. - TODO: as on optimization, we can also eliminate conditions known - to be true. */ + Simplify the predicate by prunning out alternatives that are known + to be false. + TODO: as on optimization, we can also eliminate conditions known + to be true. */ for (i = 0; vec_safe_iterate (entry, i, &e); i++) { struct predicate new_predicate; @@ -1137,7 +1139,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, } /* Remap edge predicates with the same simplification as above. - Also copy constantness arrays. */ + Also copy constantness arrays. */ for (edge = dst->callees; edge; edge = edge->next_callee) { struct predicate new_predicate; @@ -1160,7 +1162,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, } /* Remap indirect edge predicates with the same simplificaiton as above. - Also copy constantness arrays. */ + Also copy constantness arrays. */ for (edge = dst->indirect_calls; edge; edge = edge->next_callee) { struct predicate new_predicate; @@ -1181,21 +1183,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, edge_set_predicate (edge, &new_predicate); } remap_hint_predicate_after_duplication (&info->loop_iterations, - possible_truths, - info); + possible_truths, info); remap_hint_predicate_after_duplication (&info->loop_stride, - possible_truths, - info); + possible_truths, info); remap_hint_predicate_after_duplication (&info->array_index, - possible_truths, - info); + possible_truths, info); /* If inliner or someone after inliner will ever start producing - non-trivial clones, we will get trouble with lack of information - about updating self sizes, because size vectors already contains - sizes of the calees. */ - gcc_assert (!inlined_to_p - || !optimized_out_size); + non-trivial clones, we will get trouble with lack of information + about updating self sizes, because size vectors already contains + sizes of the calees. */ + gcc_assert (!inlined_to_p || !optimized_out_size); } else { @@ -1226,7 +1224,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, /* Hook that is called by cgraph.c when a node is duplicated. */ static void -inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, +inline_edge_duplication_hook (struct cgraph_edge *src, + struct cgraph_edge *dst, ATTRIBUTE_UNUSED void *data) { struct inline_edge_summary *info; @@ -1234,8 +1233,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, inline_summary_alloc (); info = inline_edge_summary (dst); srcinfo = inline_edge_summary (src); - memcpy (info, srcinfo, - sizeof (struct inline_edge_summary)); + memcpy (info, srcinfo, sizeof (struct inline_edge_summary)); info->predicate = NULL; edge_set_predicate (dst, srcinfo->predicate); info->param = srcinfo->param.copy (); @@ -1245,7 +1243,8 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, /* Keep edge cache consistent across edge removal. */ static void -inline_edge_removal_hook (struct cgraph_edge *edge, void *data ATTRIBUTE_UNUSED) +inline_edge_removal_hook (struct cgraph_edge *edge, + void *data ATTRIBUTE_UNUSED) { if (edge_growth_cache.exists ()) reset_edge_growth_cache (edge); @@ -1279,28 +1278,27 @@ free_growth_caches (void) Indent by INDENT. */ static void -dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, +dump_inline_edge_summary (FILE *f, int indent, struct cgraph_node *node, struct inline_summary *info) { struct cgraph_edge *edge; for (edge = node->callees; edge; edge = edge->next_callee) { struct inline_edge_summary *es = inline_edge_summary (edge); - struct cgraph_node *callee = cgraph_function_or_thunk_node (edge->callee, NULL); + struct cgraph_node *callee = + cgraph_function_or_thunk_node (edge->callee, NULL); int i; - fprintf (f, "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i time: %2i callee size:%2i stack:%2i", - indent, "", cgraph_node_name (callee), - callee->uid, - !edge->inline_failed ? "inlined" - : cgraph_inline_failed_string (edge->inline_failed), - indent, "", - es->loop_depth, - edge->frequency, - es->call_stmt_size, - es->call_stmt_time, - (int)inline_summary (callee)->size / INLINE_SIZE_SCALE, - (int)inline_summary (callee)->estimated_stack_size); + fprintf (f, + "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i" + " time: %2i callee size:%2i stack:%2i", + indent, "", cgraph_node_name (callee), callee->uid, + !edge->inline_failed + ? "inlined" : cgraph_inline_failed_string (edge-> inline_failed), + indent, "", es->loop_depth, edge->frequency, + es->call_stmt_size, es->call_stmt_time, + (int) inline_summary (callee)->size / INLINE_SIZE_SCALE, + (int) inline_summary (callee)->estimated_stack_size); if (es->predicate) { @@ -1308,9 +1306,9 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, dump_predicate (f, info->conds, es->predicate); } else - fprintf (f, "\n"); + fprintf (f, "\n"); if (es->param.exists ()) - for (i = 0; i < (int)es->param.length (); i++) + for (i = 0; i < (int) es->param.length (); i++) { int prob = es->param[i].change_prob; @@ -1323,13 +1321,13 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, } if (!edge->inline_failed) { - fprintf (f, "%*sStack frame offset %i, callee self size %i," + fprintf (f, "%*sStack frame offset %i, callee self size %i," " callee size %i\n", - indent+2, "", - (int)inline_summary (callee)->stack_frame_offset, - (int)inline_summary (callee)->estimated_self_stack_size, - (int)inline_summary (callee)->estimated_stack_size); - dump_inline_edge_summary (f, indent+2, callee, info); + indent + 2, "", + (int) inline_summary (callee)->stack_frame_offset, + (int) inline_summary (callee)->estimated_self_stack_size, + (int) inline_summary (callee)->estimated_stack_size); + dump_inline_edge_summary (f, indent + 2, callee, info); } } for (edge = node->indirect_calls; edge; edge = edge->next_callee) @@ -1338,10 +1336,8 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, fprintf (f, "%*sindirect call loop depth:%2i freq:%4i size:%2i" " time: %2i", indent, "", - es->loop_depth, - edge->frequency, - es->call_stmt_size, - es->call_stmt_time); + es->loop_depth, + edge->frequency, es->call_stmt_size, es->call_stmt_time); if (es->predicate) { fprintf (f, "predicate: "); @@ -1354,7 +1350,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, void -dump_inline_summary (FILE * f, struct cgraph_node *node) +dump_inline_summary (FILE *f, struct cgraph_node *node) { if (node->analyzed) { @@ -1367,22 +1363,17 @@ dump_inline_summary (FILE * f, struct cgraph_node *node) fprintf (f, " always_inline"); if (s->inlinable) fprintf (f, " inlinable"); - fprintf (f, "\n self time: %i\n", - s->self_time); + fprintf (f, "\n self time: %i\n", s->self_time); fprintf (f, " global time: %i\n", s->time); - fprintf (f, " self size: %i\n", - s->self_size); + fprintf (f, " self size: %i\n", s->self_size); fprintf (f, " global size: %i\n", s->size); fprintf (f, " self stack: %i\n", (int) s->estimated_self_stack_size); - fprintf (f, " global stack: %i\n", - (int) s->estimated_stack_size); + fprintf (f, " global stack: %i\n", (int) s->estimated_stack_size); if (s->growth) - fprintf (f, " estimated growth:%i\n", - (int) s->growth); + fprintf (f, " estimated growth:%i\n", (int) s->growth); if (s->scc_no) - fprintf (f, " In SCC: %i\n", - (int) s->scc_no); + fprintf (f, " In SCC: %i\n", (int) s->scc_no); for (i = 0; vec_safe_iterate (s->entry, i, &e); i++) { fprintf (f, " size:%f, time:%f, predicate:", @@ -1452,7 +1443,7 @@ initialize_inline_failed (struct cgraph_edge *e) static bool mark_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef ATTRIBUTE_UNUSED, - void *data) + void *data) { bool *b = (bool *) data; *b = true; @@ -1563,116 +1554,117 @@ eliminated_by_inlining_prob (gimple stmt) switch (code) { - case GIMPLE_RETURN: - return 2; - case GIMPLE_ASSIGN: - if (gimple_num_ops (stmt) != 2) - return 0; - - rhs_code = gimple_assign_rhs_code (stmt); - - /* Casts of parameters, loads from parameters passed by reference - and stores to return value or parameters are often free after - inlining dua to SRA and further combining. - Assume that half of statements goes away. */ - if (rhs_code == CONVERT_EXPR - || rhs_code == NOP_EXPR - || rhs_code == VIEW_CONVERT_EXPR - || rhs_code == ADDR_EXPR - || gimple_assign_rhs_class (stmt) == GIMPLE_SINGLE_RHS) - { - tree rhs = gimple_assign_rhs1 (stmt); - tree lhs = gimple_assign_lhs (stmt); - tree inner_rhs = get_base_address (rhs); - tree inner_lhs = get_base_address (lhs); - bool rhs_free = false; - bool lhs_free = false; - - if (!inner_rhs) - inner_rhs = rhs; - if (!inner_lhs) - inner_lhs = lhs; - - /* Reads of parameter are expected to be free. */ - if (unmodified_parm (stmt, inner_rhs)) - rhs_free = true; - /* Match expressions of form &this->field. Those will most likely - combine with something upstream after inlining. */ - else if (TREE_CODE (inner_rhs) == ADDR_EXPR) - { - tree op = get_base_address (TREE_OPERAND (inner_rhs, 0)); - if (TREE_CODE (op) == PARM_DECL) - rhs_free = true; - else if (TREE_CODE (op) == MEM_REF - && unmodified_parm (stmt, TREE_OPERAND (op, 0))) - rhs_free = true; - } - - /* When parameter is not SSA register because its address is taken - and it is just copied into one, the statement will be completely - free after inlining (we will copy propagate backward). */ - if (rhs_free && is_gimple_reg (lhs)) - return 2; - - /* Reads of parameters passed by reference - expected to be free (i.e. optimized out after inlining). */ - if (TREE_CODE(inner_rhs) == MEM_REF - && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0))) - rhs_free = true; - - /* Copying parameter passed by reference into gimple register is - probably also going to copy propagate, but we can't be quite - sure. */ - if (rhs_free && is_gimple_reg (lhs)) - lhs_free = true; - - /* Writes to parameters, parameters passed by value and return value - (either dirrectly or passed via invisible reference) are free. - - TODO: We ought to handle testcase like - struct a {int a,b;}; - struct a - retrurnsturct (void) - { - struct a a ={1,2}; - return a; - } - - This translate into: - - retrurnsturct () - { - int a$b; - int a$a; - struct a a; - struct a D.2739; - - <bb 2>: - D.2739.a = 1; - D.2739.b = 2; - return D.2739; - - } - For that we either need to copy ipa-split logic detecting writes - to return value. */ - if (TREE_CODE (inner_lhs) == PARM_DECL - || TREE_CODE (inner_lhs) == RESULT_DECL - || (TREE_CODE(inner_lhs) == MEM_REF - && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0)) - || (TREE_CODE (TREE_OPERAND (inner_lhs, 0)) == SSA_NAME - && SSA_NAME_VAR (TREE_OPERAND (inner_lhs, 0)) - && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND - (inner_lhs, 0))) == RESULT_DECL)))) - lhs_free = true; - if (lhs_free - && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs))) - rhs_free = true; - if (lhs_free && rhs_free) - return 1; - } - return 0; - default: + case GIMPLE_RETURN: + return 2; + case GIMPLE_ASSIGN: + if (gimple_num_ops (stmt) != 2) return 0; + + rhs_code = gimple_assign_rhs_code (stmt); + + /* Casts of parameters, loads from parameters passed by reference + and stores to return value or parameters are often free after + inlining dua to SRA and further combining. + Assume that half of statements goes away. */ + if (rhs_code == CONVERT_EXPR + || rhs_code == NOP_EXPR + || rhs_code == VIEW_CONVERT_EXPR + || rhs_code == ADDR_EXPR + || gimple_assign_rhs_class (stmt) == GIMPLE_SINGLE_RHS) + { + tree rhs = gimple_assign_rhs1 (stmt); + tree lhs = gimple_assign_lhs (stmt); + tree inner_rhs = get_base_address (rhs); + tree inner_lhs = get_base_address (lhs); + bool rhs_free = false; + bool lhs_free = false; + + if (!inner_rhs) + inner_rhs = rhs; + if (!inner_lhs) + inner_lhs = lhs; + + /* Reads of parameter are expected to be free. */ + if (unmodified_parm (stmt, inner_rhs)) + rhs_free = true; + /* Match expressions of form &this->field. Those will most likely + combine with something upstream after inlining. */ + else if (TREE_CODE (inner_rhs) == ADDR_EXPR) + { + tree op = get_base_address (TREE_OPERAND (inner_rhs, 0)); + if (TREE_CODE (op) == PARM_DECL) + rhs_free = true; + else if (TREE_CODE (op) == MEM_REF + && unmodified_parm (stmt, TREE_OPERAND (op, 0))) + rhs_free = true; + } + + /* When parameter is not SSA register because its address is taken + and it is just copied into one, the statement will be completely + free after inlining (we will copy propagate backward). */ + if (rhs_free && is_gimple_reg (lhs)) + return 2; + + /* Reads of parameters passed by reference + expected to be free (i.e. optimized out after inlining). */ + if (TREE_CODE (inner_rhs) == MEM_REF + && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0))) + rhs_free = true; + + /* Copying parameter passed by reference into gimple register is + probably also going to copy propagate, but we can't be quite + sure. */ + if (rhs_free && is_gimple_reg (lhs)) + lhs_free = true; + + /* Writes to parameters, parameters passed by value and return value + (either dirrectly or passed via invisible reference) are free. + + TODO: We ought to handle testcase like + struct a {int a,b;}; + struct a + retrurnsturct (void) + { + struct a a ={1,2}; + return a; + } + + This translate into: + + retrurnsturct () + { + int a$b; + int a$a; + struct a a; + struct a D.2739; + + <bb 2>: + D.2739.a = 1; + D.2739.b = 2; + return D.2739; + + } + For that we either need to copy ipa-split logic detecting writes + to return value. */ + if (TREE_CODE (inner_lhs) == PARM_DECL + || TREE_CODE (inner_lhs) == RESULT_DECL + || (TREE_CODE (inner_lhs) == MEM_REF + && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0)) + || (TREE_CODE (TREE_OPERAND (inner_lhs, 0)) == SSA_NAME + && SSA_NAME_VAR (TREE_OPERAND (inner_lhs, 0)) + && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND + (inner_lhs, + 0))) == RESULT_DECL)))) + lhs_free = true; + if (lhs_free + && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs))) + rhs_free = true; + if (lhs_free && rhs_free) + return 1; + } + return 0; + default: + return 0; } } @@ -1682,8 +1674,8 @@ eliminated_by_inlining_prob (gimple stmt) static void set_cond_stmt_execution_predicate (struct ipa_node_params *info, - struct inline_summary *summary, - basic_block bb) + struct inline_summary *summary, + basic_block bb) { gimple last; tree op; @@ -1696,8 +1688,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, tree op2; last = last_stmt (bb); - if (!last - || gimple_code (last) != GIMPLE_COND) + if (!last || gimple_code (last) != GIMPLE_COND) return; if (!is_gimple_ip_invariant (gimple_cond_rhs (last))) return; @@ -1709,8 +1700,8 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, { code = gimple_cond_code (last); inverted_code - = invert_tree_comparison (code, - HONOR_NANS (TYPE_MODE (TREE_TYPE (op)))); + = invert_tree_comparison (code, + HONOR_NANS (TYPE_MODE (TREE_TYPE (op)))); FOR_EACH_EDGE (e, ei, bb->succs) { @@ -1719,7 +1710,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, ? code : inverted_code, gimple_cond_rhs (last)); e->aux = pool_alloc (edge_predicate_pool); - *(struct predicate *)e->aux = p; + *(struct predicate *) e->aux = p; } } @@ -1727,9 +1718,9 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, return; /* Special case if (builtin_constant_p (op)) - constant_code + constant_code else - nonconstant_code. + nonconstant_code. Here we can predicate nonconstant_code. We can't really handle constant_code since we have no predicate for this and also the constant code is not known to be @@ -1743,16 +1734,16 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, || gimple_call_num_args (set_stmt) != 1) return; op2 = gimple_call_arg (set_stmt, 0); - if (!unmodified_parm_or_parm_agg_item (info, set_stmt, op2, &index, &aggpos)) + if (!unmodified_parm_or_parm_agg_item + (info, set_stmt, op2, &index, &aggpos)) return; - FOR_EACH_EDGE (e, ei, bb->succs) - if (e->flags & EDGE_FALSE_VALUE) - { - struct predicate p = add_condition (summary, index, &aggpos, - IS_NOT_CONSTANT, NULL_TREE); - e->aux = pool_alloc (edge_predicate_pool); - *(struct predicate *)e->aux = p; - } + FOR_EACH_EDGE (e, ei, bb->succs) if (e->flags & EDGE_FALSE_VALUE) + { + struct predicate p = add_condition (summary, index, &aggpos, + IS_NOT_CONSTANT, NULL_TREE); + e->aux = pool_alloc (edge_predicate_pool); + *(struct predicate *) e->aux = p; + } } @@ -1761,8 +1752,8 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, static void set_switch_stmt_execution_predicate (struct ipa_node_params *info, - struct inline_summary *summary, - basic_block bb) + struct inline_summary *summary, + basic_block bb) { gimple last; tree op; @@ -1774,8 +1765,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, size_t case_idx; last = last_stmt (bb); - if (!last - || gimple_code (last) != GIMPLE_SWITCH) + if (!last || gimple_code (last) != GIMPLE_SWITCH) return; op = gimple_switch_index (last); if (!unmodified_parm_or_parm_agg_item (info, last, op, &index, &aggpos)) @@ -1784,9 +1774,9 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, FOR_EACH_EDGE (e, ei, bb->succs) { e->aux = pool_alloc (edge_predicate_pool); - *(struct predicate *)e->aux = false_predicate (); + *(struct predicate *) e->aux = false_predicate (); } - n = gimple_switch_num_labels(last); + n = gimple_switch_num_labels (last); for (case_idx = 0; case_idx < n; ++case_idx) { tree cl = gimple_switch_label (last, case_idx); @@ -1798,8 +1788,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, max = CASE_HIGH (cl); /* For default we might want to construct predicate that none - of cases is met, but it is bit hard to do not having negations - of conditionals handy. */ + of cases is met, but it is bit hard to do not having negations + of conditionals handy. */ if (!min && !max) p = true_predicate (); else if (!max) @@ -1811,8 +1801,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, p2 = add_condition (summary, index, &aggpos, LE_EXPR, max); p = and_predicates (summary->conds, &p1, &p2); } - *(struct predicate *)e->aux - = or_predicates (summary->conds, &p, (struct predicate *)e->aux); + *(struct predicate *) e->aux + = or_predicates (summary->conds, &p, (struct predicate *) e->aux); } } @@ -1838,7 +1828,7 @@ compute_bb_predicates (struct cgraph_node *node, /* Entry block is always executable. */ ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux = pool_alloc (edge_predicate_pool); - *(struct predicate *)ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux + *(struct predicate *) ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux = true_predicate (); /* A simple dataflow propagation of predicates forward in the CFG. @@ -1848,19 +1838,19 @@ compute_bb_predicates (struct cgraph_node *node, done = true; FOR_EACH_BB_FN (bb, my_function) { - struct predicate p = false_predicate (); - edge e; - edge_iterator ei; + struct predicate p = false_predicate (); + edge e; + edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) { if (e->src->aux) { struct predicate this_bb_predicate - = *(struct predicate *)e->src->aux; + = *(struct predicate *) e->src->aux; if (e->aux) this_bb_predicate - = and_predicates (summary->conds, &this_bb_predicate, - (struct predicate *)e->aux); + = and_predicates (summary->conds, &this_bb_predicate, + (struct predicate *) e->aux); p = or_predicates (summary->conds, &p, &this_bb_predicate); if (true_predicate_p (&p)) break; @@ -1874,12 +1864,12 @@ compute_bb_predicates (struct cgraph_node *node, { done = false; bb->aux = pool_alloc (edge_predicate_pool); - *((struct predicate *)bb->aux) = p; + *((struct predicate *) bb->aux) = p; } - else if (!predicates_equal_p (&p, (struct predicate *)bb->aux)) + else if (!predicates_equal_p (&p, (struct predicate *) bb->aux)) { done = false; - *((struct predicate *)bb->aux) = p; + *((struct predicate *) bb->aux) = p; } } } @@ -1895,9 +1885,9 @@ typedef struct predicate predicate_t; static struct predicate will_be_nonconstant_expr_predicate (struct ipa_node_params *info, - struct inline_summary *summary, - tree expr, - vec<predicate_t> nonconstant_names) + struct inline_summary *summary, + tree expr, + vec<predicate_t> nonconstant_names) { tree parm; int index; @@ -1906,19 +1896,17 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info, expr = TREE_OPERAND (expr, 0); parm = unmodified_parm (NULL, expr); - if (parm - && (index = ipa_get_param_decl_index (info, parm)) >= 0) + if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0) return add_condition (summary, index, NULL, CHANGED, NULL_TREE); if (is_gimple_min_invariant (expr)) return false_predicate (); if (TREE_CODE (expr) == SSA_NAME) return nonconstant_names[SSA_NAME_VERSION (expr)]; - if (BINARY_CLASS_P (expr) - || COMPARISON_CLASS_P (expr)) + if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr)) { struct predicate p1 = will_be_nonconstant_expr_predicate - (info, summary, TREE_OPERAND (expr, 0), - nonconstant_names); + (info, summary, TREE_OPERAND (expr, 0), + nonconstant_names); struct predicate p2; if (true_predicate_p (&p1)) return p1; @@ -1930,8 +1918,8 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info, else if (TREE_CODE (expr) == COND_EXPR) { struct predicate p1 = will_be_nonconstant_expr_predicate - (info, summary, TREE_OPERAND (expr, 0), - nonconstant_names); + (info, summary, TREE_OPERAND (expr, 0), + nonconstant_names); struct predicate p2; if (true_predicate_p (&p1)) return p1; @@ -2018,7 +2006,8 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, } if (is_load) - op_non_const = add_condition (summary, base_index, &aggpos, CHANGED, NULL); + op_non_const = + add_condition (summary, base_index, &aggpos, CHANGED, NULL); else op_non_const = false_predicate (); FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) @@ -2026,8 +2015,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, tree parm = unmodified_parm (stmt, use); int index; - if (parm - && (index = ipa_get_param_decl_index (info, parm)) >= 0) + if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0) { if (index != base_index) p = add_condition (summary, index, NULL, CHANGED, NULL_TREE); @@ -2041,7 +2029,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, if (gimple_code (stmt) == GIMPLE_ASSIGN && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME) nonconstant_names[SSA_NAME_VERSION (gimple_assign_lhs (stmt))] - = op_non_const; + = op_non_const; return op_non_const; } @@ -2055,15 +2043,16 @@ struct record_modified_bb_info set except for info->stmt. */ static bool -record_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, - void *data) +record_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data) { - struct record_modified_bb_info *info = (struct record_modified_bb_info *) data; + struct record_modified_bb_info *info = + (struct record_modified_bb_info *) data; if (SSA_NAME_DEF_STMT (vdef) == info->stmt) return false; bitmap_set_bit (info->bb_set, SSA_NAME_IS_DEFAULT_DEF (vdef) - ? ENTRY_BLOCK_PTR->index : gimple_bb (SSA_NAME_DEF_STMT (vdef))->index); + ? ENTRY_BLOCK_PTR->index + : gimple_bb (SSA_NAME_DEF_STMT (vdef))->index); return false; } @@ -2081,6 +2070,7 @@ param_change_prob (gimple stmt, int i) basic_block bb = gimple_bb (stmt); tree base; + /* Global invariants neve change. */ if (is_gimple_min_invariant (op)) return 0; /* We would have to do non-trivial analysis to really work out what @@ -2104,10 +2094,10 @@ param_change_prob (gimple stmt, int i) if (!init_freq) init_freq = 1; if (init_freq < bb->frequency) - return MAX ((init_freq * REG_BR_PROB_BASE + - bb->frequency / 2) / bb->frequency, 1); + return MAX ((init_freq * REG_BR_PROB_BASE + + bb->frequency / 2) / bb->frequency, 1); else - return REG_BR_PROB_BASE; + return REG_BR_PROB_BASE; } base = get_base_address (op); @@ -2130,13 +2120,13 @@ param_change_prob (gimple stmt, int i) NULL); if (bitmap_bit_p (info.bb_set, bb->index)) { - BITMAP_FREE (info.bb_set); + BITMAP_FREE (info.bb_set); return REG_BR_PROB_BASE; } /* Assume that every memory is initialized at entry. - TODO: Can we easilly determine if value is always defined - and thus we may skip entry block? */ + TODO: Can we easilly determine if value is always defined + and thus we may skip entry block? */ if (ENTRY_BLOCK_PTR->frequency) max = ENTRY_BLOCK_PTR->frequency; else @@ -2144,13 +2134,13 @@ param_change_prob (gimple stmt, int i) EXECUTE_IF_SET_IN_BITMAP (info.bb_set, 0, index, bi) max = MIN (max, BASIC_BLOCK (index)->frequency); - + BITMAP_FREE (info.bb_set); if (max < bb->frequency) - return MAX ((max * REG_BR_PROB_BASE + + return MAX ((max * REG_BR_PROB_BASE + bb->frequency / 2) / bb->frequency, 1); else - return REG_BR_PROB_BASE; + return REG_BR_PROB_BASE; } return REG_BR_PROB_BASE; } @@ -2251,19 +2241,18 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi, static struct predicate array_index_predicate (struct inline_summary *info, - vec<predicate_t> nonconstant_names, tree op) + vec< predicate_t> nonconstant_names, tree op) { struct predicate p = false_predicate (); while (handled_component_p (op)) { - if (TREE_CODE (op) == ARRAY_REF - || TREE_CODE (op) == ARRAY_RANGE_REF) - { + if (TREE_CODE (op) == ARRAY_REF || TREE_CODE (op) == ARRAY_RANGE_REF) + { if (TREE_CODE (TREE_OPERAND (op, 1)) == SSA_NAME) - p = or_predicates (info->conds, &p, - &nonconstant_names[ - SSA_NAME_VERSION (TREE_OPERAND (op, 1))]); - } + p = or_predicates (info->conds, &p, + &nonconstant_names[SSA_NAME_VERSION + (TREE_OPERAND (op, 1))]); + } op = TREE_OPERAND (op, 0); } return p; @@ -2304,7 +2293,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) if (ipa_node_params_vector.exists ()) { parms_info = IPA_NODE_REF (node); - nonconstant_names.safe_grow_cleared(SSANAMES (my_function)->length()); + nonconstant_names.safe_grow_cleared + (SSANAMES (my_function)->length ()); } } @@ -2335,7 +2325,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) if (parms_info) { if (bb->aux) - bb_predicate = *(struct predicate *)bb->aux; + bb_predicate = *(struct predicate *) bb->aux; else bb_predicate = false_predicate (); } @@ -2384,26 +2374,33 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) fprintf (dump_file, " "); print_gimple_stmt (dump_file, stmt, 0, 0); fprintf (dump_file, "\t\tfreq:%3.2f size:%3i time:%3i\n", - ((double)freq)/CGRAPH_FREQ_BASE, this_size, this_time); + ((double) freq) / CGRAPH_FREQ_BASE, this_size, + this_time); } if (gimple_assign_load_p (stmt) && nonconstant_names.exists ()) { struct predicate this_array_index; - this_array_index = array_index_predicate (info, nonconstant_names, - gimple_assign_rhs1 (stmt)); + this_array_index = + array_index_predicate (info, nonconstant_names, + gimple_assign_rhs1 (stmt)); if (!false_predicate_p (&this_array_index)) - array_index = and_predicates (info->conds, &array_index, &this_array_index); + array_index = + and_predicates (info->conds, &array_index, + &this_array_index); } if (gimple_store_p (stmt) && nonconstant_names.exists ()) { struct predicate this_array_index; - this_array_index = array_index_predicate (info, nonconstant_names, - gimple_get_lhs (stmt)); + this_array_index = + array_index_predicate (info, nonconstant_names, + gimple_get_lhs (stmt)); if (!false_predicate_p (&this_array_index)) - array_index = and_predicates (info->conds, &array_index, &this_array_index); + array_index = + and_predicates (info->conds, &array_index, + &this_array_index); } - + if (is_gimple_call (stmt)) { @@ -2411,8 +2408,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) struct inline_edge_summary *es = inline_edge_summary (edge); /* Special case: results of BUILT_IN_CONSTANT_P will be always - resolved as constant. We however don't want to optimize - out the cgraph edges. */ + resolved as constant. We however don't want to optimize + out the cgraph edges. */ if (nonconstant_names.exists () && gimple_call_builtin_p (stmt, BUILT_IN_CONSTANT_P) && gimple_call_lhs (stmt) @@ -2420,11 +2417,11 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) { struct predicate false_p = false_predicate (); nonconstant_names[SSA_NAME_VERSION (gimple_call_lhs (stmt))] - = false_p; + = false_p; } if (ipa_node_params_vector.exists ()) { - int count = gimple_call_num_args (stmt); + int count = gimple_call_num_args (stmt); int i; if (count) @@ -2444,12 +2441,12 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) } /* TODO: When conditional jump or swithc is known to be constant, but - we did not translate it into the predicates, we really can account + we did not translate it into the predicates, we really can account just maximum of the possible paths. */ if (parms_info) will_be_nonconstant - = will_be_nonconstant_predicate (parms_info, info, - stmt, nonconstant_names); + = will_be_nonconstant_predicate (parms_info, info, + stmt, nonconstant_names); if (this_time || this_size) { struct predicate p; @@ -2458,7 +2455,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) prob = eliminated_by_inlining_prob (stmt); if (prob == 1 && dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\t\t50%% will be eliminated by inlining\n"); + fprintf (dump_file, + "\t\t50%% will be eliminated by inlining\n"); if (prob == 2 && dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "\t\tWill be eliminated by inlining\n"); @@ -2477,8 +2475,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) } /* We account everything but the calls. Calls have their own - size/time info attached to cgraph edges. This is necessary - in order to make the cost disappear after inlining. */ + size/time info attached to cgraph edges. This is necessary + in order to make the cost disappear after inlining. */ if (!is_gimple_call (stmt)) { if (prob) @@ -2516,38 +2514,42 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) scev_initialize (); FOR_EACH_LOOP (li, loop, 0) { - vec<edge> exits; - edge ex; + vec<edge> exits; + edge ex; unsigned int j, i; struct tree_niter_desc niter_desc; basic_block *body = get_loop_body (loop); - bb_predicate = *(struct predicate *)loop->header->aux; + bb_predicate = *(struct predicate *) loop->header->aux; exits = get_loop_exit_edges (loop); - FOR_EACH_VEC_ELT (exits, j, ex) + FOR_EACH_VEC_ELT (exits, j, ex) if (number_of_iterations_exit (loop, ex, &niter_desc, false) && !is_gimple_min_invariant (niter_desc.niter)) - { - predicate will_be_nonconstant - = will_be_nonconstant_expr_predicate (parms_info, info, - niter_desc.niter, nonconstant_names); - if (!true_predicate_p (&will_be_nonconstant)) - will_be_nonconstant = and_predicates (info->conds, - &bb_predicate, - &will_be_nonconstant); - if (!true_predicate_p (&will_be_nonconstant) - && !false_predicate_p (&will_be_nonconstant)) - /* This is slightly inprecise. We may want to represent each loop with - independent predicate. */ - loop_iterations = and_predicates (info->conds, &loop_iterations, &will_be_nonconstant); - } - exits.release (); + { + predicate will_be_nonconstant + = will_be_nonconstant_expr_predicate (parms_info, info, + niter_desc.niter, + nonconstant_names); + if (!true_predicate_p (&will_be_nonconstant)) + will_be_nonconstant = and_predicates (info->conds, + &bb_predicate, + &will_be_nonconstant); + if (!true_predicate_p (&will_be_nonconstant) + && !false_predicate_p (&will_be_nonconstant)) + /* This is slightly inprecise. We may want to represent each + loop with independent predicate. */ + loop_iterations = + and_predicates (info->conds, &loop_iterations, + &will_be_nonconstant); + } + exits.release (); - for (i = 0; i < loop->num_nodes; i++) + for (i = 0; i < loop->num_nodes; i++) { gimple_stmt_iterator gsi; - bb_predicate = *(struct predicate *)body[i]->aux; - for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi)) + bb_predicate = *(struct predicate *) body[i]->aux; + for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); + gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); affine_iv iv; @@ -2555,30 +2557,36 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) tree use; FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) - { - predicate will_be_nonconstant; - - if (!simple_iv (loop, loop_containing_stmt (stmt), use, &iv, true) - || is_gimple_min_invariant (iv.step)) - continue; + { + predicate will_be_nonconstant; + + if (!simple_iv + (loop, loop_containing_stmt (stmt), use, &iv, true) + || is_gimple_min_invariant (iv.step)) + continue; + will_be_nonconstant + = will_be_nonconstant_expr_predicate (parms_info, info, + iv.step, + nonconstant_names); + if (!true_predicate_p (&will_be_nonconstant)) will_be_nonconstant - = will_be_nonconstant_expr_predicate (parms_info, info, - iv.step, nonconstant_names); - if (!true_predicate_p (&will_be_nonconstant)) - will_be_nonconstant = and_predicates (info->conds, - &bb_predicate, - &will_be_nonconstant); - if (!true_predicate_p (&will_be_nonconstant) - && !false_predicate_p (&will_be_nonconstant)) - /* This is slightly inprecise. We may want to represent each loop with - independent predicate. */ - loop_stride = and_predicates (info->conds, &loop_stride, &will_be_nonconstant); - } + = and_predicates (info->conds, + &bb_predicate, + &will_be_nonconstant); + if (!true_predicate_p (&will_be_nonconstant) + && !false_predicate_p (&will_be_nonconstant)) + /* This is slightly inprecise. We may want to represent + each loop with independent predicate. */ + loop_stride = + and_predicates (info->conds, &loop_stride, + &will_be_nonconstant); + } } } free (body); } - set_hint_predicate (&inline_summary (node)->loop_iterations, loop_iterations); + set_hint_predicate (&inline_summary (node)->loop_iterations, + loop_iterations); set_hint_predicate (&inline_summary (node)->loop_stride, loop_stride); scev_finalize (); } @@ -2691,8 +2699,7 @@ compute_inline_parameters (struct cgraph_node *node, bool early) info->estimated_stack_size = info->estimated_self_stack_size; #ifdef ENABLE_CHECKING inline_update_overall_summary (node); - gcc_assert (info->time == info->self_time - && info->size == info->self_size); + gcc_assert (info->time == info->self_time && info->size == info->self_size); #endif pop_cfun (); @@ -2709,24 +2716,24 @@ compute_inline_parameters_for_current (void) return 0; } -struct gimple_opt_pass pass_inline_parameters = +struct gimple_opt_pass pass_inline_parameters = { { GIMPLE_PASS, - "inline_param", /* name */ - OPTGROUP_INLINE, /* optinfo_flags */ - NULL, /* gate */ - compute_inline_parameters_for_current,/* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_INLINE_PARAMETERS, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ - } + "inline_param", /* name */ + OPTGROUP_INLINE, /* optinfo_flags */ + NULL, /* gate */ + compute_inline_parameters_for_current, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_INLINE_PARAMETERS, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + } }; @@ -2776,7 +2783,6 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time, vec<tree> known_binfos, vec<ipa_agg_jump_function_p> known_aggs, inline_hints *hints) - { struct inline_edge_summary *es = inline_edge_summary (e); int call_size = es->call_stmt_size; @@ -2784,12 +2790,11 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time, if (!e->callee && estimate_edge_devirt_benefit (e, &call_size, &call_time, known_vals, known_binfos, known_aggs) - && hints - && cgraph_maybe_hot_edge_p (e)) + && hints && cgraph_maybe_hot_edge_p (e)) *hints |= INLINE_HINT_indirect_call; *size += call_size * INLINE_SIZE_SCALE; *time += call_time * prob / REG_BR_PROB_BASE - * e->frequency * (INLINE_TIME_SCALE / CGRAPH_FREQ_BASE); + * e->frequency * (INLINE_TIME_SCALE / CGRAPH_FREQ_BASE); if (*time > MAX_TIME * INLINE_TIME_SCALE) *time = MAX_TIME * INLINE_TIME_SCALE; } @@ -2812,26 +2817,29 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time, for (e = node->callees; e; e = e->next_callee) { struct inline_edge_summary *es = inline_edge_summary (e); - if (!es->predicate || evaluate_predicate (es->predicate, possible_truths)) + if (!es->predicate + || evaluate_predicate (es->predicate, possible_truths)) { if (e->inline_failed) { /* Predicates of calls shall not use NOT_CHANGED codes, - sowe do not need to compute probabilities. */ + sowe do not need to compute probabilities. */ estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, - known_vals, known_binfos, known_aggs, - hints); + known_vals, known_binfos, + known_aggs, hints); } else estimate_calls_size_and_time (e->callee, size, time, hints, possible_truths, - known_vals, known_binfos, known_aggs); + known_vals, known_binfos, + known_aggs); } } for (e = node->indirect_calls; e; e = e->next_callee) { struct inline_edge_summary *es = inline_edge_summary (e); - if (!es->predicate || evaluate_predicate (es->predicate, possible_truths)) + if (!es->predicate + || evaluate_predicate (es->predicate, possible_truths)) estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, known_vals, known_binfos, known_aggs, hints); @@ -2849,10 +2857,10 @@ estimate_node_size_and_time (struct cgraph_node *node, vec<tree> known_vals, vec<tree> known_binfos, vec<ipa_agg_jump_function_p> known_aggs, - int *ret_size, int *ret_time, + int *ret_size, int *ret_time, inline_hints *ret_hints, vec<inline_param_summary_t> - inline_param_summary) + inline_param_summary) { struct inline_summary *info = inline_summary (node); size_time_entry *e; @@ -2861,24 +2869,21 @@ estimate_node_size_and_time (struct cgraph_node *node, inline_hints hints = 0; int i; - if (dump_file - && (dump_flags & TDF_DETAILS)) + if (dump_file && (dump_flags & TDF_DETAILS)) { bool found = false; fprintf (dump_file, " Estimating body: %s/%i\n" - " Known to be false: ", - cgraph_node_name (node), - node->uid); + " Known to be false: ", cgraph_node_name (node), node->uid); for (i = predicate_not_inlined_condition; i < (predicate_first_dynamic_condition - + (int)vec_safe_length (info->conds)); i++) + + (int) vec_safe_length (info->conds)); i++) if (!(possible_truths & (1 << i))) { if (found) fprintf (dump_file, ", "); found = true; - dump_condition (dump_file, info->conds, i); + dump_condition (dump_file, info->conds, i); } } @@ -2887,7 +2892,7 @@ estimate_node_size_and_time (struct cgraph_node *node, { size += e->size; gcc_checking_assert (e->time >= 0); - gcc_checking_assert (time >= 0); + gcc_checking_assert (time >= 0); if (!inline_param_summary.exists ()) time += e->time; else @@ -2898,25 +2903,25 @@ estimate_node_size_and_time (struct cgraph_node *node, inline_param_summary); gcc_checking_assert (prob >= 0); gcc_checking_assert (prob <= REG_BR_PROB_BASE); - time += ((gcov_type)e->time * prob) / REG_BR_PROB_BASE; + time += ((gcov_type) e->time * prob) / REG_BR_PROB_BASE; } - if (time > MAX_TIME * INLINE_TIME_SCALE) - time = MAX_TIME * INLINE_TIME_SCALE; - gcc_checking_assert (time >= 0); - + if (time > MAX_TIME * INLINE_TIME_SCALE) + time = MAX_TIME * INLINE_TIME_SCALE; + gcc_checking_assert (time >= 0); + } gcc_checking_assert (size >= 0); gcc_checking_assert (time >= 0); if (info->loop_iterations && !evaluate_predicate (info->loop_iterations, possible_truths)) - hints |=INLINE_HINT_loop_iterations; + hints |= INLINE_HINT_loop_iterations; if (info->loop_stride && !evaluate_predicate (info->loop_stride, possible_truths)) - hints |=INLINE_HINT_loop_stride; + hints |= INLINE_HINT_loop_stride; if (info->array_index && !evaluate_predicate (info->array_index, possible_truths)) - hints |=INLINE_HINT_array_index; + hints |= INLINE_HINT_array_index; if (info->scc_no) hints |= INLINE_HINT_in_scc; if (DECL_DECLARED_INLINE_P (node->symbol.decl)) @@ -2929,9 +2934,8 @@ estimate_node_size_and_time (struct cgraph_node *node, time = RDIV (time, INLINE_TIME_SCALE); size = RDIV (size, INLINE_SIZE_SCALE); - if (dump_file - && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\n size:%i time:%i\n", (int)size, (int)time); + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "\n size:%i time:%i\n", (int) size, (int) time); if (ret_time) *ret_time = time; if (ret_size) @@ -2949,11 +2953,11 @@ estimate_node_size_and_time (struct cgraph_node *node, void estimate_ipcp_clone_size_and_time (struct cgraph_node *node, - vec<tree> known_vals, - vec<tree> known_binfos, - vec<ipa_agg_jump_function_p> known_aggs, - int *ret_size, int *ret_time, - inline_hints *hints) + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs, + int *ret_size, int *ret_time, + inline_hints *hints) { clause_t clause; @@ -2982,8 +2986,7 @@ remap_predicate (struct inline_summary *info, struct predicate *p, vec<int> operand_map, vec<int> offset_map, - clause_t possible_truths, - struct predicate *toplev_predicate) + clause_t possible_truths, struct predicate *toplev_predicate) { int i; struct predicate out = true_predicate (); @@ -2999,7 +3002,7 @@ remap_predicate (struct inline_summary *info, gcc_assert (i < MAX_CLAUSES); - for (cond = 0; cond < NUM_CONDITIONS; cond ++) + for (cond = 0; cond < NUM_CONDITIONS; cond++) /* Do we have condition we can't disprove? */ if (clause & possible_truths & (1 << cond)) { @@ -3008,42 +3011,42 @@ remap_predicate (struct inline_summary *info, inlined function. */ if (cond >= predicate_first_dynamic_condition) { - struct condition *c; - - c = &(*callee_info->conds)[cond - - predicate_first_dynamic_condition]; - /* See if we can remap condition operand to caller's operand. - Otherwise give up. */ - if (!operand_map.exists () - || (int)operand_map.length () <= c->operand_num - || operand_map[c->operand_num] == -1 - /* TODO: For non-aggregate conditions, adding an offset is - basically an arithmetic jump function processing which - we should support in future. */ - || ((!c->agg_contents || !c->by_ref) - && offset_map[c->operand_num] > 0) - || (c->agg_contents && c->by_ref - && offset_map[c->operand_num] < 0)) - cond_predicate = true_predicate (); - else - { - struct agg_position_info ap; - HOST_WIDE_INT offset_delta = offset_map[c->operand_num]; - if (offset_delta < 0) - { - gcc_checking_assert (!c->agg_contents || !c->by_ref); - offset_delta = 0; - } - gcc_assert (!c->agg_contents - || c->by_ref - || offset_delta == 0); - ap.offset = c->offset + offset_delta; - ap.agg_contents = c->agg_contents; - ap.by_ref = c->by_ref; - cond_predicate = add_condition (info, - operand_map[c->operand_num], - &ap, c->code, c->val); - } + struct condition *c; + + c = &(*callee_info->conds)[cond + - + predicate_first_dynamic_condition]; + /* See if we can remap condition operand to caller's operand. + Otherwise give up. */ + if (!operand_map.exists () + || (int) operand_map.length () <= c->operand_num + || operand_map[c->operand_num] == -1 + /* TODO: For non-aggregate conditions, adding an offset is + basically an arithmetic jump function processing which + we should support in future. */ + || ((!c->agg_contents || !c->by_ref) + && offset_map[c->operand_num] > 0) + || (c->agg_contents && c->by_ref + && offset_map[c->operand_num] < 0)) + cond_predicate = true_predicate (); + else + { + struct agg_position_info ap; + HOST_WIDE_INT offset_delta = offset_map[c->operand_num]; + if (offset_delta < 0) + { + gcc_checking_assert (!c->agg_contents || !c->by_ref); + offset_delta = 0; + } + gcc_assert (!c->agg_contents + || c->by_ref || offset_delta == 0); + ap.offset = c->offset + offset_delta; + ap.agg_contents = c->agg_contents; + ap.by_ref = c->by_ref; + cond_predicate = add_condition (info, + operand_map[c->operand_num], + &ap, c->code, c->val); + } } /* Fixed conditions remains same, construct single condition predicate. */ @@ -3065,8 +3068,7 @@ remap_predicate (struct inline_summary *info, Compute peak stack usage. */ static void -inline_update_callee_summaries (struct cgraph_node *node, - int depth) +inline_update_callee_summaries (struct cgraph_node *node, int depth) { struct cgraph_edge *e; struct inline_summary *callee_info = inline_summary (node); @@ -3075,12 +3077,11 @@ inline_update_callee_summaries (struct cgraph_node *node, callee_info->stack_frame_offset = caller_info->stack_frame_offset - + caller_info->estimated_self_stack_size; + + caller_info->estimated_self_stack_size; peak = callee_info->stack_frame_offset - + callee_info->estimated_self_stack_size; - if (inline_summary (node->global.inlined_to)->estimated_stack_size - < peak) - inline_summary (node->global.inlined_to)->estimated_stack_size = peak; + + callee_info->estimated_self_stack_size; + if (inline_summary (node->global.inlined_to)->estimated_stack_size < peak) + inline_summary (node->global.inlined_to)->estimated_stack_size = peak; cgraph_propagate_frequency (node); for (e = node->callees; e; e = e->next_callee) { @@ -3108,7 +3109,7 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, struct ipa_edge_args *args = IPA_EDGE_REF (edge); struct inline_edge_summary *es = inline_edge_summary (edge); struct inline_edge_summary *inlined_es - = inline_edge_summary (inlined_edge); + = inline_edge_summary (inlined_edge); for (i = 0; i < ipa_get_cs_argument_count (args); i++) { @@ -3129,7 +3130,7 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, es->param[i].change_prob = prob; } } - } + } } /* Update edge summaries of NODE after INLINED_EDGE has been inlined. @@ -3140,14 +3141,14 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, Also update change probabilities. */ static void -remap_edge_summaries (struct cgraph_edge *inlined_edge, - struct cgraph_node *node, - struct inline_summary *info, - struct inline_summary *callee_info, - vec<int> operand_map, - vec<int> offset_map, - clause_t possible_truths, - struct predicate *toplev_predicate) +remap_edge_summaries (struct cgraph_edge *inlined_edge, + struct cgraph_node *node, + struct inline_summary *info, + struct inline_summary *callee_info, + vec<int> operand_map, + vec<int> offset_map, + clause_t possible_truths, + struct predicate *toplev_predicate) { struct cgraph_edge *e; for (e = node->callees; e; e = e->next_callee) @@ -3163,12 +3164,11 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, { p = remap_predicate (info, callee_info, es->predicate, operand_map, offset_map, - possible_truths, - toplev_predicate); + possible_truths, toplev_predicate); edge_set_predicate (e, &p); /* TODO: We should remove the edge for code that will be - optimized out, but we need to keep verifiers and tree-inline - happy. Make it cold for now. */ + optimized out, but we need to keep verifiers and tree-inline + happy. Make it cold for now. */ if (false_predicate_p (&p)) { e->count = 0; @@ -3227,17 +3227,13 @@ remap_hint_predicate (struct inline_summary *info, p = remap_predicate (info, callee_info, *hint, operand_map, offset_map, - possible_truths, - toplev_predicate); - if (!false_predicate_p (&p) - && !true_predicate_p (&p)) + possible_truths, toplev_predicate); + if (!false_predicate_p (&p) && !true_predicate_p (&p)) { if (!*hint) set_hint_predicate (hint, p); else - **hint = and_predicates (info->conds, - *hint, - &p); + **hint = and_predicates (info->conds, *hint, &p); } } @@ -3312,19 +3308,19 @@ inline_merge_summary (struct cgraph_edge *edge) &toplev_predicate); if (!false_predicate_p (&p)) { - gcov_type add_time = ((gcov_type)e->time * edge->frequency + gcov_type add_time = ((gcov_type) e->time * edge->frequency + CGRAPH_FREQ_BASE / 2) / CGRAPH_FREQ_BASE; int prob = predicate_probability (callee_info->conds, &e->predicate, clause, es->param); - add_time = ((gcov_type)add_time * prob) / REG_BR_PROB_BASE; + add_time = ((gcov_type) add_time * prob) / REG_BR_PROB_BASE; if (add_time > MAX_TIME * INLINE_TIME_SCALE) add_time = MAX_TIME * INLINE_TIME_SCALE; if (prob != REG_BR_PROB_BASE && dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "\t\tScaling time by probability:%f\n", - (double)prob / REG_BR_PROB_BASE); + (double) prob / REG_BR_PROB_BASE); } account_size_time (info, e->size, add_time, &p); } @@ -3333,16 +3329,13 @@ inline_merge_summary (struct cgraph_edge *edge) offset_map, clause, &toplev_predicate); remap_hint_predicate (info, callee_info, &callee_info->loop_iterations, - operand_map, offset_map, - clause, &toplev_predicate); + operand_map, offset_map, clause, &toplev_predicate); remap_hint_predicate (info, callee_info, &callee_info->loop_stride, - operand_map, offset_map, - clause, &toplev_predicate); + operand_map, offset_map, clause, &toplev_predicate); remap_hint_predicate (info, callee_info, &callee_info->array_index, - operand_map, offset_map, - clause, &toplev_predicate); + operand_map, offset_map, clause, &toplev_predicate); inline_update_callee_summaries (edge->callee, inline_edge_summary (edge)->loop_depth); @@ -3371,10 +3364,10 @@ inline_update_overall_summary (struct cgraph_node *node) { info->size += e->size, info->time += e->time; if (info->time > MAX_TIME * INLINE_TIME_SCALE) - info->time = MAX_TIME * INLINE_TIME_SCALE; + info->time = MAX_TIME * INLINE_TIME_SCALE; } estimate_calls_size_and_time (node, &info->size, &info->time, NULL, - ~(clause_t)(1 << predicate_false_condition), + ~(clause_t) (1 << predicate_false_condition), vNULL, vNULL, vNULL); info->time = (info->time + INLINE_TIME_SCALE / 2) / INLINE_TIME_SCALE; info->size = (info->size + INLINE_SIZE_SCALE / 2) / INLINE_SIZE_SCALE; @@ -3386,8 +3379,7 @@ simple_edge_hints (struct cgraph_edge *edge) { int hints = 0; struct cgraph_node *to = (edge->caller->global.inlined_to - ? edge->caller->global.inlined_to - : edge->caller); + ? edge->caller->global.inlined_to : edge->caller); if (inline_summary (to)->scc_no && inline_summary (to)->scc_no == inline_summary (edge->callee)->scc_no && !cgraph_edge_recursive_p (edge)) @@ -3437,7 +3429,7 @@ do_estimate_edge_time (struct cgraph_edge *edge) /* When caching, update the cache entry. */ if (edge_growth_cache.exists ()) { - if ((int)edge_growth_cache.length () <= edge->uid) + if ((int) edge_growth_cache.length () <= edge->uid) edge_growth_cache.safe_grow_cleared (cgraph_edge_max_uid); edge_growth_cache[edge->uid].time = time + (time >= 0); @@ -3537,7 +3529,8 @@ estimate_time_after_inlining (struct cgraph_node *node, struct inline_edge_summary *es = inline_edge_summary (edge); if (!es->predicate || !false_predicate_p (es->predicate)) { - gcov_type time = inline_summary (node)->time + estimate_edge_time (edge); + gcov_type time = + inline_summary (node)->time + estimate_edge_time (edge); if (time < 0) time = 0; if (time > MAX_TIME) @@ -3588,7 +3581,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data) if (e->caller == node || (e->caller->global.inlined_to && e->caller->global.inlined_to == node)) - d->self_recursive = true; + d->self_recursive = true; d->growth += estimate_edge_growth (e); } return false; @@ -3600,7 +3593,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data) int do_estimate_growth (struct cgraph_node *node) { - struct growth_data d = {0, false}; + struct growth_data d = { 0, false }; struct inline_summary *info = inline_summary (node); cgraph_for_node_and_aliases (node, do_estimate_growth_1, &d, true); @@ -3618,10 +3611,10 @@ do_estimate_growth (struct cgraph_node *node) if (cgraph_will_be_removed_from_program_if_no_direct_calls (node)) d.growth -= info->size; /* COMDAT functions are very often not shared across multiple units - since they come from various template instantiations. - Take this into account. */ - else if (DECL_COMDAT (node->symbol.decl) - && cgraph_can_remove_if_no_direct_calls_p (node)) + since they come from various template instantiations. + Take this into account. */ + else if (DECL_COMDAT (node->symbol.decl) + && cgraph_can_remove_if_no_direct_calls_p (node)) d.growth -= (info->size * (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY)) + 50) / 100; @@ -3629,7 +3622,7 @@ do_estimate_growth (struct cgraph_node *node) if (node_growth_cache.exists ()) { - if ((int)node_growth_cache.length () <= node->uid) + if ((int) node_growth_cache.length () <= node->uid) node_growth_cache.safe_grow_cleared (cgraph_max_uid); node_growth_cache[node->uid] = d.growth + (d.growth >= 0); } @@ -3687,7 +3680,7 @@ inline_generate_summary (void) struct cgraph_node *node; function_insertion_hook_holder = - cgraph_add_function_insertion_hook (&add_new_function, NULL); + cgraph_add_function_insertion_hook (&add_new_function, NULL); ipa_register_cgraph_hooks (); inline_free_summary (); @@ -3707,7 +3700,7 @@ read_predicate (struct lto_input_block *ib) clause_t clause; int k = 0; - do + do { gcc_assert (k <= MAX_CLAUSES); clause = out.clause[k++] = streamer_read_uhwi (ib); @@ -3741,8 +3734,7 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e) { es->param.safe_grow_cleared (length); for (i = 0; i < length; i++) - es->param[i].change_prob - = streamer_read_uhwi (ib); + es->param[i].change_prob = streamer_read_uhwi (ib); } } @@ -3820,7 +3812,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, vec_safe_push (info->entry, e); } - + p = read_predicate (&ib); set_hint_predicate (&info->loop_iterations, p); p = read_predicate (&ib); @@ -3859,7 +3851,7 @@ inline_read_summary (void) LTO_section_inline_summary, NULL, &len); if (data) - inline_read_section (file_data, data, len); + inline_read_section (file_data, data, len); else /* Fatal error here. We do not want to support compiling ltrans units with different version of compiler or different flags than the WPA @@ -3870,10 +3862,10 @@ inline_read_summary (void) { ipa_register_cgraph_hooks (); if (!flag_ipa_cp) - ipa_prop_read_jump_functions (); + ipa_prop_read_jump_functions (); } function_insertion_hook_holder = - cgraph_add_function_insertion_hook (&add_new_function, NULL); + cgraph_add_function_insertion_hook (&add_new_function, NULL); } @@ -3886,8 +3878,8 @@ write_predicate (struct output_block *ob, struct predicate *p) if (p) for (j = 0; p->clause[j]; j++) { - gcc_assert (j < MAX_CLAUSES); - streamer_write_uhwi (ob, p->clause[j]); + gcc_assert (j < MAX_CLAUSES); + streamer_write_uhwi (ob, p->clause[j]); } streamer_write_uhwi (ob, 0); } @@ -3906,7 +3898,7 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e) streamer_write_uhwi (ob, es->loop_depth); write_predicate (ob, es->predicate); streamer_write_uhwi (ob, es->param.length ()); - for (i = 0; i < (int)es->param.length (); i++) + for (i = 0; i < (int) es->param.length (); i++) streamer_write_uhwi (ob, es->param[i].change_prob); } @@ -3945,8 +3937,11 @@ inline_write_summary (void) int i; size_time_entry *e; struct condition *c; - - streamer_write_uhwi (ob, lto_symtab_encoder_encode (encoder, (symtab_node)node)); + + streamer_write_uhwi (ob, + lto_symtab_encoder_encode (encoder, + (symtab_node) + node)); streamer_write_hwi (ob, info->estimated_self_stack_size); streamer_write_hwi (ob, info->self_size); streamer_write_hwi (ob, info->self_time); @@ -3964,7 +3959,7 @@ inline_write_summary (void) bp_pack_value (&bp, c->by_ref, 1); streamer_write_bitpack (&bp); if (c->agg_contents) - streamer_write_uhwi (ob, c->offset); + streamer_write_uhwi (ob, c->offset); } streamer_write_uhwi (ob, vec_safe_length (info->entry)); for (i = 0; vec_safe_iterate (info->entry, i, &e); i++) |