This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: add dbgcnt and opt-info support for devirtualization
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Xinliang David Li <davidxl at google dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 May 2014 13:32:54 +0200
- Subject: Re: add dbgcnt and opt-info support for devirtualization
- Authentication-results: sourceware.org; auth=none
- References: <CAAkRFZKGLC9vW3-niUu2QrQGKZzUeq6Qv989bOaHdLjkn=6JqA at mail dot gmail dot com> <20140516160323 dot GE20755 at kam dot mff dot cuni dot cz> <CAAkRFZL=R+wxVWFbCmivmTcrOUzks=SYkDx7p034twUA1Qzx8w at mail dot gmail dot com> <CAFiYyc1-wR8pf1528Z-pdhCWAuGb57uzZ3Xs9uSbcWUrL3s6mA at mail dot gmail dot com> <CAAkRFZKLFSCuVR9WV2OA6uKNO+_spVLerjS-KEXYMXnGL0z3RQ at mail dot gmail dot com>
On Mon, May 19, 2014 at 5:24 PM, Xinliang David Li <davidxl@google.com> wrote:
> Sorry about it. Here is the patch. There is one remaining case where
> cgraph_dump_file and dump_enable_p are checked separately --
> cgraph_dump_file is set up differently from 'dump_file'.
But there you check with an else if, so if you do -fdump-ipa-cgraph
then suddenly -fopt-info will stop reporting? At least in the cgraphunit.c
part of the patch.
I'm ok with the rest of the patch.
Thanks,
Richard.
> David
>
>
>
> On Mon, May 19, 2014 at 2:21 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Fri, May 16, 2014 at 11:19 PM, Xinliang David Li <davidxl@google.com> wrote:
>>> Modified the patch according to yours and Richard's feedback. PTAL.
>>
>> ENOPATCH.
>>
>> Btw, I don't see any issue with leaking node order to opt-report.
>>
>> Richard.
>>
>>> thanks,
>>>
>>> David
>>>
>>> On Fri, May 16, 2014 at 9:03 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>>>>> Hi, debugging runtime bugs due to devirtualization can be hard for
>>>>> very large C++ programs with complicated class hierarchy. This patch
>>>>> adds the support to report this high level transformation via
>>>>> -fopt-info (not hidden inside dump file) and the ability the do binary
>>>>> search with cutoff.
>>>>>
>>>>> Ok for trunk after build and test?
>>>>
>>>> Seems resonable to me.
>>>>>
>>>>> thanks,
>>>>>
>>>>> David
>>>>
>>>>> Index: ChangeLog
>>>>> ===================================================================
>>>>> --- ChangeLog (revision 210479)
>>>>> +++ ChangeLog (working copy)
>>>>> @@ -1,3 +1,18 @@
>>>>> +2014-05-15 Xinliang David Li <davidxl@google.com>
>>>>> +
>>>>> + * cgraphunit.c (walk_polymorphic_call_targets): Add
>>>>> + dbgcnt and fopt-info support.
>>>>> + 2014-05-15 Xinliang David Li <davidxl@google.com>
>>>>> +
>>>>> + * cgraphunit.c (walk_polymorphic_call_targets): Add
>>>>> + dbgcnt and fopt-info support.
>>>>> + * ipa-prop.c (ipa_make_edge_direct_to_target): Ditto.
>>>>> + * ipa-devirt.c (ipa_devirt): Ditto.
>>>>> + * ipa.c (walk_polymorphic_call_targets): Ditto.
>>>>> + * gimple-fold.c (fold_gimple_assign): Ditto.
>>>>> + (gimple_fold_call): Ditto.
>>>>> + * dbgcnt.def: New counter.
>>>>> +
>>>>> 2014-05-15 Martin Jambor <mjambor@suse.cz>
>>>>>
>>>>> PR ipa/61085
>>>>> Index: ipa-prop.c
>>>>> ===================================================================
>>>>> --- ipa-prop.c (revision 210479)
>>>>> +++ ipa-prop.c (working copy)
>>>>> @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3.
>>>>> #include "ipa-utils.h"
>>>>> #include "stringpool.h"
>>>>> #include "tree-ssanames.h"
>>>>> +#include "dbgcnt.h"
>>>>>
>>>>> /* Intermediate information about a parameter that is only useful during the
>>>>> run of ipa_analyze_node and is not kept afterwards. */
>>>>> @@ -2494,6 +2495,13 @@ ipa_make_edge_direct_to_target (struct c
>>>>> fprintf (dump_file, "ipa-prop: Discovered direct call to non-function"
>>>>> " in %s/%i, making it unreachable.\n",
>>>>> ie->caller->name (), ie->caller->order);
>>>>> + else if (dump_enabled_p ())
>>>>> + {
>>>>> + location_t loc = gimple_location (ie->call_stmt);
>>>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
>>>>> + "Discovered direct call to non-function in %s, "
>>>>> + "making it unreachable\n", ie->caller->name ());
>>>>
>>>> Perhaps "turning it to __builtin_unreachable call" and similarly in the other cases
>>>> we introduce __builtin_unreachable? I think that could be easier for user to work
>>>> out.
>>>>
>>>> What king of problems in devirtualizatoin you are seeing?
>>>>
>>>>
>>>> Honza