This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Inline hints
- From: Martin Jambor <mjambor at suse dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Aug 2012 18:10:12 +0200
- Subject: Re: Inline hints
- References: <20120819054345.GA16541@kam.mff.cuni.cz>
Hi,
On Sun, Aug 19, 2012 at 07:43:45AM +0200, Jan Hubicka wrote:
>
> * gcc.dg/ipa/iinline-1.c: Update testcase to test inline hints.
>
> * ipa-inline.c (want_inline_small_function_p): Bypass
> inline limits for hinted functions.
> (edge_badness): Dump hints; decrease badness for hinted funcitons.
> * ipa-inline.h (enum inline_hints_vals): New enum.
> (inline_hints): New type.
> (edge_growth_cache_entry): Add hints.
> (dump_inline_summary): Update.
> (dump_inline_hints): Declare.
> (do_estimate_edge_hints): Declare.
> (estimate_edge_hints): New inline function.
> (reset_edge_growth_cache): Update.
> * predict.c (cgraph_maybe_hot_edge_p): Do not ice on indirect edges.
> * ipa-inline-analysis.c (dump_inline_hints): New function.
> (estimate_edge_devirt_benefit): Return true when function should be
> hinted.
> (estimate_calls_size_and_time): New hints argument; set it when
> devritualization happens.
> (estimate_node_size_and_time): New hints argument.
> (do_estimate_edge_time): Cache hints.
> (do_estimate_edge_growth): Update.
> (do_estimate_edge_hints): New function
...
> Index: ipa-inline.h
> ===================================================================
> *** ipa-inline.h (revision 190508)
> --- ipa-inline.h (working copy)
> *************** typedef struct GTY(()) condition
> *** 42,47 ****
> --- 42,54 ----
> unsigned by_ref : 1;
> } condition;
>
> + /* Inline hints are reasons why inline heuristics should preffer inlining given function.
> + They are represtented as bitmap of the following values. */
> + enum inline_hints_vals {
> + INLINE_HINT_indirect_call = 1
> + };
> + typedef int inline_hints;
> +
> DEF_VEC_O (condition);
> DEF_VEC_ALLOC_O (condition, gc);
>
> *************** extern VEC(inline_edge_summary_t,heap) *
> *** 158,163 ****
> --- 165,171 ----
> typedef struct edge_growth_cache_entry
> {
> int time, size;
> + inline_hints hints;
> } edge_growth_cache_entry;
> DEF_VEC_O(edge_growth_cache_entry);
> DEF_VEC_ALLOC_O(edge_growth_cache_entry,heap);
> *************** extern VEC(edge_growth_cache_entry,heap)
> *** 168,174 ****
> /* In ipa-inline-analysis.c */
> void debug_inline_summary (struct cgraph_node *);
> void dump_inline_summaries (FILE *f);
> ! void dump_inline_summary (FILE * f, struct cgraph_node *node);
> void inline_generate_summary (void);
> void inline_read_summary (void);
> void inline_write_summary (void);
> --- 176,183 ----
> /* In ipa-inline-analysis.c */
> void debug_inline_summary (struct cgraph_node *);
> void dump_inline_summaries (FILE *f);
> ! void dump_inline_summary (FILE *f, struct cgraph_node *node);
> ! void dump_inline_hints (FILE *f, inline_hints);
> void inline_generate_summary (void);
> void inline_read_summary (void);
> void inline_write_summary (void);
> *************** void inline_merge_summary (struct cgraph
> *** 185,190 ****
> --- 194,200 ----
> void inline_update_overall_summary (struct cgraph_node *node);
> int do_estimate_edge_growth (struct cgraph_edge *edge);
> int do_estimate_edge_time (struct cgraph_edge *edge);
> + inline_hints do_estimate_edge_hints (struct cgraph_edge *edge);
> void initialize_growth_caches (void);
> void free_growth_caches (void);
> void compute_inline_parameters (struct cgraph_node *, bool);
> *************** estimate_edge_time (struct cgraph_edge *
> *** 257,262 ****
> --- 267,288 ----
> }
>
>
> + /* Return estimated callee runtime increase after inlning
> + EDGE. */
> +
> + static inline inline_hints
> + estimate_edge_hints (struct cgraph_edge *edge)
> + {
> + inline_hints ret;
> + if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
> + || !(ret = VEC_index (edge_growth_cache_entry,
> + edge_growth_cache,
> + edge->uid).hints))
> + return do_estimate_edge_time (edge);
Surely this was supposed to be do_estimate_edge_hints instead?
Martin
> + return ret - 1;
> + }
> +
> +