This patch removes unnecessary functions in AutoFDO. Bootstrapped and passed regression/benchmark tests.
OK for google-4_8 branch? Thanks, Dehao
Index: gcc/auto-profile.c =================================================================== --- gcc/auto-profile.c (revision 200957) +++ gcc/auto-profile.c (working copy) @@ -638,26 +638,6 @@ get_inline_stack_size_by_stmt (gimple stmt) return size; } -/* Return the size of the inline stack of the EDGE. All inlined callsites - along he inline chain are recorded. */ - -static int -get_inline_stack_size_by_edge (struct cgraph_edge *edge) -{ - struct cgraph_edge *e; - int size = 0; - for (e= edge; e; e = e->caller->callers) - { - gimple stmt = e->call_stmt; - if (!stmt) - break; - size += get_inline_stack_size_by_stmt (stmt); - if (!e->caller->global.inlined_to) - break; - } - return size; -} - /* Return the function decl of a given lexical BLOCK. */ static tree @@ -728,29 +708,6 @@ get_inline_stack_by_stmt (gimple stmt, tree decl, return idx; } -/* Store the inline stack of EDGE to POS_STACK, return the size of the - stack. All inlined callsites along the inline stack are recorded. */ - -static int -get_inline_stack_by_edge (struct cgraph_edge *edge, - struct gcov_callsite_pos *pos_stack) -{ - struct cgraph_edge *e; - int size = 0; - - for (e = edge; e; e = e->caller->callers) - { - gimple stmt = e->call_stmt; - if (!stmt) - break; - size += get_inline_stack_by_stmt (stmt, e->caller->symbol.decl, - pos_stack + size, false); - if (!e->caller->global.inlined_to) - break; - } - return size; -} - /* Read sample count info of the function with DECL, and save them to ENTRY_COUNT and TOTAL_COUNT respectively. */ @@ -897,14 +854,15 @@ get_callsite_count (struct cgraph_edge *edge, gcov gcov_type num_inst; const char *callee_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (edge->callee->symbol.decl)); - int size = get_inline_stack_size_by_edge (edge); + int size = get_inline_stack_size_by_stmt (edge->call_stmt); if (size == 0) return 0; pos_stack = (struct gcov_callsite_pos *) alloca (sizeof (struct gcov_callsite_pos) * size); - get_inline_stack_by_edge (edge, pos_stack); + get_inline_stack_by_stmt (edge->call_stmt, edge->caller->symbol.decl, + pos_stack, false); return get_stack_count (pos_stack, callee_name, size, count, max_count, &num_inst, NULL, NULL); @@ -1004,9 +962,9 @@ read_profile (void) if (gcov_read_unsigned () != GCOV_VERSION) { -;/* inform (0, "Version number does not mathch."); + inform (0, "Version number does not mathch."); flag_auto_profile = 0; - return;*/ + return; } /* Skip the empty integer. */