aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 07922018e88..ebc663dfae5 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -127,6 +127,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-iterator.h"
#include "tree-phinodes.h"
#include "ssa-iterators.h"
+#include "builtins.h"
/* Statistics we collect about inlining algorithm. */
static int overall_size;
@@ -2101,7 +2102,7 @@ compute_max_insns (int insns)
if (max_insns < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
max_insns = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
- return ((HOST_WIDEST_INT) max_insns
+ return ((int64_t) max_insns
* (100 + PARAM_VALUE (PARAM_INLINE_UNIT_GROWTH)) / 100);
}
@@ -2397,7 +2398,7 @@ inline_small_functions (void)
badness,
edge->frequency / (double)CGRAPH_FREQ_BASE);
if (edge->count)
- fprintf (dump_file," Called "HOST_WIDEST_INT_PRINT_DEC"x\n",
+ fprintf (dump_file," Called %"PRId64"x\n",
edge->count);
if (dump_flags & TDF_DETAILS)
edge_badness (edge, true);
@@ -2631,6 +2632,8 @@ static bool
inline_to_all_callers (struct cgraph_node *node, void *data)
{
int *num_calls = (int *)data;
+ bool callee_removed = false;
+
while (node->callers && !node->global.inlined_to)
{
struct cgraph_node *caller = node->callers->caller;
@@ -2647,7 +2650,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
inline_summary (node->callers->caller)->size);
}
- inline_call (node->callers, true, NULL, NULL, true);
+ inline_call (node->callers, true, NULL, NULL, true, &callee_removed);
if (dump_file)
fprintf (dump_file,
" Inlined into %s which now has %i size\n",
@@ -2657,8 +2660,10 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
{
if (dump_file)
fprintf (dump_file, "New calls found; giving up.\n");
- return true;
+ return callee_removed;
}
+ if (callee_removed)
+ return true;
}
return false;
}
@@ -2667,7 +2672,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
static void
dump_overall_stats (void)
{
- HOST_WIDEST_INT sum_weighted = 0, sum = 0;
+ int64_t sum_weighted = 0, sum = 0;
struct cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node)
@@ -2679,8 +2684,8 @@ dump_overall_stats (void)
sum_weighted += time * node->count;
}
fprintf (dump_file, "Overall time estimate: "
- HOST_WIDEST_INT_PRINT_DEC" weighted by profile: "
- HOST_WIDEST_INT_PRINT_DEC"\n", sum, sum_weighted);
+ "%"PRId64" weighted by profile: "
+ "%"PRId64"\n", sum, sum_weighted);
}
/* Output some useful stats about inlining. */
@@ -2688,13 +2693,13 @@ dump_overall_stats (void)
static void
dump_inline_stats (void)
{
- HOST_WIDEST_INT inlined_cnt = 0, inlined_indir_cnt = 0;
- HOST_WIDEST_INT inlined_virt_cnt = 0, inlined_virt_indir_cnt = 0;
- HOST_WIDEST_INT noninlined_cnt = 0, noninlined_indir_cnt = 0;
- HOST_WIDEST_INT noninlined_virt_cnt = 0, noninlined_virt_indir_cnt = 0;
- HOST_WIDEST_INT inlined_speculative = 0, inlined_speculative_ply = 0;
- HOST_WIDEST_INT indirect_poly_cnt = 0, indirect_cnt = 0;
- HOST_WIDEST_INT reason[CIF_N_REASONS][3];
+ int64_t inlined_cnt = 0, inlined_indir_cnt = 0;
+ int64_t inlined_virt_cnt = 0, inlined_virt_indir_cnt = 0;
+ int64_t noninlined_cnt = 0, noninlined_indir_cnt = 0;
+ int64_t noninlined_virt_cnt = 0, noninlined_virt_indir_cnt = 0;
+ int64_t inlined_speculative = 0, inlined_speculative_ply = 0;
+ int64_t indirect_poly_cnt = 0, indirect_cnt = 0;
+ int64_t reason[CIF_N_REASONS][3];
int i;
struct cgraph_node *node;
@@ -2758,31 +2763,31 @@ dump_inline_stats (void)
if (max_count)
{
fprintf (dump_file,
- "Inlined " HOST_WIDEST_INT_PRINT_DEC " + speculative "
- HOST_WIDEST_INT_PRINT_DEC " + speculative polymorphic "
- HOST_WIDEST_INT_PRINT_DEC " + previously indirect "
- HOST_WIDEST_INT_PRINT_DEC " + virtual "
- HOST_WIDEST_INT_PRINT_DEC " + virtual and previously indirect "
- HOST_WIDEST_INT_PRINT_DEC "\n" "Not inlined "
- HOST_WIDEST_INT_PRINT_DEC " + previously indirect "
- HOST_WIDEST_INT_PRINT_DEC " + virtual "
- HOST_WIDEST_INT_PRINT_DEC " + virtual and previously indirect "
- HOST_WIDEST_INT_PRINT_DEC " + stil indirect "
- HOST_WIDEST_INT_PRINT_DEC " + still indirect polymorphic "
- HOST_WIDEST_INT_PRINT_DEC "\n", inlined_cnt,
+ "Inlined %"PRId64 " + speculative "
+ "%"PRId64 " + speculative polymorphic "
+ "%"PRId64 " + previously indirect "
+ "%"PRId64 " + virtual "
+ "%"PRId64 " + virtual and previously indirect "
+ "%"PRId64 "\n" "Not inlined "
+ "%"PRId64 " + previously indirect "
+ "%"PRId64 " + virtual "
+ "%"PRId64 " + virtual and previously indirect "
+ "%"PRId64 " + stil indirect "
+ "%"PRId64 " + still indirect polymorphic "
+ "%"PRId64 "\n", inlined_cnt,
inlined_speculative, inlined_speculative_ply,
inlined_indir_cnt, inlined_virt_cnt, inlined_virt_indir_cnt,
noninlined_cnt, noninlined_indir_cnt, noninlined_virt_cnt,
noninlined_virt_indir_cnt, indirect_cnt, indirect_poly_cnt);
fprintf (dump_file,
- "Removed speculations " HOST_WIDEST_INT_PRINT_DEC "\n",
+ "Removed speculations %"PRId64 "\n",
spec_rem);
}
dump_overall_stats ();
fprintf (dump_file, "\nWhy inlining failed?\n");
for (i = 0; i < CIF_N_REASONS; i++)
if (reason[i][2])
- fprintf (dump_file, "%-50s: %8i calls, %8i freq, "HOST_WIDEST_INT_PRINT_DEC" count\n",
+ fprintf (dump_file, "%-50s: %8i calls, %8i freq, %"PRId64" count\n",
cgraph_inline_failed_string ((cgraph_inline_failed_t) i),
(int) reason[i][2], (int) reason[i][1], reason[i][0]);
}
@@ -2904,8 +2909,9 @@ ipa_inline (void)
int num_calls = 0;
cgraph_for_node_and_aliases (node, sum_callers,
&num_calls, true);
- cgraph_for_node_and_aliases (node, inline_to_all_callers,
- &num_calls, true);
+ while (cgraph_for_node_and_aliases (node, inline_to_all_callers,
+ &num_calls, true))
+ ;
remove_functions = true;
}
}