From patchwork Tue Sep 25 20:00:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 974672 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486370-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="d07w3w7v"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42KW1Q6GpWz9s2P for ; Wed, 26 Sep 2018 05:12:57 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=GMUogAibPrO3 R6fBSLPiqEZEBfCbH6a3BtKsejVdZAEdZZJWxX7Pd3/ccMQM1c4eLebhMA26mF9k 9BggjnWf5WjzNoW2ew4E8//WkmEkzEFlXc/ZvEhnuxBOIT2iQljGkaLQGLlUOBTJ GRxHa3XnfATQXKHdrH4XJ72GGNUfN5s= 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:from :to:cc:subject:date:message-id; s=default; bh=1cwEGE0lFQWCUyREbi uoAzFpvcc=; b=d07w3w7v3gMtEOZywRsXDprn+4NskHJKZH9etzbXdDJCWBSqBf OA8roVmWsa7Ddr+BnOKh1k8zNeeIPHqESnNQmbkW5liZTcexiZRbid+MgIeWm9sG LBKf0hIxuj6TWMmsZSCNTicc9LhvmkM+rxPD8FJECvpyDwz2iXr28Z6Us= Received: (qmail 43273 invoked by alias); 25 Sep 2018 19:12:49 -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 43261 invoked by uid 89); 25 Sep 2018 19:12:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2022, Rather X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Sep 2018 19:12:45 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9469083F44 for ; Tue, 25 Sep 2018 19:12:43 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-33.phx2.redhat.com [10.3.112.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C99860BE1; Tue, 25 Sep 2018 19:12:42 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH] dumpfile.c: use prefixes other that 'note: ' for MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION} Date: Tue, 25 Sep 2018 16:00:14 -0400 Message-Id: <1537905614-44303-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes 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). The patch also converts the various problem-reporting dump messages in coverage.c:get_coverage_counts to use MSG_MISSED_OPTIMIZATION rather than MSG_OPTIMIZED_LOCATIONS, as the docs call out "optimized" as "information when an optimization is successfully applied", whereas "missed" is for "information about missed optimizations", and problems with profile data seem to me to fall much more into the latter category than the former. Doing so requires converting a few tests from using "-fopt-info" (which is implicitly "-fopt-info-optimized-optall") to getting the "missed" optimizations. Changing them to "-fopt-info-missed" added lots of noise from the vectorizer, so I changed these tests to use "-fopt-info-missed-ipa". Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: * coverage.c (get_coverage_counts): Convert problem-reporting dump messages from MSG_OPTIMIZED_LOCATIONS to MSG_MISSED_OPTIMIZATION. * dumpfile.c (kind_as_string): New function. (dump_loc): Rather than a hardcoded prefix of "note: ", use kind_as_string to vary the prefix based on dump_kind. (selftest::test_capture_of_dump_calls): Update for above. gcc/testsuite/ChangeLog: * c-c++-common/unroll-1.c: Update expected output from "note" to "optimized". * c-c++-common/unroll-2.c: Likewise. * c-c++-common/unroll-3.c: Likewise. * g++.dg/tree-ssa/dom-invalid.C: Update expected output from dg-message to dg-missed. Convert param from -fopt-info to -fopt-info-missed-ipa. * g++.dg/tree-ssa/pr81408.C: Update expected output from dg-message to dg-missed. * g++.dg/vect/slp-pr56812.cc: Update expected output from dg-message to dg-optimized. * gcc.dg/pr26570.c: Update expected output from dg-message to dg-missed. Convert param from -fopt-info to -fopt-info-missed-ipa. * gcc.dg/pr32773.c: Likewise. * gcc.dg/tree-ssa/pr19210-1.c: Update expected output from dg-message to dg-missed. * gcc.dg/unroll-2.c: Update expected output from dg-message to dg-optimized. * gcc.dg/vect/nodump-vect-opt-info-1.c: Likewise. Convert param from -fopt-info to -fopt-info-vec. * gfortran.dg/directive_unroll_1.f90: Update expected output from "note" to "optimized". * gfortran.dg/directive_unroll_2.f90: Likewise. * gfortran.dg/directive_unroll_3.f90: Likewise. * gnat.dg/unroll4.adb: Likewise. * lib/gcc-dg.exp (dg-optimized): New procedure. (dg-missed): New procedure. --- gcc/coverage.c | 10 +++---- gcc/dumpfile.c | 33 ++++++++++++++++++---- gcc/testsuite/c-c++-common/unroll-1.c | 8 +++--- gcc/testsuite/c-c++-common/unroll-2.c | 8 +++--- gcc/testsuite/c-c++-common/unroll-3.c | 12 ++++---- gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C | 4 +-- gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- gcc/testsuite/g++.dg/vect/slp-pr56812.cc | 2 +- gcc/testsuite/gcc.dg/pr26570.c | 4 +-- gcc/testsuite/gcc.dg/pr32773.c | 6 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c | 8 +++--- gcc/testsuite/gcc.dg/unroll-2.c | 4 +-- gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c | 6 ++-- gcc/testsuite/gfortran.dg/directive_unroll_1.f90 | 6 ++-- gcc/testsuite/gfortran.dg/directive_unroll_2.f90 | 6 ++-- gcc/testsuite/gfortran.dg/directive_unroll_3.f90 | 8 +++--- gcc/testsuite/gnat.dg/unroll4.adb | 2 +- gcc/testsuite/lib/gcc-dg.exp | 20 +++++++++++++ 18 files changed, 96 insertions(+), 53 deletions(-) diff --git a/gcc/coverage.c b/gcc/coverage.c index 8f12778..2475495 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -308,7 +308,7 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum, { dump_user_location_t loc = dump_user_location_t::from_location_t (input_location); - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, (flag_guess_branch_prob ? "file %s not found, execution counts estimated\n" : "file %s not found, execution counts assumed to " @@ -347,7 +347,7 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum, { dump_user_location_t loc = dump_user_location_t::from_location_t (input_location); - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, "use -Wno-error=coverage-mismatch to tolerate " "the mismatch but performance may drop if the " "function is hot\n"); @@ -355,14 +355,14 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum, if (!seen_error () && !warned++) { - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, "coverage mismatch ignored\n"); - dump_printf (MSG_OPTIMIZED_LOCATIONS, + dump_printf (MSG_MISSED_OPTIMIZATION, flag_guess_branch_prob ? G_("execution counts estimated\n") : G_("execution counts assumed to be zero\n")); if (!flag_guess_branch_prob) - dump_printf (MSG_OPTIMIZED_LOCATIONS, + dump_printf (MSG_MISSED_OPTIMIZATION, "this can result in poorly optimized code\n"); } } diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 5655e46..db260a5 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -437,6 +437,27 @@ dump_user_location_t::from_function_decl (tree fndecl) DECL_SOURCE_LOCATION (fndecl)); } +/* Extract the MSG_* component from DUMP_KIND and return a string for use + as a prefix to dump messages. + These match the strings in optinfo_verbosity_options and thus the + "OPTIONS" within "-fopt-info-OPTIONS". */ + +static const char * +kind_as_string (dump_flags_t dump_kind) +{ + switch (dump_kind & MSG_ALL) + { + default: + gcc_unreachable (); + case MSG_OPTIMIZED_LOCATIONS: + return "optimized"; + case MSG_MISSED_OPTIMIZATION: + return "missed"; + case MSG_NOTE: + return "note"; + } +} + /* Print source location on DFILE if enabled. */ static void @@ -445,13 +466,14 @@ dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc) if (dump_kind) { if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION) - fprintf (dfile, "%s:%d:%d: note: ", LOCATION_FILE (loc), + fprintf (dfile, "%s:%d:%d: ", LOCATION_FILE (loc), LOCATION_LINE (loc), LOCATION_COLUMN (loc)); else if (current_function_decl) - fprintf (dfile, "%s:%d:%d: note: ", + fprintf (dfile, "%s:%d:%d: ", DECL_SOURCE_FILE (current_function_decl), DECL_SOURCE_LINE (current_function_decl), DECL_SOURCE_COLUMN (current_function_decl)); + fprintf (dfile, "%s: ", kind_as_string (dump_kind)); /* Indentation based on scope depth. */ fprintf (dfile, "%*s", get_dump_scope_depth (), ""); } @@ -465,13 +487,14 @@ dump_loc (dump_flags_t dump_kind, pretty_printer *pp, source_location loc) if (dump_kind) { if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION) - pp_printf (pp, "%s:%d:%d: note: ", LOCATION_FILE (loc), + pp_printf (pp, "%s:%d:%d: ", LOCATION_FILE (loc), LOCATION_LINE (loc), LOCATION_COLUMN (loc)); else if (current_function_decl) - pp_printf (pp, "%s:%d:%d: note: ", + pp_printf (pp, "%s:%d:%d: ", DECL_SOURCE_FILE (current_function_decl), DECL_SOURCE_LINE (current_function_decl), DECL_SOURCE_COLUMN (current_function_decl)); + pp_printf (pp, "%s: ", kind_as_string (dump_kind)); /* Indentation based on scope depth. */ for (unsigned i = 0; i < get_dump_scope_depth (); i++) pp_character (pp, ' '); @@ -2325,7 +2348,7 @@ test_capture_of_dump_calls (const line_table_case &case_) } dump_printf_loc (MSG_NOTE, stmt, "msg 7\n"); - ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: msg 4\n"); + ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: optimized: msg 4\n"); } } diff --git a/gcc/testsuite/c-c++-common/unroll-1.c b/gcc/testsuite/c-c++-common/unroll-1.c index 105a82c..fe7f4f3 100644 --- a/gcc/testsuite/c-c++-common/unroll-1.c +++ b/gcc/testsuite/c-c++-common/unroll-1.c @@ -20,22 +20,22 @@ void test (void) #pragma GCC unroll 8 for (unsigned long i = 1; i <= 15; ++i) bar(i); - /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 8 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 7 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */ unsigned long i = 0; #pragma GCC unroll 3 do { bar(i); } while (++i < 9); - /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */ } diff --git a/gcc/testsuite/c-c++-common/unroll-2.c b/gcc/testsuite/c-c++-common/unroll-2.c index a67a1d7..0bb4bbb 100644 --- a/gcc/testsuite/c-c++-common/unroll-2.c +++ b/gcc/testsuite/c-c++-common/unroll-2.c @@ -20,22 +20,22 @@ void test (void) #pragma GCC unroll 8 for (unsigned long i = 1; i <= 15; ++i) bar(i); - /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 8 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 7 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */ unsigned long i = 0; #pragma GCC unroll 3 do { bar(i); } while (++i < 9); - /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */ } diff --git a/gcc/testsuite/c-c++-common/unroll-3.c b/gcc/testsuite/c-c++-common/unroll-3.c index 6cefa75..541accb 100644 --- a/gcc/testsuite/c-c++-common/unroll-3.c +++ b/gcc/testsuite/c-c++-common/unroll-3.c @@ -10,32 +10,32 @@ void test (void) #pragma GCC unroll 8 for (unsigned long i = 1; i <= 8; ++i) bar(i); - /* { dg-final { scan-rtl-dump-not "11:.*: note: loop unrolled" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump-not "11:.*: optimized: loop unrolled" "loop2_unroll" } } */ #pragma GCC unroll 8 for (unsigned long i = 1; i <= 7; ++i) bar(i); - /* { dg-final { scan-rtl-dump-not "16:.*: note: loop unrolled" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump-not "16:.*: optimized: loop unrolled" "loop2_unroll" } } */ #pragma GCC unroll 8 for (unsigned long i = 1; i <= 15; ++i) bar(i); - /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "21:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 8 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "26:.*: optimized: loop unrolled 7 times" "loop2_unroll" } } */ #pragma GCC unroll 7 for (unsigned long i = 1; i <= j; ++i) bar(i); - /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "31:.*: optimized: loop unrolled 3 times" "loop2_unroll" } } */ unsigned long i = 0; #pragma GCC unroll 3 do { bar(i); } while (++i < 9); - /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */ + /* { dg-final { scan-rtl-dump "3\[79\]:.*: optimized: loop unrolled 2 times" "loop2_unroll" } } */ } diff --git a/gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C b/gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C index 41343ee..056d6ed 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C +++ b/gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C @@ -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 -fopt-info -fno-rtti" } +// { dg-options "-Wall -fno-exceptions -O2 -fprofile-use -fopt-info-missed-ipa -fno-rtti" } struct C { @@ -49,4 +49,4 @@ main () { E e; e.bar (); -} // { dg-message "note: file" } +} // { dg-missed "file .* not found" } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C index 89d6e55..39e32fd 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C @@ -86,7 +86,7 @@ a::H t; void ShowHelpListCommands () { - for (auto c : t) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ + for (auto c : t) /* { dg-missed "missed loop optimization: niters analysis .*" } */ a::ax << c.ay << a::av; } diff --git a/gcc/testsuite/g++.dg/vect/slp-pr56812.cc b/gcc/testsuite/g++.dg/vect/slp-pr56812.cc index 08b0981..3e7a495 100644 --- a/gcc/testsuite/g++.dg/vect/slp-pr56812.cc +++ b/gcc/testsuite/g++.dg/vect/slp-pr56812.cc @@ -14,6 +14,6 @@ public: void mydata::Set (float x) { /* We want to vectorize this either as loop or basic-block. */ - for (int i=0; i= n;k--) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ + for(k = 15;k >= n;k--) /* { dg-missed "missed loop optimization: niters analysis .*" } */ g(); } diff --git a/gcc/testsuite/gcc.dg/unroll-2.c b/gcc/testsuite/gcc.dg/unroll-2.c index 46126c3..8baceaa 100644 --- a/gcc/testsuite/gcc.dg/unroll-2.c +++ b/gcc/testsuite/gcc.dg/unroll-2.c @@ -15,7 +15,7 @@ int foo(void) { int i; bar(); - for (i = 0; i < 2; i++) /* { dg-message "note: loop with 2 iterations completely unrolled" } */ + for (i = 0; i < 2; i++) /* { dg-optimized "loop with 2 iterations completely unrolled" } */ { a[i]= b[i] + 1; } @@ -25,7 +25,7 @@ int foo(void) int foo2(void) { int i; - for (i = 0; i < 2; i++) /* { dg-message "note: loop with 2 iterations completely unrolled" } */ + for (i = 0; i < 2; i++) /* { dg-optimized "loop with 2 iterations completely unrolled" } */ { a[i]= b[i] + 1; } diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c index 0b14b8e..258e378 100644 --- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c +++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c @@ -1,11 +1,11 @@ /* { dg-do compile { target vect_int } } */ -/* { dg-additional-options "-std=c99 -fopt-info -O3" } */ +/* { dg-additional-options "-std=c99 -fopt-info-vec -O3" } */ void vadd (int *dst, int *op1, int *op2, int count) { -/* { dg-message "loop vectorized" "" { target *-*-* } .+2 } */ -/* { dg-message "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */ +/* { dg-optimized "loop vectorized" "" { target *-*-* } .+2 } */ +/* { dg-optimized "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */ for (int i = 0; i < count; ++i) dst[i] = op1[i] + op2[i]; } diff --git a/gcc/testsuite/gfortran.dg/directive_unroll_1.f90 b/gcc/testsuite/gfortran.dg/directive_unroll_1.f90 index 85b3671..d758ad7 100644 --- a/gcc/testsuite/gfortran.dg/directive_unroll_1.f90 +++ b/gcc/testsuite/gfortran.dg/directive_unroll_1.f90 @@ -24,7 +24,7 @@ subroutine test2(a, n) DO i=1, n, 1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test2 subroutine test3(a, n) @@ -36,7 +36,7 @@ subroutine test3(a, n) DO i=n, 1, -1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test3 subroutine test4(a, n) @@ -48,5 +48,5 @@ subroutine test4(a, n) DO i=1, n, 2 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test4 diff --git a/gcc/testsuite/gfortran.dg/directive_unroll_2.f90 b/gcc/testsuite/gfortran.dg/directive_unroll_2.f90 index 6dff8fa..c726227 100644 --- a/gcc/testsuite/gfortran.dg/directive_unroll_2.f90 +++ b/gcc/testsuite/gfortran.dg/directive_unroll_2.f90 @@ -24,7 +24,7 @@ subroutine test2(a, n) DO i=1, n, 1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test2 subroutine test3(a, n) @@ -36,7 +36,7 @@ subroutine test3(a, n) DO i=n, 1, -1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test3 subroutine test4(a, n) @@ -48,5 +48,5 @@ subroutine test4(a, n) DO i=1, n, 2 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test4 diff --git a/gcc/testsuite/gfortran.dg/directive_unroll_3.f90 b/gcc/testsuite/gfortran.dg/directive_unroll_3.f90 index 4e3ec09..59a8e02 100644 --- a/gcc/testsuite/gfortran.dg/directive_unroll_3.f90 +++ b/gcc/testsuite/gfortran.dg/directive_unroll_3.f90 @@ -12,7 +12,7 @@ subroutine test1(a) DO i=1, 8, 1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump-not "12:.: note: loop unrolled" "loop2_unroll" } } +! { dg-final { scan-rtl-dump-not "12:.: optimized: loop unrolled" "loop2_unroll" } } end subroutine test1 subroutine test2(a, n) @@ -24,7 +24,7 @@ subroutine test2(a, n) DO i=1, n, 1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "24:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test2 subroutine test3(a, n) @@ -36,7 +36,7 @@ subroutine test3(a, n) DO i=n, 1, -1 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "36:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test3 subroutine test4(a, n) @@ -48,5 +48,5 @@ subroutine test4(a, n) DO i=1, n, 2 call dummy(a(i)) ENDDO -! { dg-final { scan-rtl-dump "48:.: note: loop unrolled 7 times" "loop2_unroll" } } +! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } } end subroutine test4 diff --git a/gcc/testsuite/gnat.dg/unroll4.adb b/gcc/testsuite/gnat.dg/unroll4.adb index d9b763a..0cea4e8 100644 --- a/gcc/testsuite/gnat.dg/unroll4.adb +++ b/gcc/testsuite/gnat.dg/unroll4.adb @@ -23,4 +23,4 @@ package body Unroll4 is end Unroll4; --- { dg-final { scan-rtl-dump-times "note: loop unrolled 7 times" 2 "loop2_unroll" } } +-- { dg-final { scan-rtl-dump-times "optimized: loop unrolled 7 times" 2 "loop2_unroll" } } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 24d0b00..c33a50c 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1194,6 +1194,26 @@ proc dg-locus { args } { verbose "process-message:\n${dg-messages}" 2 } +# 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" +} + # Check the existence of a gdb in the path, and return true if there # is one. #