Hi! On 2020-11-30T12:28:31-0700, Jeff Law via Gcc-patches wrote: > On 11/24/20 2:53 AM, Thomas Schwinge wrote: >> On 2020-11-06T10:26:46+0100, I wrote: >>> On 2018-09-25T16:00:14-0400, David Malcolm 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. >>> (However, 'MSG_NOTE'/'note: ' also still remains used for "general >>> optimization info".) Well, and of course, 'note: ' prefixes have also "forever" been used for 'inform' etc. diagnostics; so my change here much more relates to 'dg-message', 'dg-warning', 'dg-error' rather than 'dg-optimized', 'dg-missed'. ;-) >>>> The patch adds "dg-optimized" and "dg-missed" directives >>>> --- 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" >>>> +} >>>> + >>> >>> Next to these, I'm proposing to add 'dg-note', see attached "[WIP] Add >>> 'dg-note' next to 'dg-optimized'", which may be used instead of generic >>> 'dg-message' (which in current uses in testcases often doesn't scan for >>> the 'note: ' prefix, by the way). >>> >>> The proposed 'dg-note' has the additional property that "if dg-note is >>> used once, [notes] must *all* be handled explicitly". The rationale is >>> that either you're not interested in notes at all (default behavior of >>> pruning all notes), but often, when you're interested in one note, you're >>> in fact interested in all notes, and especially interested if >>> *additional* notes appear over time, as GCC evolves. It seemed somewhat >>> useful, but I'm not insisting on coupling the disabling of notes pruning >>> on 'dg-note' usage, so if anyone feels strongly about that, please speak >>> up. (No comments received.) > I think this is generally fine with the proper doc updates. ACK, thanks; done. >>> TODO 'gcc/testsuite/lib/lto.exp' change necessary/desirable? >>> >>> The latter got added in commit 824721f0905478ebc39e6a295cc8e95c22fa9d17 >>> "lto, testsuite: Fix ICE in -Wodr (PR lto/83121)". David, do you happen >>> to have an opinion on that one? > I wouldn't > think we'd want/need to treat LTO differently, so I'm not so sure about > that specific hunk. As it should turn out -- of course ;-) -- LTO does need some special care; added, plus a few testcases adapted, too. I've pushed "Add 'dg-note', 'dg-lto-note'" to master branch in commit 03eb779141a29f96600cd46904b88a33c4b49a66, see attached. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf