public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
To: hubicka@ucw.cz
Cc: hp@axis.com, hubicka@ucw.cz, gcc-patches@gcc.gnu.org,
	dnovillo@google.com,   rguenther@suse.de, ak@linux.intel.com
Subject: [RFA:] fix breakage with "Update testsuite to run with slim LTO"
Date: Fri, 21 Oct 2011 05:22:00 -0000	[thread overview]
Message-ID: <201110210229.p9L2TKmx010677@ignucius.se.axis.com> (raw)
In-Reply-To: <20111020221932.GA13355@kam.mff.cuni.cz> (message from Jan	Hubicka on Fri, 21 Oct 2011 00:19:32 +0200)

> Date: Fri, 21 Oct 2011 00:19:32 +0200
> From: Jan Hubicka <hubicka@ucw.cz>
> Yes, if we scan assembler, we likely want -fno-fat-lto-objects.

> > then IIUC you need to patch *all* torture tests that use
> > scan-assembler and scan-assembler-not.  Alternatively, patch
> > somewhere else, like not passing it if certain directives are
> > used, like scan-assembler{,-not}.  And either way, is it safe to
> > add that option always, not just when also passing "-flto" or
> > something?
> 
> Hmm, some of assembler scans still works because they check for
> presence of symbols we output anyway, but indeed, it would make more
> sense to automatically imply -ffat-lto-object when scan-assembler
> is used.  I am not sure if my dejagnu skill as on par here however.

Maybe you could make amends ;) by testing the following, which
seems to work at least for dg-torture.exp and cris-elf/cris-sim,
in which -ffat-lto-object is automatically added for each
scan-assembler and scan-assembler-not test, extensible for other
dg-final actions without polluting with checking LTO options and
whatnot across the files.  I checked (and corrected) so it also
works when !check_effective_target_lto by commenting out the
setting in the second chunk.

gcc/testsuite:

	* lib/gcc-dg.exp (gcc_force_conventional_output): New global
	variable, default empty, -ffat-lto-objects for effective_target_lto.
	(gcc-dg-test-1): Add options from dg-final methods.
	* lib/scanasm.exp (scan-assembler_required_options)
	(scan-assembler-not_required_options): New procs.

Ok to commit?

Index: lib/gcc-dg.exp
===================================================================
--- lib/gcc-dg.exp	(revision 180270)
+++ lib/gcc-dg.exp	(working copy)
@@ -68,6 +68,13 @@ if [info exists ADDITIONAL_TORTURE_OPTIO
 }
 
 set LTO_TORTURE_OPTIONS ""
+
+# Some torture-options cause intermediate code output, unusable for
+# testing using e.g. scan-assembler.  In this variable are the options
+# how to force it, when needed.
+global gcc_force_conventional_output
+set gcc_force_conventional_output ""
+
 if [check_effective_target_lto] {
     # When having plugin test both slim and fat LTO and plugin/nonplugin
     # path.
@@ -76,6 +83,7 @@ if [check_effective_target_lto] {
 	  { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
 	  { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
       ]
+      set gcc_force_conventional_output "-ffat-lto-objects"
     } else {
       set LTO_TORTURE_OPTIONS [list \
 	  { -O2 -flto -flto-partition=none } \
@@ -154,6 +162,19 @@ proc gcc-dg-test-1 { target_compile prog
 	default {
 	    perror "$do_what: not a valid dg-do keyword"
 	    return ""
+	}
+    }
+
+    # Let { dg-final { action } } force options as returned by an
+    # optional proc ${action}_required_options.
+    upvar 2 dg-final-code finalcode
+    foreach x [split $finalcode "\n"] {
+	set finalcmd [lindex $x 0]
+	if { [info procs ${finalcmd}_required_options] != "" } {
+	    set req [${finalcmd}_required_options]
+	    if { $req != "" } {
+		lappend extra_tool_flags $req
+	    }
 	}
     }
 
Index: lib/scanasm.exp
===================================================================
--- lib/scanasm.exp	(revision 180270)
+++ lib/scanasm.exp	(working copy)
@@ -85,6 +85,11 @@ proc scan-assembler { args } {
     dg-scan "scan-assembler" 1 $testcase $output_file $args
 }
 
+proc scan-assembler_required_options { args } {
+    global gcc_force_conventional_output
+    return $gcc_force_conventional_output
+}
+
 # Check that a pattern is not present in the .s file produced by the
 # compiler.  See dg-scan for details.
 
@@ -94,6 +99,11 @@ proc scan-assembler-not { args } {
     set output_file "[file rootname [file tail $testcase]].s"
 
     dg-scan "scan-assembler-not" 0 $testcase $output_file $args
+}
+
+proc scan-assembler-not_required_options { args } {
+    global gcc_force_conventional_output
+    return $gcc_force_conventional_output
 }
 
 # Return the scan for the assembly for hidden visibility. 

brgds, H-P

  reply	other threads:[~2011-10-21  2:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 17:54 Update testsuite to run with slim LTO Jan Hubicka
2011-09-30 14:56 ` Diego Novillo
2011-10-20 19:34 ` Breakage with "Update testsuite to run with slim LTO" Hans-Peter Nilsson
2011-10-20 19:53   ` Andi Kleen
2011-10-21  0:39   ` Jan Hubicka
2011-10-21  5:22     ` Hans-Peter Nilsson [this message]
2011-10-21  9:58       ` [RFA:] fix breakage " Jan Hubicka
2011-10-21 12:23         ` Iain Sandoe
2011-10-21 12:35           ` Rainer Orth
2011-10-21 16:20             ` Jan Hubicka
2011-10-21 17:40               ` Hans-Peter Nilsson
2011-10-21 18:52                 ` Jan Hubicka
2011-10-21 19:56                   ` Hans-Peter Nilsson
2011-10-24 12:08             ` Richard Guenther
2011-10-28 14:59       ` ping: [RFA:] testsuite infrastructure for options implied by dg-final methods Hans-Peter Nilsson
2011-11-04 13:56         ` ping*2: " Hans-Peter Nilsson
2011-11-04 17:05           ` Mike Stump
2011-11-04 17:54             ` Hans-Peter Nilsson
2011-11-04 18:14               ` Mike Stump
2011-11-04 18:16                 ` Hans-Peter Nilsson
2023-05-03 11:16 ` Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS' (was: Update testsuite to run with slim LTO) Thomas Schwinge
2023-05-03 11:46   ` Richard Biener
2023-05-09  7:32     ` Christophe Lyon
2023-05-09  9:00       ` Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS') Thomas Schwinge
2023-05-09 15:17         ` Christophe Lyon
2023-05-09 19:14           ` Christophe Lyon
2023-05-10  7:51             ` Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init' (was: Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS')) Thomas Schwinge
2023-05-10 13:42               ` Christophe Lyon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110210229.p9L2TKmx010677@ignucius.se.axis.com \
    --to=hans-peter.nilsson@axis.com \
    --cc=ak@linux.intel.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@axis.com \
    --cc=hubicka@ucw.cz \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).