From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 506A6388E814 for ; Mon, 22 Jun 2020 14:33:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 506A6388E814 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oliva@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 0F23F11690D; Mon, 22 Jun 2020 10:33:07 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id CjW2btAcVGwF; Mon, 22 Jun 2020 10:33:06 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 30500116712; Mon, 22 Jun 2020 10:33:05 -0400 (EDT) Received: from livre.home (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 05MEWkr9225197 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jun 2020 11:32:47 -0300 From: Alexandre Oliva To: Tobias Burnus Cc: Thomas Schwinge , Jakub Jelinek , , , Richard Biener , Subject: Re: drop -aux{dir,base}, revamp -dump{dir,base} Organization: Free thinker, does not speak for AdaCore References: <874krkqte6.fsf@euler.schwinge.homeip.net> <2b76fcd8-aaa6-7f7d-9c33-0c41381df658@mentor.com> <1035fcc6-5204-9a09-a61f-4b719c82cd7f@codesourcery.com> Errors-To: aoliva@lxoliva.fsfla.org Date: Mon, 22 Jun 2020 11:32:46 -0300 In-Reply-To: <1035fcc6-5204-9a09-a61f-4b719c82cd7f@codesourcery.com> (Tobias Burnus's message of "Mon, 22 Jun 2020 09:07:01 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, 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: Mon, 22 Jun 2020 14:33:10 -0000 On Jun 22, 2020, Tobias Burnus wrote: > On 6/22/20 8:08 AM, Alexandre Oliva wrote: >>> I additionally did run the test case manually =E2=86=92 files.log for t= he >>> produced files. >> This is with -save-temps, right? > Yes. Without, there are no files left under /tmp and only > nvptx-merged-loop.xnvptx-none.mkoffload.309r.mach > nvptx-merged-loop.exe > in the current directory. > (As in the testsuite, -foffload=3D-fdump-rtl-mach was used.) >> Interesting, in my test run (native only) I didn't trigger that problem. >> +++ b/gcc/testsuite/lib/scanoffload.exp >> + if [info set offload_target] { >> The 'set' above should be 'exists'. > UNSUPPORTED: > libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c > -DACC_DEVICE_TYPE_nvidia=3D1 -DACC_MEM_SHARED=3D0 -foffload=3Dnvptx-none = -O0 > PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c > -DACC_DEVICE_TYPE_nvidia=3D1 -DACC_MEM_SHARED=3D0 -foffload=3Dnvptx-none = -O2 > (test for excess errors) > PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c > -DACC_DEVICE_TYPE_nvidia=3D1 -DACC_MEM_SHARED=3D0 -foffload=3Dnvptx-none = -O2 > execution test > PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c > -DACC_DEVICE_TYPE_nvidia=3D1 -DACC_MEM_SHARED=3D0 -foffload=3Dnvptx-none = -O2 > scan-offload-rtl-dump mach "Merging loop .* into " > UNSUPPORTED: > libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c > -DACC_DEVICE_TYPE_host=3D1 -DACC_MEM_SHARED=3D1 -foffload=3Ddisable -O2 > Hence, it looks fine now =E2=80=93 given: Yay, thanks. Here's a consolidated patch, that I've tested myself on x86_64-linux-gnu (before consolidation, retesting now) with a toolchain build with all of the offload targets built and enabled, but without cuda or ROCm runtimes or hardware, only the intelmicemul runtime provided by liboffloadmic. Ok to install? handle dumpbase in offloading, adjust testsuite From: Alexandre Oliva Pass dumpbase on to mkoffloads and their offload-target compiler runs, using different suffixes for different offloading targets. Obey -save-temps in naming temporary files while at that. Adjust the testsuite offload dump scanning machinery to look for dump files named under the new conventions, iterating internally over all configured offload targets, or recognizing libgomp's testsuite's own iteration. for gcc/ChangeLog * colllect-utils.h (dumppfx): New. * colllect-utils.c (dumppfx): Likewise. * lto-wrapper.c (run_gcc): Set global dumppfx. (compile_offload_image): Pass a -dumpbase on to mkoffload. * config/nvptx/mkoffload.c (ptx_dumpbase): New. (main): Handle incoming -dumpbase. Set ptx_dumpbase. Obey save_temps. (compile_native): Pass -dumpbase et al to compiler. * config/gcn/mkoffload.c (gcn_dumpbase): New. (main): Handle incoming -dumpbase. Set gcn_dumpbase. Obey save_temps. Pass -dumpbase et al to offload target compiler. (compile_native): Pass -dumpbase et al to compiler. for gcc/testsuite/ChangeLog * lib/scanoffload.exp: New. * lib/scanoffloadrtl.exp: Load it. Replace ".o" with "" globally, and use scanoffload's scoff wrapper to fill it in. * lib/scanoffloadtree.exp: Likewise. for libgomp/testsuite/ChangeLog * lib/libgomp.exp: Load gcc lib scanoffload.exp. * lib/libgomp-dg.exp: Drop now-obsolete -save-temps. --- gcc/collect-utils.c | 1 + gcc/collect-utils.h | 1 + gcc/config/gcn/mkoffload.c | 51 +++++++++++++++++++++++++++++= +--- gcc/config/nvptx/mkoffload.c | 31 +++++++++++++++++++- gcc/lto-wrapper.c | 13 +++++++- gcc/testsuite/lib/scanoffload.exp | 45 +++++++++++++++++++++++++++++ gcc/testsuite/lib/scanoffloadrtl.exp | 49 ++++++++++++++++-------------= --- gcc/testsuite/lib/scanoffloadtree.exp | 51 +++++++++++++++++------------= ---- libgomp/testsuite/lib/libgomp-dg.exp | 8 ----- libgomp/testsuite/lib/libgomp.exp | 1 + 10 files changed, 185 insertions(+), 66 deletions(-) create mode 100644 gcc/testsuite/lib/scanoffload.exp diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c index e85843bc..d4fa2c3 100644 --- a/gcc/collect-utils.c +++ b/gcc/collect-utils.c @@ -34,6 +34,7 @@ static char *response_file; bool debug; bool verbose; bool save_temps; +const char *dumppfx; =20 =20 /* Notify user of a non-error. */ diff --git a/gcc/collect-utils.h b/gcc/collect-utils.h index e7c955f..6ff7d9d9 100644 --- a/gcc/collect-utils.h +++ b/gcc/collect-utils.h @@ -37,6 +37,7 @@ extern void utils_cleanup (bool); extern bool debug; extern bool verbose; extern bool save_temps; +extern const char *dumppfx; =20 /* Provided by the tool itself. */ =20 diff --git a/gcc/config/gcn/mkoffload.c b/gcc/config/gcn/mkoffload.c index 4a99d70..14f422e 100644 --- a/gcc/config/gcn/mkoffload.c +++ b/gcc/config/gcn/mkoffload.c @@ -41,6 +41,7 @@ static const char *gcn_s1_name; static const char *gcn_s2_name; static const char *gcn_o_name; static const char *gcn_cfile_name; +static const char *gcn_dumpbase; =20 enum offload_abi offload_abi =3D OFFLOAD_ABI_UNSET; =20 @@ -496,6 +497,12 @@ compile_native (const char *infile, const char *outfil= e, const char *compiler) obstack_ptr_grow (&argv_obstack, "-save-temps"); if (verbose) obstack_ptr_grow (&argv_obstack, "-v"); + obstack_ptr_grow (&argv_obstack, "-dumpdir"); + obstack_ptr_grow (&argv_obstack, ""); + obstack_ptr_grow (&argv_obstack, "-dumpbase"); + obstack_ptr_grow (&argv_obstack, gcn_dumpbase); + obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); + obstack_ptr_grow (&argv_obstack, ".c"); switch (offload_abi) { case OFFLOAD_ABI_LP64: @@ -611,6 +618,9 @@ main (int argc, char **argv) save_temps =3D true; else if (strcmp (argv[i], "-v") =3D=3D 0) verbose =3D true; + else if (strcmp (argv[i], "-dumpbase") =3D=3D 0 + && i + 1 < argc) + dumppfx =3D argv[++i]; } if (!(fopenacc ^ fopenmp)) fatal_error (input_location, "either -fopenacc or -fopenmp must be set= "); @@ -628,11 +638,6 @@ main (int argc, char **argv) gcc_unreachable (); } =20 - gcn_s1_name =3D make_temp_file (".mkoffload.1.s"); - gcn_s2_name =3D make_temp_file (".mkoffload.2.s"); - gcn_o_name =3D make_temp_file (".mkoffload.hsaco"); - gcn_cfile_name =3D make_temp_file (".c"); - /* Build arguments for compiler pass. */ struct obstack cc_argv_obstack; obstack_init (&cc_argv_obstack); @@ -656,6 +661,35 @@ main (int argc, char **argv) obstack_ptr_grow (&cc_argv_obstack, argv[ix]); } =20 + if (!dumppfx) + dumppfx =3D outname; + + const char *mko_dumpbase =3D concat (dumppfx, ".mkoffload", NULL); + const char *hsaco_dumpbase =3D concat (dumppfx, ".mkoffload.hsaco", NULL= ); + gcn_dumpbase =3D concat (dumppfx, ".c", NULL); + + if (save_temps) + { + gcn_s1_name =3D concat (mko_dumpbase, ".1.s", NULL); + gcn_s2_name =3D concat (mko_dumpbase, ".2.s", NULL); + gcn_o_name =3D hsaco_dumpbase; + gcn_cfile_name =3D gcn_dumpbase; + } + else + { + gcn_s1_name =3D make_temp_file (".mkoffload.1.s"); + gcn_s2_name =3D make_temp_file (".mkoffload.2.s"); + gcn_o_name =3D make_temp_file (".mkoffload.hsaco"); + gcn_cfile_name =3D make_temp_file (".c"); + } + + obstack_ptr_grow (&cc_argv_obstack, "-dumpdir"); + obstack_ptr_grow (&cc_argv_obstack, ""); + obstack_ptr_grow (&cc_argv_obstack, "-dumpbase"); + obstack_ptr_grow (&cc_argv_obstack, mko_dumpbase); + obstack_ptr_grow (&cc_argv_obstack, "-dumpbase-ext"); + obstack_ptr_grow (&cc_argv_obstack, ""); + obstack_ptr_grow (&cc_argv_obstack, "-o"); obstack_ptr_grow (&cc_argv_obstack, gcn_s1_name); obstack_ptr_grow (&cc_argv_obstack, NULL); @@ -674,6 +708,13 @@ main (int argc, char **argv) || strncmp (argv[i], "-march", 6) =3D=3D 0) obstack_ptr_grow (&ld_argv_obstack, argv[i]); =20 + obstack_ptr_grow (&cc_argv_obstack, "-dumpdir"); + obstack_ptr_grow (&cc_argv_obstack, ""); + obstack_ptr_grow (&cc_argv_obstack, "-dumpbase"); + obstack_ptr_grow (&cc_argv_obstack, hsaco_dumpbase); + obstack_ptr_grow (&cc_argv_obstack, "-dumpbase-ext"); + obstack_ptr_grow (&cc_argv_obstack, ""); + obstack_ptr_grow (&ld_argv_obstack, "-o"); obstack_ptr_grow (&ld_argv_obstack, gcn_o_name); obstack_ptr_grow (&ld_argv_obstack, NULL); diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c index 803b585..efdf9b9 100644 --- a/gcc/config/nvptx/mkoffload.c +++ b/gcc/config/nvptx/mkoffload.c @@ -55,6 +55,7 @@ static id_map *var_ids, **vars_tail =3D &var_ids; /* Files to unlink. */ static const char *ptx_name; static const char *ptx_cfile_name; +static const char *ptx_dumpbase; =20 enum offload_abi offload_abi =3D OFFLOAD_ABI_UNSET; =20 @@ -369,6 +370,12 @@ compile_native (const char *infile, const char *outfil= e, const char *compiler) obstack_ptr_grow (&argv_obstack, "-save-temps"); if (verbose) obstack_ptr_grow (&argv_obstack, "-v"); + obstack_ptr_grow (&argv_obstack, "-dumpdir"); + obstack_ptr_grow (&argv_obstack, ""); + obstack_ptr_grow (&argv_obstack, "-dumpbase"); + obstack_ptr_grow (&argv_obstack, ptx_dumpbase); + obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); + obstack_ptr_grow (&argv_obstack, ".c"); switch (offload_abi) { case OFFLOAD_ABI_LP64: @@ -486,6 +493,9 @@ main (int argc, char **argv) save_temps =3D true; else if (strcmp (argv[i], "-v") =3D=3D 0) verbose =3D true; + else if (strcmp (argv[i], "-dumpbase") =3D=3D 0 + && i + 1 < argc) + dumppfx =3D argv[++i]; } if (!(fopenacc ^ fopenmp)) fatal_error (input_location, "either %<-fopenacc%> or %<-fopenmp%> " @@ -521,7 +531,14 @@ main (int argc, char **argv) obstack_ptr_grow (&argv_obstack, argv[ix]); } =20 - ptx_cfile_name =3D make_temp_file (".c"); + if (!dumppfx) + dumppfx =3D outname; + + ptx_dumpbase =3D concat (dumppfx, ".c", NULL); + if (save_temps) + ptx_cfile_name =3D ptx_dumpbase; + else + ptx_cfile_name =3D make_temp_file (".c"); =20 out =3D fopen (ptx_cfile_name, "w"); if (!out) @@ -531,7 +548,17 @@ main (int argc, char **argv) configurations. */ if (offload_abi =3D=3D OFFLOAD_ABI_LP64) { - ptx_name =3D make_temp_file (".mkoffload"); + char *mko_dumpbase =3D concat (dumppfx, ".mkoffload", NULL); + if (save_temps) + ptx_name =3D mko_dumpbase; + else + ptx_name =3D make_temp_file (".mkoffload"); + obstack_ptr_grow (&argv_obstack, "-dumpdir"); + obstack_ptr_grow (&argv_obstack, ""); + obstack_ptr_grow (&argv_obstack, "-dumpbase"); + obstack_ptr_grow (&argv_obstack, mko_dumpbase); + obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); + obstack_ptr_grow (&argv_obstack, ""); obstack_ptr_grow (&argv_obstack, "-o"); obstack_ptr_grow (&argv_obstack, ptx_name); obstack_ptr_grow (&argv_obstack, NULL); diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 8fbca7c..939a83a 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -830,6 +830,7 @@ compile_offload_image (const char *target, const char *= compiler_path, unsigned int linker_opt_count) { char *filename =3D NULL; + char *dumpbase; char **argv; char *suffix =3D XALLOCAVEC (char, sizeof ("/accel//mkoffload") + strlen (target)); @@ -853,8 +854,13 @@ compile_offload_image (const char *target, const char = *compiler_path, "could not find %s in %s (consider using %<-B%>)", suffix + 1, compiler_path); =20 + dumpbase =3D concat (dumppfx, "x", target, NULL); + /* Generate temporary output file name. */ - filename =3D make_temp_file (".target.o"); + if (save_temps) + filename =3D concat (dumpbase, ".o", NULL); + else + filename =3D make_temp_file (".target.o"); =20 struct obstack argv_obstack; obstack_init (&argv_obstack); @@ -875,6 +881,9 @@ compile_offload_image (const char *target, const char *= compiler_path, compiler_opt_count); append_diag_options (&argv_obstack, linker_opts, linker_opt_count); =20 + obstack_ptr_grow (&argv_obstack, "-dumpbase"); + obstack_ptr_grow (&argv_obstack, dumpbase); + /* Append options specified by -foffload last. In case of conflicting options we expect offload compiler to choose the latest. */ append_offload_options (&argv_obstack, target, compiler_opts, @@ -1298,7 +1307,7 @@ run_gcc (unsigned argc, char *argv[]) bool linker_output_rel =3D false; bool skip_debug =3D false; unsigned n_debugobj; - const char *dumppfx =3D NULL, *incoming_dumppfx =3D NULL; + const char *incoming_dumppfx =3D dumppfx =3D NULL; static char current_dir[] =3D { '.', DIR_SEPARATOR, '\0' }; =20 /* Get the driver and options. */ diff --git a/gcc/testsuite/lib/scanoffload.exp b/gcc/testsuite/lib/scanoffl= oad.exp new file mode 100644 index 00000000..ec0d7a6 --- /dev/null +++ b/gcc/testsuite/lib/scanoffload.exp @@ -0,0 +1,45 @@ +# Copyright (C) 2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +#=20 +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +#=20 +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# 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" !=3D "disable" } { + eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex $a= rgs $idx]]"] + } + } else { + global offload_targets + foreach target [split $offload_targets ","] { + eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex $a= rgs $idx]]"] + } + } +} diff --git a/gcc/testsuite/lib/scanoffloadrtl.exp b/gcc/testsuite/lib/scano= ffloadrtl.exp index 69e4e7c8..be457f7 100644 --- a/gcc/testsuite/lib/scanoffloadrtl.exp +++ b/gcc/testsuite/lib/scanoffloadrtl.exp @@ -18,6 +18,7 @@ # libgomp.exp. =20 load_lib scandump.exp +load_lib scanoffload.exp =20 # Utility for scanning compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. @@ -36,12 +37,12 @@ proc scan-offload-rtl-dump { args } { return } if { [llength $args] >=3D 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]" "" } } =20 @@ -61,12 +62,12 @@ proc scan-offload-rtl-dump-times { args } { return } if { [llength $args] >=3D 4 } { - scan-dump-times "offload-rtl" [lindex $args 0] [lindex $args 1] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 2]" ".o" \ + scoff end-1 scan-dump-times "offload-rtl" [lindex $args 0] \ + [lindex $args 1] "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 2]" "" \ [lindex $args 3] } else { - scan-dump-times "offload-rtl" [lindex $args 0] [lindex $args 1] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 2]" ".o" + scoff end scan-dump-times "offload-rtl" [lindex $args 0] \ + [lindex $args 1] "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 2]" "" } } =20 @@ -86,12 +87,12 @@ proc scan-offload-rtl-dump-not { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-not "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-not "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-not "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" + scoff end scan-dump-not "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" } } =20 @@ -112,12 +113,12 @@ proc scan-offload-rtl-dump-dem { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-dem "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-dem "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-dem "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" + scoff end scan-dump-dem "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" } } =20 @@ -137,11 +138,11 @@ proc scan-offload-rtl-dump-dem-not { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-dem-not "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-dem-not "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-dem-not "offload-rtl" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" ".o" + scoff end scan-dump-dem-not "offload-rtl" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]r.[lindex $args 1]" "" } } diff --git a/gcc/testsuite/lib/scanoffloadtree.exp b/gcc/testsuite/lib/scan= offloadtree.exp index 76a28d0..e51085c 100644 --- a/gcc/testsuite/lib/scanoffloadtree.exp +++ b/gcc/testsuite/lib/scanoffloadtree.exp @@ -18,6 +18,7 @@ # libgomp.exp. =20 load_lib scandump.exp +load_lib scanoffload.exp =20 # Utility for scanning compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. @@ -36,12 +37,12 @@ proc scan-offload-tree-dump { args } { return } if { [llength $args] >=3D 3 } { - scan-dump "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" + scoff end scan-dump "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" } } =20 @@ -61,12 +62,12 @@ proc scan-offload-tree-dump-times { args } { return } if { [llength $args] >=3D 4 } { - scan-dump-times "offload-tree" [lindex $args 0] [lindex $args 1] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" ".o" \ - [lindex $args 3] + scoff end-1 scan-dump-times "offload-tree" [lindex $args 0] \ + [lindex $args 1] "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" "" \ + [lindex $args 3] } else { - scan-dump-times "offload-tree" [lindex $args 0] [lindex $args 1] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" ".o" + scoff end scan-dump-times "offload-tree" [lindex $args 0] \ + [lindex $args 1] "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" "" } } =20 @@ -86,12 +87,12 @@ proc scan-offload-tree-dump-not { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-not "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-not "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-not "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" + scoff end scan-dump-not "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" } } =20 @@ -112,12 +113,12 @@ proc scan-offload-tree-dump-dem { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-dem "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-dem "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-dem "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" + scoff end scan-dump-dem "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" } } =20 @@ -137,11 +138,11 @@ proc scan-offload-tree-dump-dem-not { args } { return } if { [llength $args] >=3D 3 } { - scan-dump-dem-not "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" \ - [lindex $args 2] + scoff end-1 scan-dump-dem-not "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ + [lindex $args 2] } else { - scan-dump-dem-not "offload-tree" [lindex $args 0] \ - "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" ".o" + scoff end scan-dump-dem-not "offload-tree" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" } } diff --git a/libgomp/testsuite/lib/libgomp-dg.exp b/libgomp/testsuite/lib/l= ibgomp-dg.exp index 726b924..ebf78e1 100644 --- a/libgomp/testsuite/lib/libgomp-dg.exp +++ b/libgomp/testsuite/lib/libgomp-dg.exp @@ -1,12 +1,4 @@ proc libgomp-dg-test { prog do_what extra_tool_flags } { - # Force the dumpbase for test.c to test.o, such that scan-offload-*-du= mp - # will work. - foreach opt $extra_tool_flags { - if { [regexp ^-foffload=3D-fdump- $opt] } { - lappend extra_tool_flags "-save-temps" - } - } - return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_too= l_flags] } =20 diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libg= omp.exp index ee5f0e5..8ccb78f4 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -30,6 +30,7 @@ load_gcc_lib scanlang.exp load_gcc_lib scanrtl.exp load_gcc_lib scantree.exp load_gcc_lib scanltranstree.exp +load_gcc_lib scanoffload.exp load_gcc_lib scanoffloadtree.exp load_gcc_lib scanoffloadrtl.exp load_gcc_lib scanipa.exp --=20 Alexandre Oliva, freedom fighter he/him https://FSFLA.org/blogs/lxo/ Free Software Evangelist Stallman was right, but he's left :( GNU Toolchain Engineer Live long and free, and prosper ethically