From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id D823A3857C5E for ; Fri, 6 Nov 2020 09:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D823A3857C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: 5ZaWNGc8tKTSVy5/KsDXLlQy3EytJ75J3Qifzpu4XMCH4NPpTWpIOc73YanXFogi7ckrpQ+CCH xF5DJ4mR2pSDZdS/aO9sUiBACnytqWp8EIkjwBc+e0zQbI7otKgGJYe6Wz1qcaBRWLSxVU8DFH oYhGfpcMdnTOONdMN98p62s+wJb+WWf4L3UmfGHW1rAbQ7sIN8zV95o1eSgu6o2/zIW0qd9z+Q q7KecUPEXVpRC0eexVV572n5TBj9I9EZsmvoKJzCaZzMzTlON9Hri4SkZGfSxlr3Af8DxDEScR uFk= X-IronPort-AV: E=Sophos;i="5.77,456,1596528000"; d="scan'208,223";a="54765714" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 06 Nov 2020 01:27:00 -0800 IronPort-SDR: 5QfIVBCk5L+xwU3FLz6Jp5TfOtCBoPgmPCyH9KPYdg2IxjvbDoxqNNbcC/lEQT14T5VR7NtQv7 35QWfqQdAPo53f7oq4inVi2BrCcETvtTLLZal3kIbxCKyQ0b/FVecUlpCRtLAIPPMm1zsrZ54i DAo0KnugWxq6SrPCBEx9VSdPUekSNX6VUbweRmog68HDWp8YoqQt4SoP8hMnhMA1dx3H9PJZBb ThpgHowhWpF7kWQ3MHpCkeM5hISWUsN5bvMQY8pPfmzrKOE6sivDN7lyUrq+I5NugVShEJMx7Q 05I= From: Thomas Schwinge To: David Malcolm , , Rainer Orth , Mike Stump Subject: Add 'dg-note' next to 'dg-optimized', 'dg-missed' (was: [PATCH] dumpfile.c: use prefixes other that 'note: ' for MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}) In-Reply-To: <1537905614-44303-1-git-send-email-dmalcolm@redhat.com> References: <1537905614-44303-1-git-send-email-dmalcolm@redhat.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Fri, 6 Nov 2020 10:26:46 +0100 Message-ID: <87k0uyesyx.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 09:27:03 -0000 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, again! 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 end= s up with assumptions. (However, 'MSG_NOTE'/'note: ' also still remains used for "general optimization info".) > 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. TODO document (also 'dg-optimized', 'dg-missed') 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? Gr=C3=BC=C3=9Fe Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstra=C3=9Fe 201, 80634 M=C3=BCnch= en / Germany Registergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas = Heurung, Alexander Walter --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-WIP-Add-dg-note-next-to-dg-optimized-dg-missed.patch" >From bb293fff7580025a3b78fc1619d8bf0d8f8b8a1a Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 6 Nov 2020 09:01:26 +0100 Subject: [PATCH] [WIP] Add 'dg-note' next to 'dg-optimized', 'dg-missed' TODO document (also 'dg-optimized', 'dg-missed') TODO 'gcc/testsuite/lib/lto.exp' change necessary/desirable? --- .../gcc.dg/vect/nodump-vect-opt-info-2.c | 4 ++- gcc/testsuite/lib/gcc-dg.exp | 26 +++++++++++++++++++ gcc/testsuite/lib/lto.exp | 7 +++-- gcc/testsuite/lib/prune.exp | 7 +++-- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c index 23a3b39fbb32..bcdf7f076715 100644 --- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c +++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c @@ -3,7 +3,9 @@ extern void accumulate (int x, int *a); -int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */ +int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */ +/* { dg-prune-output "note: " } as we're not interested in matching any further + notes. */ { int sum = 0; for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */ diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 700529afbe25..c6ff07ab1376 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1012,6 +1012,8 @@ if { [info procs saved-dg-test] == [list] } { } unset save_linenr_varnames } + + initialize_prune_notes } proc dg-test { args } { @@ -1245,6 +1247,30 @@ proc dg-missed { args } { process-message saved-dg-warning "missed:" "$args" } +# Handle output from -fopt-info for MSG_NOTE: +# a general optimization info. +# By default, such notes are pruned, but if dg-note is used once, they must all +# be handled explicitly. + +variable prune_notes + +proc initialize_prune_notes { } { + global prune_notes + set prune_notes 1 +} + +initialize_prune_notes + +proc dg-note { args } { + # Make this variable available here and to the saved proc. + upvar dg-messages dg-messages + + global prune_notes + set prune_notes 0 + + process-message saved-dg-warning "note:" "$args" +} + # Check the existence of a gdb in the path, and return true if there # is one. # diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index b2fa7ec8cecb..c9ed65ffc7cb 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -159,8 +159,11 @@ proc lto_prune_warns { text } { regsub -all "(^|\n)\[ \t\]*\[\(\]file \[^\n\]* value=\[^\n\]*; file \[^\n\]* value=\[^\n\]*\[)\];" $text "" text regsub -all "(^|\n)\[ \t\]*\[^\n\]* definition taken" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } verbose "lto_prune_warns: exit: $text" 2 diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp index 190367c44e0f..ed7dec16fa1f 100644 --- a/gcc/testsuite/lib/prune.exp +++ b/gcc/testsuite/lib/prune.exp @@ -50,8 +50,11 @@ proc prune_gcc_output { text } { regsub -all "(^|\n)\[0-9\]\[0-9\]* errors\." $text "" text regsub -all "(^|\n)(In file included|\[ \]+from)\[^\n\]*" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } # Ignore harmless -fpic warnings. regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text -- 2.17.1 --=-=-=--