Hi!
On 2018-09-25T16:00:14-0400, David Malcolm <[email protected]> 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
>From f3046b8bea6a2a6489dd10d72cb038b92aa4fc38 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <[email protected]>
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.
---
gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c | 4 ++--
gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c | 4 ++--
gcc/testsuite/lib/gcc-dg.exp | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
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 3bfe498ef0a2..6834b9a9d0b9 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
@@ -5,8 +5,8 @@ void
vadd (int *dst, int *op1, int *op2, int count)
{
/* { dg-prune-output " version\[^\n\r]* alignment" } */
-/* { dg-optimized "loop vectorized" "" { target *-*-* } .+2 } */
-/* { dg-optimized "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */
+/* { dg-optimized "21: loop vectorized" "" { target *-*-* } .+2 } */
+/* { dg-optimized "21: 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/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c
index 94c55a92bb4f..23a3b39fbb32 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
@@ -6,7 +6,7 @@ extern void accumulate (int x, int *a);
int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */
{
int sum = 0;
- for (int i = 0; i < n; ++i) /* { dg-missed "couldn't vectorize loop" } */
- accumulate (arr[i], &sum); /* { dg-missed "statement clobbers memory: accumulate \\(.*\\);" } */
+ for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */
+ accumulate (arr[i], &sum); /* { dg-missed "5: statement clobbers memory: accumulate \\(.*\\);" } */
return sum;
}
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index e8ad3052657e..0e1aafec82f4 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -1232,7 +1232,7 @@ 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"
+ process-message saved-dg-error "optimized:" "$args"
}
# Handle output from -fopt-info for MSG_MISSED_OPTIMIZATION:
@@ -1242,7 +1242,7 @@ 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"
+ process-message saved-dg-error "missed:" "$args"
}
# Check the existence of a gdb in the path, and return true if there
--
2.17.1