On 11/6/20 1:38 AM, Thomas Schwinge wrote:
> Hi!
>
> On 2018-09-25T16:00:14-0400, David Malcolm <dmalc...@redhat.com> wrote:
>> As noted at Cauldron, dumpfile.c currently emits "note: " for all kinds
>> of dump message, so that (after filtering) there's no distinction between
>> MSG_OPTIMIZED_LOCATIONS vs MSG_NOTE vs MSG_MISSED_OPTIMIZATION in the
>> textual output.
>>
>> This patch changes dumpfile.c so that the "note: " varies to show
>> which MSG_* was used, with the string prefix matching that used for
>> filtering in -fopt-info, hence e.g.
>>   directive_unroll_3.f90:24:0: optimized: loop unrolled 7 times
>> and:
>>   pr19210-1.c:24:3: missed: missed loop optimization: niters analysis ends 
>> up with assumptions.
>>
>> The patch adds "dg-optimized" and "dg-missed" directives for use
>> in the testsuite for matching these (with -fopt-info on stderr; they
>> don't help for dumpfile output).
> Thanks, this is very useful.
>
>
> I just ran into a problem regarding these two:
>
>> --- a/gcc/testsuite/lib/gcc-dg.exp
>> +++ b/gcc/testsuite/lib/gcc-dg.exp
>> +# Handle output from -fopt-info for MSG_OPTIMIZED_LOCATIONS:
>> +# a successful optimization.
>> +
>> +proc dg-optimized { args } {
>> +    # Make this variable available here and to the saved proc.
>> +    upvar dg-messages dg-messages
>> +
>> +    process-message saved-dg-error "optimized: " "$args"
>> +}
>> +
>> +# Handle output from -fopt-info for MSG_MISSED_OPTIMIZATION:
>> +# a missed optimization.
>> +
>> +proc dg-missed { args } {
>> +    # Make this variable available here and to the saved proc.
>> +    upvar dg-messages dg-messages
>> +
>> +    process-message saved-dg-error "missed: " "$args"
>> +}
> If, in addition to the usual line location checking, you'd like to do
> column location checking ("[column]: " prefix before the actual
> diagnostic), and the actual diagnostic doesn't begin with whitespace,
> then this currently fails.  To address this, OK to push the attached
> patch "[testsuite] Enable column location checking for 'dg-optimized',
> 'dg-missed'" -- with or without the demonstrator
> 'gcc.dg/vect/nodump-vect-opt-info-1.c',
> 'gcc.dg/vect/nodump-vect-opt-info-2.c' changes, your call?  (I still have
> to run this through regression testing.)
>
>
> Grüße
>  Thomas
>
>
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, 
> Alexander Walter
>
> 0001-testsuite-Enable-column-location-checking-for-dg-opt.patch
>
> From f3046b8bea6a2a6489dd10d72cb038b92aa4fc38 Mon Sep 17 00:00:00 2001
> From: Thomas Schwinge <tho...@codesourcery.com>
> Date: Fri, 6 Nov 2020 09:18:06 +0100
> Subject: [PATCH] [testsuite] Enable column location checking for
>  'dg-optimized', 'dg-missed'
>
> 'process-message' would like the 'msgprefix' argument without trailing space.
>
> This is a bug-fix for commit ed2d9d3720adef3a260b8a55e17e744352a901fc
> "dumpfile.c: use prefixes other than 'note: ' for
> MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}", which added 'dg-optimized',
> 'dg-missed'.
>
>       gcc/testsuite/
>       * lib/gcc-dg.exp (dg-optimized, dg-missed): Fix 'process-message'
>       call.
>       * gcc.dg/vect/nodump-vect-opt-info-1.c: Demonstrate.
>       * gcc.dg/vect/nodump-vect-opt-info-2.c: Likewise.

OK

jeff


Reply via email to