Hi Alexandre!

On 2020-06-22T11:32:46-0300, Alexandre Oliva <ol...@adacore.com> wrote:
> Here's a consolidated patch, [...]

Another small issue here:

> --- /dev/null
> +++ b/gcc/testsuite/lib/scanoffload.exp

> +# Utility for scanning offloading dump output, used by libgomp.exp.
> +
> +# Format an offload dump suffix given the offload target name in
> +# OFFTGT and any suffix, probably empty, in SUFFIX.
> +proc scoff-format { offtgt suffix } {
> +    return ".x$offtgt.mkoffload$suffix"
> +}
> +
> +# Wrapper for scan procs.
> +# Argument 0 is the index of the argument to replace when calling
> +# argument 1 with the remaining arguments.  Use end-1 or end or so.
> +proc scoff { args } {
> +    set idx [lindex $args 0]
> +    set prc [lindex $args 1]
> +    set args [lreplace $args 0 1]
> +
> +    global offload_target
> +    if [info exists offload_target] {
> +     set target $offload_target
> +     if { "$target" != "disable" } {
> +         eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex 
> $args $idx]]"]
> +     }
> +    } else {
> +     global offload_targets
> +     foreach target [split $offload_targets ","] {
> +         eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex 
> $args $idx]]"]
> +     }
> +    }
> +}

> --- a/gcc/testsuite/lib/scanoffloadrtl.exp
> +++ b/gcc/testsuite/lib/scanoffloadrtl.exp

> @@ -36,12 +37,12 @@ proc scan-offload-rtl-dump { args } {
>       return
>      }
>      if { [llength $args] >= 3 } {
> -     scan-dump "offload-rtl" [lindex $args 0] \
> -               "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" \
> -               [lindex $args 2]
> +     scoff end-1 scan-dump "offload-rtl" [lindex $args 0] \
> +         "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" \
> +         [lindex $args 2]
>      } else {
> -     scan-dump "offload-rtl" [lindex $args 0] \
> -               "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o"
> +     scoff end scan-dump "offload-rtl" [lindex $args 0] \
> +         "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ""
>      }
>  }

> [...]

For example, if there are two 'offload_targets' configured, and you do a:

    { dg-final { scan-offload-tree-dump-times "(?n)^main\\\._omp_fn\\\.0 " 1 
"optimized" } }

..., you'll get that reported as:

    PASS: libgomp.c++/scan-offload-1.C scan-offload-tree-dump-times optimized 
"(?n)^main\\._omp_fn\\.0 " 1
    PASS: libgomp.c++/scan-offload-1.C scan-offload-tree-dump-times optimized 
"(?n)^main\\._omp_fn\\.0 " 1

Can we easily get the respective offload target into that, or even full
'scoff-format' if that's easier?  I surely could hack up something, but
can you see an elegant way?


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

Reply via email to