From patchwork Fri Jul 26 21:14:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 262299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A902C2C00BE for ; Sat, 27 Jul 2013 07:14:42 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=q9r23yIAb+kCoMVl2V qYQq4+P7a5nmqZ/l289+0GmrFCtddSE/Go5I1UJ8NiK+ixoUL9FMNJN9BrgccbVq K+dhlEbxYp2PszRBZ/Vqqc9Ygx78p2tEbA6LWJPx8AFglmFINPsqt9K3UvTUyDIZ At/ArV/RhW2tnhziEZoQH3Lo0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=FVttzDXSwyiY0XtImqFhrEg9 50A=; b=q+CN7DcFb8rLE9Jxc9fvONzgmtNzo4NlwXLfGgBEIh0blAYoPq/u9WVw FCSxa5T96N8q0mGQKZA9OPbPZvSdMhspW00uXN6urMc9zwEBw8mW0zcz0nofxFj1 cmKeIbGSGKJ9uzY+CVh2hHU71tOt3FO30B80XmwZwukqgKG2Iog= Received: (qmail 30633 invoked by alias); 26 Jul 2013 21:14:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30607 invoked by uid 89); 26 Jul 2013 21:14:34 -0000 X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_99, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS, TW_CF autolearn=no version=3.3.1 Received: from Unknown (HELO mail-qe0-f47.google.com) (209.85.128.47) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Jul 2013 21:14:32 +0000 Received: by mail-qe0-f47.google.com with SMTP id x7so1238700qeu.20 for ; Fri, 26 Jul 2013 14:14:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=mXGZM9KT/oylGRagZfFgd3lGx1G6t4acZ9NsoG+OLlQ=; b=AGMm0rVwT+UHn27FV3n24CIbu2gtAUn3El4QjzVaEk+nw3VMuu8iaAJPH7qI5fdHAe kHcztHDvQJDYKWdVPpSjjgmfusJ/12L7qxOn7VO45zdhYZ1yvwN0qjCCY0hsFhfV8iY4 n052zq+QX5HG9hbsGD54b0/P5u7RuU/bh0cGcD8OpNvABH3EJ86q8htV+4AczZc1Knc1 yaaxrLLrXLtrdZncrM9LbUpXV+mEr2dW4xhvT48lq74wCi0jC96SzL9sZRr1BvSObWvO 25DyL6im9x2nnDKHz2ju0deKkCZZ/pu4groDY78RJ0D4X2PB/Af/aXbLBf6QcgqOpKNX eWUQ== MIME-Version: 1.0 X-Received: by 10.49.14.161 with SMTP id q1mr57170170qec.50.1374873264045; Fri, 26 Jul 2013 14:14:24 -0700 (PDT) Received: by 10.49.71.69 with HTTP; Fri, 26 Jul 2013 14:14:23 -0700 (PDT) In-Reply-To: References: Date: Fri, 26 Jul 2013 14:14:23 -0700 Message-ID: Subject: Re: [GOOGLE] Port remaining -fopt-info messages from google/4_7 (plus dump infrastructure enhancement) From: Teresa Johnson To: Xinliang David Li Cc: "gcc-patches@gcc.gnu.org" X-Gm-Message-State: ALoCoQnCcIHWncnoK4qtCIdPigkVVNzNO43YwzXwyCGKyw3naEsMbiAglmBdVE6d251GnPMWA8gJSDFGXjGJVgKSjVdJMh6/P/aR3dkGd9iCmH5rv46JNaY1zclbHSMhIUTCakCvhz1XJkm2nt8KZqilPBnMgBNOTy5CBi/aVCOXQjkwm3bE8UQRG7VeKDd98QZFOFt/ArjTlV7AXmgYZF/w82YZR7mOrA== Yes, and in fact I moved it inside the check for "if (dump_kind)" since we wouldn't be emitting any message if that is null (in practice all the callers of dump_loc check this too). I don't really like the fact that the newline is being emitted for all messages emitted via the "_loc" versions of the dumper, and not for the non-loc counterparts. But it looks like various callers already rely on this and cleaning it up will take more time. Removed a stale comment while here. New patch: 2013-07-26 Teresa Johnson * dumpfile.c (dump_loc): Ensure newline emitted. Teresa On Fri, Jul 26, 2013 at 1:16 PM, Xinliang David Li wrote: > is it better to hoist the newline dump before all the branches? > > David > > On Fri, Jul 26, 2013 at 1:06 PM, Teresa Johnson wrote: >> After converting so many more messages to the new dump framework with my >> previous change, I noticed a bug where the dumper was not always starting >> a dump message on a new line. The issue is that the dump framework does >> not always emit the source position info, but that was where the new line >> was being emitted. Fix below to emit new line even when not emitting the >> source position info. I will include it in the patch I send to trunk. >> >> Passes gcc regression tests. Ok for google branches? >> >> 2013-07-26 Teresa Johnson >> >> * dumpfile.c (dump_loc): Ensure newline emitted. >> >> Index: dumpfile.c >> =================================================================== >> --- dumpfile.c (revision 201268) >> +++ dumpfile.c (working copy) >> @@ -269,6 +269,8 @@ dump_loc (int dump_kind, FILE *dfile, source_locat >> DECL_SOURCE_LINE (current_function_decl), >> DECL_SOURCE_COLUMN (current_function_decl)); >> } >> + else >> + fprintf (dfile, "\n"); >> } >> >> /* Dump gimple statement GS with SPC indentation spaces and >> >> On Fri, Jul 26, 2013 at 10:18 AM, Teresa Johnson wrote: >>> Thanks. I'll work on a trunk patch to send next week. Teresa >>> >>> On Fri, Jul 26, 2013 at 10:05 AM, Xinliang David Li wrote: >>>> Ok for google branches. Many changes in coverage.c (such as >>>> get_coverage_counts) and value-prof.c need to be in trunk too. >>>> >>>> David >>>> >>>> On Thu, Jul 25, 2013 at 10:02 AM, Teresa Johnson wrote: >>>>> This patch ports the remaining -fopt-info messages that had been added >>>>> to google/gcc-4_7 using the original -fopt-info framework implemented >>>>> on that branch, to google/gcc-4_8 using the new -fopt-info framework >>>>> from trunk. >>>>> >>>>> Specifically, this ports over the messages added/modified by r180269, >>>>> r180973 and r195968. Some of these patches/messages were already ported, >>>>> but this adds the remainder. I converted from the old OPT_INFO_* levels >>>>> to the new MSG_* levels using the following mapping: >>>>> OPT_INFO_MIN -> MSG_OPTIMIZED_LOCATIONS >>>>> OPT_INFO_MED -> MSG_MISSED_OPTIMIZATION >>>>> OPT_INFO_MAX -> MSG_NOTE >>>>> The affected messages relate to LIPO module imports, missing/mismatched/ >>>>> corrupted profile data, and indirect call promotions performed. >>>>> >>>>> Additionally, after discussing with Easwaran and Rong, I flipped the >>>>> default of the inline-dump-module-id parameter to 1 to enable dumping >>>>> module ids in -fopt-info inlining messages for easier inlining >>>>> report generation. >>>>> >>>>> Finally, I had to make a couple enhancements to the new dump infrastructure >>>>> to get some of the new messages emitted. This change should be >>>>> pushed to trunk as it will help facilitate adding new dump messages >>>>> more easily (particularly number 2 below). There were two issues: >>>>> 1) The module imports occurred during coverage_init which happens >>>>> very early, before entering the pass manager that sets up the dumping. >>>>> This was addressed by enabling dumping within coverage_init, and >>>>> is modeled on how dumping is enabled after the pass manager >>>>> during finish_optimization_passes. >>>>> 2) Dumping was only enabled for passes marked with an optinfo_flag >>>>> that isn't OPTGROUP_NONE. Currently optgroup flags are only setup for >>>>> optimization groups in the categories IPA, LOOP, INLINE and VEC. >>>>> What this means is that any dump messages added to a pass that isn't >>>>> in one of these groups will silently be suppressed. The OPTGROUP >>>>> setting is specified in opt_pass struct, and is also automatically set >>>>> to OPTGROUP_IPA for any pass starting with "ipa-". What I did was >>>>> to add a new optgroup macro, OPTGROUP_OTHER. This is enabled only >>>>> under -fopt-info-optall, which is also the default for -fopt-info. >>>>> That way dump messages can be emitted without the requirement that >>>>> the pass be part of a group that can be emitted under a specific >>>>> optimization group subset. When setting up the dumps, any pass that >>>>> has OPTGROUP_NONE after examining the opt_pass struct and the pass >>>>> name will use OPTGROUP_OTHER. This doesn't mean that the list of >>>>> optgroups shouldn't be expanded, but rather adds a catch-all for >>>>> passes that don't currently have or need to be emitted on their own >>>>> as part of a new optgroup. >>>>> >>>>> Bootstrapped and regression tested. Ok for google/4_8? (Attached patch >>>>> as a file also since pasting below messed up the whitespace >>>>> formatting.) >>>>> >>>>> Thanks, >>>>> Teresa >>>>> >>>>> 2013-07-25 Teresa Johnson >>>>> >>>>> * c-family/c-opts.c (lipo_max_mem_reached): Use new dump framework. >>>>> * profile.c (read_profile_edge_counts): Ditto. >>>>> (compute_branch_probabilities): Ditto. >>>>> * value-prof.c (check_counter): Ditto. >>>>> (check_ic_counter): Ditto. >>>>> (find_func_by_funcdef_no): Ditto. >>>>> (check_ic_target): Ditto. >>>>> (gimple_ic_transform_mult_targ): Ditto. >>>>> * mcf.c (find_minimum_cost_flow): Ditto. >>>>> * coverage.c (incompatible_cl_args): Ditto. >>>>> (read_counts_file): Ditto. >>>>> (get_coverage_counts): Ditto. >>>>> (coverage_init): Setup new dump framework. >>>>> * common.opt (flag_ripa_verbose): Remove. >>>>> * params.def (PARAM_INLINE_DUMP_MODULE_ID): Enable by default. >>>>> * dumpfile.h (OPTGROUP_OTHER): Add and enable under OPTGROUP_ALL. >>>>> * passes.c (register_one_dump_file): Use OPTGROUP_OTHER >>>>> when pass not in any opt group. >>>>> * doc/invoke.texi: Document optall -fopt-info flag. >>>>> >>>>> * testsuite/gcc.dg/pr32773.c: Use -fopt-info. >>>>> * testsuite/gcc.dg/pr40209.c: Ditto. >>>>> * testsuite/gcc.dg/pr26570.c: Ditto. >>>>> * testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c: Ditto. >>>>> * testsuite/g++.dg/tree-ssa/dom-invalid.C: Ditto. >>>>> >>>>> Index: coverage.c >>>>> =================================================================== >>>>> --- coverage.c (revision 200845) >>>>> +++ coverage.c (working copy) >>>>> @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see >>>>> #include "opts.h" >>>>> #include "gcov-io.h" >>>>> #include "tree-flow.h" >>>>> +#include "tree-pass.h" >>>>> #include "cpplib.h" >>>>> #include "incpath.h" >>>>> #include "diagnostic-core.h" >>>>> @@ -411,14 +412,18 @@ incompatible_cl_args (struct gcov_module_info* mod >>>>> warning (OPT_Wripa_opt_mismatch, "command line arguments mismatch for %s " >>>>> "and %s", mod_info1->source_filename, mod_info2->source_filename); >>>>> >>>>> - if (warn_ripa_opt_mismatch && non_warning_mismatch && flag_ripa_verbose) >>>>> + if (warn_ripa_opt_mismatch && non_warning_mismatch && dump_enabled_p ()) >>>>> { >>>>> - inform (UNKNOWN_LOCATION, "Options for %s", mod_info1->source_filename); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, UNKNOWN_LOCATION, >>>>> + "Options for %s", mod_info1->source_filename); >>>>> for (i = 0; i < num_non_warning_opts1; i++) >>>>> - inform (UNKNOWN_LOCATION, non_warning_opts1[i]); >>>>> - inform (UNKNOWN_LOCATION, "Options for %s", mod_info2->source_filename); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, UNKNOWN_LOCATION, >>>>> + non_warning_opts1[i]); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, UNKNOWN_LOCATION, >>>>> + "Options for %s", mod_info2->source_filename); >>>>> for (i = 0; i < num_non_warning_opts2; i++) >>>>> - inform (UNKNOWN_LOCATION, non_warning_opts2[i]); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, UNKNOWN_LOCATION, >>>>> + non_warning_opts2[i]); >>>>> } >>>>> >>>>> has_any_incompatible_cg_opts >>>>> @@ -835,30 +840,57 @@ read_counts_file (const char *da_file_name, unsign >>>>> char *aux_da_filename = get_da_file_name (mod_info->da_filename); >>>>> gcc_assert (!mod_info->is_primary); >>>>> if (pointer_set_insert (modset, (void *)(size_t)mod_info->ident)) >>>>> - inform (input_location, "Not importing %s: already imported", >>>>> - mod_info->source_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: already imported", >>>>> + mod_info->source_filename); >>>>> + } >>>>> else if ((module_infos[0]->lang & GCOV_MODULE_LANG_MASK) != >>>>> (mod_info->lang & GCOV_MODULE_LANG_MASK)) >>>>> - inform (input_location, "Not importing %s: source language" >>>>> - " different from primary module's source language", >>>>> - mod_info->source_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: source language" >>>>> + " different from primary module's source" >>>>> + " language", >>>>> + mod_info->source_filename); >>>>> + } >>>>> else if (module_infos_read == max_group >>>>> /* If reordering is specified, delay the cutoff >>>>> until after sorting. */ >>>>> && !getenv ("LIPO_REORDER_GROUP")) >>>>> - inform (input_location, "Not importing %s: maximum group size" >>>>> - " reached", mod_info->source_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: maximum group size" >>>>> + " reached", mod_info->source_filename); >>>>> + } >>>>> else if (incompatible_cl_args (module_infos[0], mod_info)) >>>>> - inform (input_location, "Not importing %s: command-line" >>>>> - " arguments not compatible with primary module", >>>>> - mod_info->source_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: command-line" >>>>> + " arguments not compatible with primary" >>>>> + " module", >>>>> + mod_info->source_filename); >>>>> + } >>>>> else if ((fd = open (aux_da_filename, O_RDONLY)) < 0) >>>>> - inform (input_location, "Not importing %s: couldn't open %s", >>>>> - mod_info->source_filename, aux_da_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: couldn't open %s", >>>>> + mod_info->source_filename, >>>>> + aux_da_filename); >>>>> + } >>>>> else if ((mod_info->lang & GCOV_MODULE_ASM_STMTS) >>>>> && flag_ripa_disallow_asm_modules) >>>>> - inform (input_location, "Not importing %s: contains assembler" >>>>> - " statements", mod_info->source_filename); >>>>> + { >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: contains assembler" >>>>> + " statements", mod_info->source_filename); >>>>> + } >>>>> else if (mod_info->is_primary == false >>>>> && MODULE_EXPORTED_FLAG (mod_info) == false) >>>>> { >>>>> @@ -884,16 +916,17 @@ read_counts_file (const char *da_file_name, unsign >>>>> record_module_name (mod_info->ident, >>>>> lbasename (mod_info->source_filename)); >>>>> >>>>> - if (flag_ripa_verbose) >>>>> + if (dump_enabled_p ()) >>>>> { >>>>> - inform (input_location, >>>>> - "MODULE Id=%d, Is_Primary=%s," >>>>> - " Is_Exported=%s, Include_all=%s, Name=%s (%s)", >>>>> - mod_info->ident, mod_info->is_primary?"yes":"no", >>>>> - MODULE_EXPORTED_FLAG (mod_info)?"yes":"no", >>>>> - MODULE_INCLUDE_ALL_AUX_FLAG (mod_info)?"yes":"no", >>>>> - mod_info->source_filename, >>>>> - mod_info->da_filename); >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "MODULE Id=%d, Is_Primary=%s," >>>>> + " Is_Exported=%s, Include_all=%s, Name=%s (%s)", >>>>> + mod_info->ident, >>>>> mod_info->is_primary?"yes":"no", >>>>> + MODULE_EXPORTED_FLAG (mod_info)?"yes":"no", >>>>> + MODULE_INCLUDE_ALL_AUX_FLAG (mod_info)?"yes" >>>>> + :"no", >>>>> + mod_info->source_filename, >>>>> + mod_info->da_filename); >>>>> } >>>>> } >>>>> gcov_sync (offset, length); >>>>> @@ -958,11 +991,13 @@ get_coverage_counts (unsigned counter, unsigned ex >>>>> { >>>>> static int warned = 0; >>>>> >>>>> - if (!warned++) >>>>> - inform (input_location, (flag_guess_branch_prob >>>>> - ? "file %s not found, execution counts estimated" >>>>> - : "file %s not found, execution counts assumed to be zero"), >>>>> - da_file_name); >>>>> + if (!warned++ && dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + (flag_guess_branch_prob >>>>> + ? "file %s not found, execution counts estimated" >>>>> + : "file %s not found, execution counts assumed to " >>>>> + "be zero"), >>>>> + da_file_name); >>>>> return NULL; >>>>> } >>>>> >>>>> @@ -970,9 +1005,11 @@ get_coverage_counts (unsigned counter, unsigned ex >>>>> >>>>> if (!entry || !entry->summary.num) >>>>> { >>>>> - if (!flag_dyn_ipa && 0 /*TODO reenable with opt-info */) >>>>> - warning (0, "no coverage for function %qE found", >>>>> - DECL_ASSEMBLER_NAME (current_function_decl)); >>>>> + if (!flag_dyn_ipa && dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "no coverage for function %s found", >>>>> + IDENTIFIER_POINTER >>>>> + (DECL_ASSEMBLER_NAME (current_function_decl))); >>>>> return NULL; >>>>> } >>>>> >>>>> @@ -987,21 +1024,25 @@ get_coverage_counts (unsigned counter, unsigned ex >>>>> warning_at (input_location, OPT_Wcoverage_mismatch, >>>>> "the control flow of function %qE does not match " >>>>> "its profile data (counter %qs)", id, ctr_names[counter]); >>>>> - if (warning_printed) >>>>> + if (warning_printed && dump_enabled_p ()) >>>>> { >>>>> - inform (input_location, "use -Wno-error=coverage-mismatch to tolerate " >>>>> - "the mismatch but performance may drop if the >>>>> function is hot"); >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "use -Wno-error=coverage-mismatch to tolerate " >>>>> + "the mismatch but performance may drop if the " >>>>> + "function is hot"); >>>>> >>>>> if (!seen_error () >>>>> && !warned++) >>>>> { >>>>> - inform (input_location, "coverage mismatch ignored"); >>>>> - inform (input_location, flag_guess_branch_prob >>>>> - ? G_("execution counts estimated") >>>>> - : G_("execution counts assumed to be zero")); >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "coverage mismatch ignored"); >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + flag_guess_branch_prob >>>>> + ? G_("execution counts estimated") >>>>> + : G_("execution counts assumed to be zero")); >>>>> if (!flag_guess_branch_prob) >>>>> - inform (input_location, >>>>> - "this can result in poorly optimized code"); >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "this can result in poorly optimized code"); >>>>> } >>>>> } >>>>> >>>>> @@ -1009,7 +1050,8 @@ get_coverage_counts (unsigned counter, unsigned ex >>>>> } >>>>> else if (entry->lineno_checksum != lineno_checksum) >>>>> { >>>>> - warning (0, "Source location for function %qE have changed," >>>>> + warning (OPT_Wripa_opt_mismatch, >>>>> + "Source location for function %qE have changed," >>>>> " the profile data may be out of date", >>>>> DECL_ASSEMBLER_NAME (current_function_decl)); >>>>> } >>>>> @@ -2522,6 +2564,11 @@ coverage_init (const char *filename, const char* s >>>>> int src_name_prefix_len = 0; >>>>> int len = strlen (filename); >>>>> >>>>> + /* Since coverage_init is invoked very early, before the pass >>>>> + manager, we need to set up the dumping explicitly. This is >>>>> + similar to the handling in finish_optimization_passes. */ >>>>> + dump_start (pass_profile.pass.static_pass_number, NULL); >>>>> + >>>>> has_asm_statement = false; >>>>> da_file_name = get_da_file_name (filename); >>>>> da_base_file_name = XNEWVEC (char, strlen (filename) + 1); >>>>> @@ -2586,6 +2633,8 @@ coverage_init (const char *filename, const char* s >>>>> gcov_write_unsigned (bbg_file_stamp); >>>>> } >>>>> } >>>>> + >>>>> + dump_finish (pass_profile.pass.static_pass_number); >>>>> } >>>>> >>>>> /* Return True if any type of profiling is enabled which requires linking >>>>> Index: common.opt >>>>> =================================================================== >>>>> --- common.opt (revision 200845) >>>>> +++ common.opt (working copy) >>>>> @@ -1172,10 +1172,6 @@ fripa-inc-path-sub= >>>>> Common Joined RejectNegative Var(lipo_inc_path_pattern) >>>>> Substitute substring in include paths with a new string to allow >>>>> reuse profile data >>>>> >>>>> -fripa-verbose >>>>> -Common Report Var(flag_ripa_verbose) >>>>> -Enable verbose informational messages for LIPO compilation >>>>> - >>>>> fearly-inlining >>>>> Common Report Var(flag_early_inlining) Init(1) Optimization >>>>> Perform early inlining >>>>> Index: testsuite/gcc.dg/pr32773.c >>>>> =================================================================== >>>>> --- testsuite/gcc.dg/pr32773.c (revision 200845) >>>>> +++ testsuite/gcc.dg/pr32773.c (working copy) >>>>> @@ -1,6 +1,6 @@ >>>>> /* { dg-do compile } */ >>>>> -/* { dg-options "-O -fprofile-use" } */ >>>>> -/* { dg-options "-O -m4 -fprofile-use" { target sh-*-* } } */ >>>>> +/* { dg-options "-O -fprofile-use -fopt-info" } */ >>>>> +/* { dg-options "-O -m4 -fprofile-use -fopt-info" { target sh-*-* } } */ >>>>> >>>>> void foo (int *p) >>>>> { >>>>> Index: testsuite/gcc.dg/pr40209.c >>>>> =================================================================== >>>>> --- testsuite/gcc.dg/pr40209.c (revision 200845) >>>>> +++ testsuite/gcc.dg/pr40209.c (working copy) >>>>> @@ -1,5 +1,5 @@ >>>>> /* { dg-do compile } */ >>>>> -/* { dg-options "-O2 -fprofile-use" } */ >>>>> +/* { dg-options "-O2 -fprofile-use -fopt-info" } */ >>>>> >>>>> void process(const char *s); >>>>> >>>>> Index: testsuite/gcc.dg/pr26570.c >>>>> =================================================================== >>>>> --- testsuite/gcc.dg/pr26570.c (revision 200845) >>>>> +++ testsuite/gcc.dg/pr26570.c (working copy) >>>>> @@ -1,5 +1,5 @@ >>>>> /* { dg-do compile } */ >>>>> -/* { dg-options "-O2 -fprofile-generate -fprofile-use" } */ >>>>> +/* { dg-options "-O2 -fprofile-generate -fprofile-use -fopt-info" } */ >>>>> >>>>> unsigned test (unsigned a, unsigned b) >>>>> { >>>>> Index: testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c >>>>> =================================================================== >>>>> --- testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c (revision 200845) >>>>> +++ testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c (working copy) >>>>> @@ -1,4 +1,4 @@ >>>>> -/* { dg-options "-O2 -fdump-tree-optimized-details-blocks >>>>> -fdump-ipa-inline-details -fripa-verbose" } */ >>>>> +/* { dg-options "-O2 -fdump-tree-optimized-details-blocks >>>>> -fdump-ipa-inline-details -fopt-info" } */ >>>>> >>>>> extern int foo (void); >>>>> extern int goo (void); >>>>> Index: testsuite/g++.dg/tree-ssa/dom-invalid.C >>>>> =================================================================== >>>>> --- testsuite/g++.dg/tree-ssa/dom-invalid.C (revision 200845) >>>>> +++ testsuite/g++.dg/tree-ssa/dom-invalid.C (working copy) >>>>> @@ -1,7 +1,7 @@ >>>>> // PR tree-optimization/39557 >>>>> // invalid post-dom info leads to infinite loop >>>>> // { dg-do run } >>>>> -// { dg-options "-Wall -fno-exceptions -O2 -fprofile-use -fno-rtti" } >>>>> +// { dg-options "-Wall -fno-exceptions -O2 -fprofile-use -fopt-info >>>>> -fno-rtti" } >>>>> >>>>> struct C >>>>> { >>>>> Index: passes.c >>>>> =================================================================== >>>>> --- passes.c (revision 200845) >>>>> +++ passes.c (working copy) >>>>> @@ -539,6 +539,11 @@ register_one_dump_file (struct opt_pass *pass) >>>>> flag_name = concat (prefix, name, num, NULL); >>>>> glob_name = concat (prefix, name, NULL); >>>>> optgroup_flags |= pass->optinfo_flags; >>>>> + /* For any passes that do not have an optgroup set, and which are not >>>>> + IPA passes setup above, set the optgroup to OPTGROUP_OTHER so that >>>>> + any dump messages are emitted properly under -fopt-info(-optall). */ >>>>> + if (optgroup_flags == OPTGROUP_NONE) >>>>> + optgroup_flags = OPTGROUP_OTHER; >>>>> id = dump_register (dot_name, flag_name, glob_name, flags, optgroup_flags); >>>>> set_pass_for_id (id, pass); >>>>> full_name = concat (prefix, pass->name, num, NULL); >>>>> Index: params.def >>>>> =================================================================== >>>>> --- params.def (revision 200847) >>>>> +++ params.def (working copy) >>>>> @@ -996,8 +996,8 @@ DEFPARAM (PARAM_LIPO_WEAK_INCLUSION, >>>>> in inline message. */ >>>>> DEFPARAM (PARAM_INLINE_DUMP_MODULE_ID, >>>>> "inline-dump-module-id", >>>>> - "Default is 0. If the value is 1, dumping is enabled.", >>>>> - 0, 0, 1) >>>>> + "Default is 1. If the value is 0, dumping is disabled.", >>>>> + 1, 0, 1) >>>>> >>>>> /* In LIPO profile-gen, use this parameter to enable cgraph dumping. */ >>>>> DEFPARAM (PARAM_LIPO_DUMP_CGRAPH, >>>>> Index: c-family/c-opts.c >>>>> =================================================================== >>>>> --- c-family/c-opts.c (revision 200845) >>>>> +++ c-family/c-opts.c (working copy) >>>>> @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see >>>>> #include "function.h" >>>>> #include "params.h" >>>>> #include "l-ipo.h" >>>>> +#include "dumpfile.h" >>>>> >>>>> #ifndef DOLLARS_IN_IDENTIFIERS >>>>> # define DOLLARS_IN_IDENTIFIERS true >>>>> @@ -1057,12 +1058,16 @@ lipo_max_mem_reached (unsigned int i) >>>>> by the optimizer. */ >>>>> && ((ggc_total_allocated () >> 10) * 1.25 >>>>> > (size_t) PARAM_VALUE (PARAM_MAX_LIPO_MEMORY))) { >>>>> - i++; >>>>> - do { >>>>> - inform (input_location, "Not importing %s: maximum memory " >>>>> - "consumption reached", in_fnames[i]); >>>>> - i++; >>>>> - } while (i < num_in_fnames); >>>>> + if (dump_enabled_p ()) >>>>> + { >>>>> + i++; >>>>> + do { >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location, >>>>> + "Not importing %s: maximum memory " >>>>> + "consumption reached", in_fnames[i]); >>>>> + i++; >>>>> + } while (i < num_in_fnames); >>>>> + } >>>>> return true; >>>>> } >>>>> return false; >>>>> Index: profile.c >>>>> =================================================================== >>>>> --- profile.c (revision 200845) >>>>> +++ profile.c (working copy) >>>>> @@ -545,8 +545,8 @@ read_profile_edge_counts (gcov_type *exec_counts) >>>>> if (flag_profile_correction) >>>>> { >>>>> static bool informed = 0; >>>>> - if (!informed) >>>>> - inform (input_location, >>>>> + if (dump_enabled_p () && !informed) >>>>> + dump_printf_loc (MSG_NOTE, input_location, >>>>> "corrupted profile info: edge count >>>>> exceeds maximal count"); >>>>> informed = 1; >>>>> } >>>>> @@ -805,10 +805,11 @@ compute_branch_probabilities (unsigned cfg_checksu >>>>> { >>>>> /* Inconsistency detected. Make it flow-consistent. */ >>>>> static int informed = 0; >>>>> - if (informed == 0) >>>>> + if (dump_enabled_p () && informed == 0) >>>>> { >>>>> informed = 1; >>>>> - inform (input_location, "correcting inconsistent profile data"); >>>>> + dump_printf_loc (MSG_NOTE, input_location, >>>>> + "correcting inconsistent profile data"); >>>>> } >>>>> correct_negative_edge_counts (); >>>>> /* Set bb counts to the sum of the outgoing edge counts */ >>>>> Index: dumpfile.h >>>>> =================================================================== >>>>> --- dumpfile.h (revision 200845) >>>>> +++ dumpfile.h (working copy) >>>>> @@ -97,8 +97,9 @@ enum tree_dump_index >>>>> #define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */ >>>>> #define OPTGROUP_INLINE (1 << 3) /* Inlining passes */ >>>>> #define OPTGROUP_VEC (1 << 4) /* Vectorization passes */ >>>>> +#define OPTGROUP_OTHER (1 << 5) /* All other passes */ >>>>> #define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \ >>>>> - | OPTGROUP_VEC) >>>>> + | OPTGROUP_VEC | OPTGROUP_OTHER) >>>>> >>>>> /* Define a tree dump switch. */ >>>>> struct dump_file_info >>>>> Index: value-prof.c >>>>> =================================================================== >>>>> --- value-prof.c (revision 200845) >>>>> +++ value-prof.c (working copy) >>>>> @@ -504,9 +504,11 @@ check_counter (gimple stmt, const char * name, >>>>> : DECL_SOURCE_LOCATION (current_function_decl); >>>>> if (flag_profile_correction) >>>>> { >>>>> - inform (locus, "correcting inconsistent value profile: " >>>>> - "%s profiler overall count (%d) does not match BB count " >>>>> - "(%d)", name, (int)*all, (int)bb_count); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "correcting inconsistent value profile: %s " >>>>> + "profiler overall count (%d) does not match BB " >>>>> + "count (%d)", name, (int)*all, (int)bb_count); >>>>> *all = bb_count; >>>>> if (*count > *all) >>>>> *count = *all; >>>>> @@ -540,35 +542,35 @@ check_ic_counter (gimple stmt, gcov_type *count1, >>>>> gcov_type all) >>>>> { >>>>> location_t locus; >>>>> + locus = (stmt != NULL) >>>>> + ? gimple_location (stmt) >>>>> + : DECL_SOURCE_LOCATION (current_function_decl); >>>>> if (*count1 > all && flag_profile_correction) >>>>> { >>>>> - locus = (stmt != NULL) >>>>> - ? gimple_location (stmt) >>>>> - : DECL_SOURCE_LOCATION (current_function_decl); >>>>> - inform (locus, "Correcting inconsistent value profile: " >>>>> - "ic (topn) profiler top target count (%ld) exceeds " >>>>> - "BB count (%ld)", (long)*count1, (long)all); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Correcting inconsistent value profile: " >>>>> + "ic (topn) profiler top target count (%ld) exceeds " >>>>> + "BB count (%ld)", (long)*count1, (long)all); >>>>> *count1 = all; >>>>> } >>>>> if (*count2 > all && flag_profile_correction) >>>>> { >>>>> - locus = (stmt != NULL) >>>>> - ? gimple_location (stmt) >>>>> - : DECL_SOURCE_LOCATION (current_function_decl); >>>>> - inform (locus, "Correcting inconsistent value profile: " >>>>> - "ic (topn) profiler second target count (%ld) exceeds " >>>>> - "BB count (%ld)", (long)*count2, (long)all); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Correcting inconsistent value profile: " >>>>> + "ic (topn) profiler second target count >>>>> (%ld) exceeds " >>>>> + "BB count (%ld)", (long)*count2, (long)all); >>>>> *count2 = all; >>>>> } >>>>> >>>>> if (*count2 > *count1) >>>>> { >>>>> - locus = (stmt != NULL) >>>>> - ? gimple_location (stmt) >>>>> - : DECL_SOURCE_LOCATION (current_function_decl); >>>>> - inform (locus, "Corrupted topn ic value profile: " >>>>> - "first target count (%ld) is less than the second " >>>>> - "target count (%ld)", (long)*count1, (long)*count2); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Corrupted topn ic value profile: " >>>>> + "first target count (%ld) is less than the second " >>>>> + "target count (%ld)", (long)*count1, (long)*count2); >>>>> return true; >>>>> } >>>>> >>>>> @@ -580,12 +582,12 @@ check_ic_counter (gimple stmt, gcov_type *count1, >>>>> *count2 = all - *count1; >>>>> else >>>>> { >>>>> - locus = (stmt != NULL) >>>>> - ? gimple_location (stmt) >>>>> - : DECL_SOURCE_LOCATION (current_function_decl); >>>>> - inform (locus, "Corrupted topn ic value profile: top two targets's" >>>>> - " total count (%ld) exceeds bb count (%ld)", >>>>> - (long)(*count1 + *count2), (long)all); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Corrupted topn ic value profile: top two " >>>>> + "targets's total count (%ld) exceeds bb count " >>>>> + "(%ld)", >>>>> + (long)(*count1 + *count2), (long)all); >>>>> return true; >>>>> } >>>>> } >>>>> @@ -1196,9 +1198,11 @@ find_func_by_funcdef_no (int func_id) >>>>> int max_id = get_last_funcdef_no (); >>>>> if (func_id >= max_id || cgraph_node_map[func_id] == NULL) >>>>> { >>>>> - if (flag_profile_correction) >>>>> - inform (DECL_SOURCE_LOCATION (current_function_decl), >>>>> - "Inconsistent profile: indirect call target (%d) does >>>>> not exist", func_id); >>>>> + if (flag_profile_correction && dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, >>>>> + DECL_SOURCE_LOCATION (current_function_decl), >>>>> + "Inconsistent profile: indirect call target (%d) " >>>>> + "does not exist", func_id); >>>>> else >>>>> error ("Inconsistent profile: indirect call target (%d) does >>>>> not exist", func_id); >>>>> >>>>> @@ -1331,8 +1335,10 @@ check_ic_target (gimple call_stmt, struct cgraph_n >>>>> return true; >>>>> >>>>> locus = gimple_location (call_stmt); >>>>> - inform (locus, "Skipping target %s with mismatching types for icall ", >>>>> - cgraph_node_name (target)); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Skipping target %s with mismatching types for icall ", >>>>> + cgraph_node_name (target)); >>>>> return false; >>>>> } >>>>> >>>>> @@ -1600,19 +1606,23 @@ gimple_ic_transform_mult_targ (gimple stmt, histog >>>>> if (direct_call1 == NULL >>>>> || !check_ic_target (stmt, direct_call1)) >>>>> { >>>>> - if (flag_ripa_verbose && !flag_auto_profile) >>>>> + if (dump_enabled_p () && !flag_auto_profile) >>>>> { >>>>> if (!direct_call1) >>>>> - inform (locus, "Can not find indirect call target decl " >>>>> - "(%d:%d)[cnt:%u] in current module", >>>>> - EXTRACT_MODULE_ID_FROM_GLOBAL_ID (val1), >>>>> - EXTRACT_FUNC_ID_FROM_GLOBAL_ID (val1), (unsigned) count1); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Can not find indirect call target decl " >>>>> + "(%d:%d)[cnt:%u] in current module", >>>>> + EXTRACT_MODULE_ID_FROM_GLOBAL_ID (val1), >>>>> + EXTRACT_FUNC_ID_FROM_GLOBAL_ID (val1), >>>>> + (unsigned) count1); >>>>> else >>>>> - inform (locus, >>>>> - "Can not find promote indirect call target decl >>>>> -- type mismatch " >>>>> - "(%d:%d)[cnt:%u] in current module", >>>>> - EXTRACT_MODULE_ID_FROM_GLOBAL_ID (val1), >>>>> - EXTRACT_FUNC_ID_FROM_GLOBAL_ID (val1), (unsigned) count1); >>>>> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus, >>>>> + "Can not find promote indirect call target decl " >>>>> + "-- type mismatch (%d:%d)[cnt:%u] in current " >>>>> + "module", >>>>> + EXTRACT_MODULE_ID_FROM_GLOBAL_ID (val1), >>>>> + EXTRACT_FUNC_ID_FROM_GLOBAL_ID (val1), >>>>> + (unsigned) count1); >>>>> } >>>>> return false; >>>>> } >>>>> @@ -1626,10 +1636,12 @@ gimple_ic_transform_mult_targ (gimple stmt, histog >>>>> return false; >>>>> >>>>> modify1 = gimple_ic (stmt, direct_call1, prob1, count1, all); >>>>> - if (flag_ripa_verbose) >>>>> - inform (locus, "Promote indirect call to target (call count:%u) %s", >>>>> - (unsigned) count1, >>>>> - lang_hooks.decl_printable_name (direct_call1->symbol.decl, 3)); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus, >>>>> + "Promote indirect call to target (call count:%u) %s", >>>>> + (unsigned) count1, >>>>> + lang_hooks.decl_printable_name >>>>> (direct_call1->symbol.decl, >>>>> + 3)); >>>>> >>>>> if (always_inline && count1 >= always_inline) >>>>> { >>>>> @@ -1667,10 +1679,12 @@ gimple_ic_transform_mult_targ (gimple stmt, histog >>>>> modify2 = gimple_ic (stmt, direct_call2, >>>>> prob2, count2, all - count1); >>>>> >>>>> - if (flag_ripa_verbose) >>>>> - inform (locus, "Promote indirect call to target (call count:%u) %s", >>>>> - (unsigned) count2, >>>>> - lang_hooks.decl_printable_name (direct_call2->symbol.decl, 3)); >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus, >>>>> + "Promote indirect call to target (call count:%u) %s", >>>>> + (unsigned) count2, >>>>> + lang_hooks.decl_printable_name ( >>>>> + direct_call2->symbol.decl, 3)); >>>>> >>>>> if (always_inline && count2 >= always_inline) >>>>> { >>>>> Index: doc/invoke.texi >>>>> =================================================================== >>>>> --- doc/invoke.texi (revision 200845) >>>>> +++ doc/invoke.texi (working copy) >>>>> @@ -6285,6 +6285,9 @@ Enable dumps from all loop optimizations. >>>>> Enable dumps from all inlining optimizations. >>>>> @item vec >>>>> Enable dumps from all vectorization optimizations. >>>>> +@item optall >>>>> +Enable dumps from all optimizations. This is a superset of >>>>> +the optimization groups listed above. >>>>> @end table >>>>> >>>>> For example, >>>>> Index: mcf.c >>>>> =================================================================== >>>>> --- mcf.c (revision 200845) >>>>> +++ mcf.c (working copy) >>>>> @@ -1437,10 +1437,12 @@ find_minimum_cost_flow (fixup_graph_type *fixup_gr >>>>> if (iteration > MAX_ITER (fixup_graph->num_vertices, >>>>> fixup_graph->num_edges)) >>>>> { >>>>> - inform (DECL_SOURCE_LOCATION (current_function_decl), >>>>> - "Exiting profile correction early to avoid excessive " >>>>> - "compile time"); >>>>> - break; >>>>> + if (dump_enabled_p ()) >>>>> + dump_printf_loc (MSG_NOTE, >>>>> + DECL_SOURCE_LOCATION (current_function_decl), >>>>> + "Exiting profile correction early to avoid " >>>>> + "excessive compile time"); >>>>> + break; >>>>> } >>>>> } >>>>> >>>>> >>>>> -- >>>>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413 >>> >>> >>> >>> -- >>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413 >> >> >> >> -- >> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413 Index: dumpfile.c =================================================================== --- dumpfile.c (revision 201268) +++ dumpfile.c (working copy) @@ -257,14 +257,15 @@ dump_open_alternate_stream (struct dump_file_info void dump_loc (int dump_kind, FILE *dfile, source_location loc) { - /* Currently vectorization passes print location information. */ if (dump_kind) { + /* Ensure dump message starts on a new line. */ + fprintf (dfile, "\n"); if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION) - fprintf (dfile, "\n%s:%d:%d: note: ", LOCATION_FILE (loc), + fprintf (dfile, "%s:%d:%d: note: ", LOCATION_FILE (loc), LOCATION_LINE (loc), LOCATION_COLUMN (loc)); else if (current_function_decl) - fprintf (dfile, "\n%s:%d:%d: note: ", + fprintf (dfile, "%s:%d:%d: note: ", DECL_SOURCE_FILE (current_function_decl), DECL_SOURCE_LINE (current_function_decl), DECL_SOURCE_COLUMN (current_function_decl));