This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, testsuite, 1/2] Add scan-wpa-ipa-dump


On 03/29/2018 11:11 AM, Tom de Vries wrote:
Hi,

Consider an lto multi-source test-case main.c and foo.c:
..
$ cat main.c
extern int foo (void);

int
main ()
{
   return foo () + 1;
}

$ cat foo.c
int __attribute__((noinline, noclone))
foo (void)
{
   return 2;
}
...

When compiling the test-case like this:
...
$ gcc main.c foo.c -O2 -flto -save-temps -flto-partition=1to1 -o a.out
...

the following happens:
1. main.s (containing gimple) is produced
    (and then assembled to main.o)
2. foo.s (containing gimple) is produced
    (and then assembled to main.o)
3. lto1 is called in wpa mode, generating a.out.ltrans0.o and
    a.out.ltrans1.o
4. lto1 is called in ltrans mode, generating a.out.ltrans0.s
    (which is then assembled to a.out.ltrans0.ltrans.o)
5. lto1 is called in ltrans mode, generating a.out.ltrans1.s
    (which is then assembled to a.out.ltrans1.ltrans.o)
6. a.out is produced from a.out.ltrans0.ltrans.o and
    a.out.ltrans1.ltrans.o

When adding dump flags "-fdump-tree-all -fdump-rtl-all -fdump-ipa-all" to the command line, we get the following dump files.

For 1, we generate (ignoring the 000i.* and statistics dumps from here on):
- main.c.003t.original - main.c.050t.local-fnsummary2
- main.c.062i.targetclone - main.c.080i.pure-const

For 2, we generate:
- foo.c.003t.original - foo.c.050t.local-fnsummary2
- foo.c.062i.targetclone - foo.c.080i.pure-const

For 3, we generate:
- a.out.wpa.046t.profile_estimate
- a.out.wpa.071i.whole-program - a.out.wpa.084i.comdats

For 4, we generate:
- a.out.ltrans0.046t.profile_estimate
- a.out.ltrans0.075i.cp - a.out.ltrans0.087i.simdclone
- a.out.ltrans0.088t.fixup_cfg4 - a.out.ltrans0.232t.optimized
- a.out.ltrans0.234r.expand - a.out.ltrans0.317r.dfinish

For 5, we generate:
- a.out.ltrans1.046t.profile_estimate
- a.out.ltrans1.075i.cp - a.out.ltrans1.087i.simdclone
- a.out.ltrans1.088t.fixup_cfg4 - a.out.ltrans1.232t.optimized
- a.out.ltrans1.234r.expand - a.out.ltrans1.317r.dfinish

With the current set of dg-final commands scan-tree-dump, scan-rtl-dump and scan-ipa-dump, we are able to scan dump files for 1 and 2, but not for 3, 4 and 5.


This patch series adds:
- scan-wpa-ipa-dump, which allows us to scan the ipa dump files for 3
- scan-ltrans-tree-dump, which:
   - allows us to scan the tree dump files for 4, and
   - adds the option -flto-partition=one which forces wpa to combine
     all functions into a single partition ltrans0 (so that we don't have
     to worry about ltrans1 in 5).

This patch adds scan-wpa-ipa-dump.

Bootstrapped and reg-tested on x86_64.

OK for stage4/stage1 trunk?

Thanks,
- Tom
[testsuite] Add scan-wpa-ipa-dump

2018-03-28  Tom de Vries  <tom@codesourcery.com>

	PR testsuite/85106
	* gcc.dg/ipa/ipa-icf-38.c: New test.
	* gcc.dg/ipa/ipa-icf-38a.c: New test.
	* lib/scandump.exp (dump-base): New proc.
	(scan-dump, scan-dump-times, scan-dump-not, scan-dump-dem)
	(scan-dump-dem-not): Add and handle parameter for suffix of the dump
	base.
	* lib/scanipa.exp: Add "" argument to scan-dump calls.
	* lib/scanlang.exp: Same.
	* lib/scanrtl.exp: Same.
	* lib/scantree.exp: Same.
	* lib/scanwpaipa.exp: New file.
	* lib/gcc-dg.exp: Include scanwpaipa.exp.

	* testsuite/lib/libatomic.exp: Include scanwpaipa.exp.

	* testsuite/lib/libgomp.exp: Include scanwpaipa.exp.

	* testsuite/lib/libitm.exp: Include scanwpaipa.exp.

	* testsuite/lib/libvtv.exp: Include scanwpaipa.exp.

	* doc/sourcebuild.texi (Commands for use in dg-final, Scan optimization
	dump files): Add wpa-ipa.

---
 gcc/doc/sourcebuild.texi               |   2 +-
 gcc/testsuite/gcc.dg/ipa/ipa-icf-38.c  |  31 +++++++
 gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c |  14 ++++
 gcc/testsuite/lib/gcc-dg.exp           |   1 +
 gcc/testsuite/lib/scandump.exp         |  63 +++++++++-----
 gcc/testsuite/lib/scanipa.exp          |  25 +++---
 gcc/testsuite/lib/scanlang.exp         |   6 +-
 gcc/testsuite/lib/scanrtl.exp          |  25 +++---
 gcc/testsuite/lib/scantree.exp         |  25 +++---
 gcc/testsuite/lib/scanwpaipa.exp       | 147 +++++++++++++++++++++++++++++++++
 libatomic/testsuite/lib/libatomic.exp  |   1 +
 libgomp/testsuite/lib/libgomp.exp      |   1 +
 libitm/testsuite/lib/libitm.exp        |   1 +
 libvtv/testsuite/lib/libvtv.exp        |   1 +
 14 files changed, 290 insertions(+), 53 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index b9672ca..db98e9f 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2596,7 +2596,7 @@ assembly output.
 @subsubsection Scan optimization dump files
 
 These commands are available for @var{kind} of @code{tree}, @code{rtl},
-and @code{ipa}.
+@code{ipa}, and @code{wpa-ipa}.
 
 @table @code
 @item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-icf-38.c b/gcc/testsuite/gcc.dg/ipa/ipa-icf-38.c
new file mode 100644
index 0000000..6e7936a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-icf-38.c
@@ -0,0 +1,31 @@
+/* { dg-do link } */
+/* { dg-options "-O2 -fdump-ipa-icf -flto" } */
+/* { dg-require-effective-target lto } */
+/* { dg-additional-sources "ipa-icf-38a.c" }*/
+
+/* Based on ipa-icf-3.c.  */
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+__attribute__ ((noinline))
+int foo(void)
+{
+  v4si a = {1,2,3,4};
+  v4si b = {3,2,1,4};
+  v4si c;
+
+  return 54;
+}
+
+extern int bar(void);
+
+int main()
+{
+  int volatile a = foo();
+  int volatile b = bar();
+
+  return 0;
+}
+
+/* { dg-final { scan-wpa-ipa-dump "Semantic equality hit:foo->bar" "icf"  } } */
+/* { dg-final { scan-wpa-ipa-dump "Equal symbols: 1" "icf"  } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c b/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c
new file mode 100644
index 0000000..414a7c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c
@@ -0,0 +1,14 @@
+/* { dg-skip-if "" { *-*-* } } */
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+__attribute__ ((noinline))
+int bar(void)
+{
+  v4si a = {1,2,3,4};
+  v4si b = {3,2,1,4};
+  v4si c;
+
+  return 54;
+}
+
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 3770f69..2fca9e8 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -22,6 +22,7 @@ load_lib scanasm.exp
 load_lib scanrtl.exp
 load_lib scantree.exp
 load_lib scanipa.exp
+load_lib scanwpaipa.exp
 load_lib scanlang.exp
 load_lib timeout.exp
 load_lib timeout-dg.exp
diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
index be8fbe8..3d42692 100644
--- a/gcc/testsuite/lib/scandump.exp
+++ b/gcc/testsuite/lib/scandump.exp
@@ -26,17 +26,31 @@ proc dump-suffix { arg } {
     return [string range $arg $idx end]
 }
 
+# Construct the dumpbase.
+# Argument 0 is the src file
+# Argument 1 is the dump base suffix
+proc dump-base { args } {
+    set src [lindex $args 0]
+    set dumpbase_suf [lindex $args 1]
+    set dumpbase $src
+    if { [string length $dumpbase_suf] != 0 } {
+	regsub {[.][^.]*$} $src $dumpbase_suf dumpbase
+    }
+    return $dumpbase
+}
+
 # Utility for scanning compiler result, invoked via dg-final.
 # Call pass if pattern is present, otherwise fail.
 #
 # Argument 0 is the type of dump we are searching (rtl, tree, ipa)
 # Argument 1 is the regexp to match.
 # Argument 2 is the suffix for the dump file
-# Argument 3 handles expected failures and the like
+# Argument 3 is the suffix of the dump base
+# Argument 4 handles expected failures and the like
 proc scan-dump { args } {
 
-    if { [llength $args] >= 4 } {
-        switch [dg-process-target [lindex $args 3]] {
+    if { [llength $args] >= 5 } {
+        switch [dg-process-target [lindex $args 4]] {
             "S" { }
             "N" { return }
             "F" { setup_xfail "*-*-*" }
@@ -52,7 +66,8 @@ proc scan-dump { args } {
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump $suf \"$printable_pattern\""
     set src [file tail $filename]
-    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    set dumpbase [dump-base $src [lindex $args 3]]
+    set output_file "[glob -nocomplain $dumpbase.[lindex $args 2]]"
     if { $output_file == "" } {
 	verbose -log "$testcase: dump file does not exist"
 	unresolved "$testname"
@@ -75,11 +90,12 @@ proc scan-dump { args } {
 # Argument 1 is the regexp to match.
 # Argument 2 is number of times the regexp must be found
 # Argument 3 is the suffix for the dump file
-# Argument 4 handles expected failures and the like
+# Argument 4 is the suffix of the dump base
+# Argument 5 handles expected failures and the like
 proc scan-dump-times { args } {
 
-    if { [llength $args] >= 5 } {
-	switch [dg-process-target [lindex $args 4]] {
+    if { [llength $args] >= 6 } {
+	switch [dg-process-target [lindex $args 5]] {
 	    "S" { }
 	    "N" { return }
 	    "F" { setup_xfail "*-*-*" }
@@ -95,7 +111,8 @@ proc scan-dump-times { args } {
     set printable_pattern [make_pattern_printable [lindex $args 1]]
     set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"$printable_pattern\" [lindex $args 2]"
     set src [file tail $filename]
-    set output_file "[glob -nocomplain $src.[lindex $args 3]]"
+    set dumpbase [dump-base $src [lindex $args 4]]
+    set output_file "[glob -nocomplain $dumpbase.[lindex $args 3]]"
     if { $output_file == "" } {
 	verbose -log "$testcase: dump file does not exist"
 	unresolved "$testname"
@@ -120,11 +137,12 @@ proc scan-dump-times { args } {
 # Argument 0 is the type of dump we are searching (rtl, tree, ipa)
 # Argument 1 is the regexp to match.
 # Argument 2 is the suffix for the dump file
-# Argument 3 handles expected failures and the like
+# Argument 3 is the suffix of the dump base
+# Argument 4 handles expected failures and the like
 proc scan-dump-not { args } {
 
-    if { [llength $args] >= 4 } {
-	switch [dg-process-target [lindex $args 3]] {
+    if { [llength $args] >= 5 } {
+	switch [dg-process-target [lindex $args 4]] {
 	    "S" { }
 	    "N" { return }
 	    "F" { setup_xfail "*-*-*" }
@@ -139,7 +157,8 @@ proc scan-dump-not { args } {
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"$printable_pattern\""
     set src [file tail $filename]
-    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    set dumpbase [dump-base $src [lindex $args 3]]
+    set output_file "[glob -nocomplain $dumpbase.[lindex $args 2]]"
     if { $output_file == "" } {
 	verbose -log "$testcase: dump file does not exist"
 	unresolved "$testname"
@@ -163,13 +182,14 @@ proc scan-dump-not { args } {
 # Argument 0 is the type of dump we are searching (rtl, tree, ipa)
 # Argument 1 is the regexp to match.
 # Argument 2 is the suffix for the dump file
-# Argument 3 handles expected failures and the like
+# Argument 3 is the suffix of the dump base
+# Argument 4 handles expected failures and the like
 proc scan-dump-dem { args } {
     global cxxfilt
     global base_dir
 
-    if { [llength $args] >= 4 } {
-	switch [dg-process-target [lindex $args 3]] {
+    if { [llength $args] >= 5 } {
+	switch [dg-process-target [lindex $args 4]] {
 	    "S" { }
 	    "N" { return }
 	    "F" { setup_xfail "*-*-*" }
@@ -194,7 +214,8 @@ proc scan-dump-dem { args } {
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"$printable_pattern\""
     set src [file tail $filename]
-    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    set dumpbase [dump-base $src [lindex $args 3]]
+    set output_file "[glob -nocomplain $dumpbase.[lindex $args 2]]"
     if { $output_file == "" } {
 	verbose -log "$testcase: dump file does not exist"
 	unresolved "$testname"
@@ -217,13 +238,14 @@ proc scan-dump-dem { args } {
 # Argument 0 is the type of dump we are searching (rtl, tree, ipa)
 # Argument 1 is the regexp to match.
 # Argument 2 is the suffix for the dump file
-# Argument 3 handles expected failures and the like
+# Argument 3 is the suffix of the dump base
+# Argument 4 handles expected failures and the like
 proc scan-dump-dem-not { args } {
     global cxxfilt
     global base_dir
 
-    if { [llength $args] >= 4 } {
-	switch [dg-process-target [lindex $args 3]] {
+    if { [llength $args] >= 5 } {
+	switch [dg-process-target [lindex $args 4]] {
 	    "S" { }
 	    "N" { return }
 	    "F" { setup_xfail "*-*-*" }
@@ -248,7 +270,8 @@ proc scan-dump-dem-not { args } {
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"$printable_pattern\""
     set src [file tail $filename]
-    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    set dumpbase [dump-base $src [lindex $args 3]]
+    set output_file "[glob -nocomplain $dumpbase.[lindex $args 2]]"
     if { $output_file == "" } {
 	verbose -log "$testcase: dump file does not exist"
 	unresolved "$testname"
diff --git a/gcc/testsuite/lib/scanipa.exp b/gcc/testsuite/lib/scanipa.exp
index 3e2f1a4..68f1ae3 100644
--- a/gcc/testsuite/lib/scanipa.exp
+++ b/gcc/testsuite/lib/scanipa.exp
@@ -36,9 +36,11 @@ proc scan-ipa-dump { args } {
 	return
     }
     if { [llength $args] >= 3 } {
-	scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
+	scan-dump "ipa" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" [lindex $args 2]
     } else {
-	scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
+	scan-dump "ipa" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ""
     }
 }
 
@@ -59,10 +61,11 @@ proc scan-ipa-dump-times { args } {
     }
     if { [llength $args] >= 4 } {
 	scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" [lindex $args 3]
+			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" "" \
+			[lindex $args 3]
     } else {
 	scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]"
+			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ""
     }
 }
 
@@ -83,10 +86,11 @@ proc scan-ipa-dump-not { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-not "ipa" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-not "ipa" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ""
     }
 }
 
@@ -108,10 +112,11 @@ proc scan-ipa-dump-dem { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-dem "ipa" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-dem "ipa" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ""
     }
 }
 
@@ -132,10 +137,10 @@ proc scan-ipa-dump-dem-not { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-dem-not "ipa" [lindex $args 0] \
-			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" \
+			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \
 			  [lindex $args 2]
     } else {
 	scan-dump-dem-not "ipa" [lindex $args 0] \
-			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
+			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ""
     }
 }
diff --git a/gcc/testsuite/lib/scanlang.exp b/gcc/testsuite/lib/scanlang.exp
index 856ceb8..3c8bf64 100644
--- a/gcc/testsuite/lib/scanlang.exp
+++ b/gcc/testsuite/lib/scanlang.exp
@@ -36,8 +36,10 @@ proc scan-lang-dump { args } {
 	return
     }
     if { [llength $args] >= 3 } {
-	scan-dump "lang" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" [lindex $args 2]
+	scan-dump "lang" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" "" [lindex $args 2]
     } else {
-	scan-dump "lang" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]"
+	scan-dump "lang" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" ""
     }
 }
diff --git a/gcc/testsuite/lib/scanrtl.exp b/gcc/testsuite/lib/scanrtl.exp
index fea3d80..d744e7d 100644
--- a/gcc/testsuite/lib/scanrtl.exp
+++ b/gcc/testsuite/lib/scanrtl.exp
@@ -36,9 +36,11 @@ proc scan-rtl-dump { args } {
 	return
     }
     if { [llength $args] >= 3 } {
-	scan-dump "rtl" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
+	scan-dump "rtl" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" "" [lindex $args 2]
     } else {
-	scan-dump "rtl" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
+	scan-dump "rtl" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" ""
     }
 }
 
@@ -61,10 +63,11 @@ proc scan-rtl-dump-times { args } {
     }
     if { [llength $args] >= 4 } {
 	scan-dump-times "rtl" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]" [lindex $args 3]
+			"\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]" "" \
+			[lindex $args 3]
     } else {
 	scan-dump-times "rtl" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]"
+			"\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]" ""
     }
 }
 
@@ -87,10 +90,11 @@ proc scan-rtl-dump-not { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-not "rtl" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-not "rtl" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" ""
     }
 }
 
@@ -114,10 +118,11 @@ proc scan-rtl-dump-dem { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-dem "rtl" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-dem "rtl" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" ""
     }
 }
 
@@ -141,10 +146,10 @@ proc scan-rtl-dump-dem-not { args } {
     if { [llength $args] >= 3 } {
 	scan-dump-dem-not "rtl" [lindex $args 0] \
 			  "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" \
-			  [lindex $args 2]
+			  "" [lindex $args 2]
     } else {
 	scan-dump-dem-not "rtl" [lindex $args 0] \
-			  "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
+			  "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" ""
     }
 }
 
diff --git a/gcc/testsuite/lib/scantree.exp b/gcc/testsuite/lib/scantree.exp
index 8dcc4d0..e66337a 100644
--- a/gcc/testsuite/lib/scantree.exp
+++ b/gcc/testsuite/lib/scantree.exp
@@ -36,9 +36,11 @@ proc scan-tree-dump { args } {
 	return
     }
     if { [llength $args] >= 3 } {
-	scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
+	scan-dump "tree" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" "" [lindex $args 2]
     } else {
-	scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
+	scan-dump "tree" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ""
     }
 }
 
@@ -59,10 +61,11 @@ proc scan-tree-dump-times { args } {
     }
     if { [llength $args] >= 4 } {
 	scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" [lindex $args 3]
+			"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" "" \
+			[lindex $args 3]
     } else {
 	scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
-			"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]"
+			"\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" ""
     }
 }
 
@@ -83,10 +86,11 @@ proc scan-tree-dump-not { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-not "tree" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-not "tree" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ""
     }
 }
 
@@ -108,10 +112,11 @@ proc scan-tree-dump-dem { args } {
     }
     if { [llength $args] >= 3 } {
 	scan-dump-dem "tree" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
+		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" "" \
+		      [lindex $args 2]
     } else {
 	scan-dump-dem "tree" [lindex $args 0] \
-		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
+		      "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ""
     }
 }
 
@@ -133,9 +138,9 @@ proc scan-tree-dump-dem-not { args } {
     if { [llength $args] >= 3 } {
 	scan-dump-dem-not "tree" [lindex $args 0] \
 			  "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
-			  [lindex $args 2]
+			  "" [lindex $args 2]
     } else {
 	scan-dump-dem-not "tree" [lindex $args 0] \
-			  "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
+			  "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ""
     }
 }
diff --git a/gcc/testsuite/lib/scanwpaipa.exp b/gcc/testsuite/lib/scanwpaipa.exp
new file mode 100644
index 0000000..85c5864
--- /dev/null
+++ b/gcc/testsuite/lib/scanwpaipa.exp
@@ -0,0 +1,147 @@
+#   Copyright (C) 2018 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.
+# 
+# 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.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Various utilities for scanning ipa dump output, used by gcc-dg.exp and
+# g++-dg.exp.
+
+load_lib scandump.exp
+
+# Utility for scanning compiler result, invoked via dg-final.
+# Call pass if pattern is present, otherwise fail.
+#
+# Argument 0 is the regexp to match
+# Argument 1 is the name of the dumped ipa pass
+# Argument 2 handles expected failures and the like
+proc scan-wpa-ipa-dump { args } {
+
+    if { [llength $args] < 2 } {
+	error "scan-wpa-ipa-dump: too few arguments"
+	return
+    }
+    if { [llength $args] > 3 } {
+	error "scan-wpa-ipa-dump: too many arguments"
+	return
+    }
+    if { [llength $args] >= 3 } {
+	scan-dump "wpa-ipa" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
+		  [lindex $args 2]
+    } else {
+	scan-dump "wpa-ipa" [lindex $args 0] \
+		  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
+    }
+}
+
+# Call pass if pattern is present given number of times, otherwise fail.
+# Argument 0 is the regexp to match
+# Argument 1 is number of times the regexp must be found
+# Argument 2 is the name of the dumped ipa pass
+# Argument 3 handles expected failures and the like
+proc scan-wpa-ipa-dump-times { args } {
+
+    if { [llength $args] < 3 } {
+	error "scan-wpa-ipa-dump: too few arguments"
+	return
+    }
+    if { [llength $args] > 4 } {
+	error "scan-wpa-ipa-dump: too many arguments"
+	return
+    }
+    if { [llength $args] >= 4 } {
+	scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
+			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".exe.wpa" \
+			[lindex $args 3]
+    } else {
+	scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
+			"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".exe.wpa"
+    }
+}
+
+# Call pass if pattern is not present, otherwise fail.
+#
+# Argument 0 is the regexp to match
+# Argument 1 is the name of the dumped ipa pass
+# Argument 2 handles expected failures and the like
+proc scan-wpa-ipa-dump-not { args } {
+
+    if { [llength $args] < 2 } {
+	error "scan-wpa-ipa-dump-not: too few arguments"
+	return
+    }
+    if { [llength $args] > 3 } {
+	error "scan-wpa-ipa-dump-not: too many arguments"
+	return
+    }
+    if { [llength $args] >= 3 } {
+	scan-dump-not "wpa-ipa" [lindex $args 0] \
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
+		      [lindex $args 2]
+    } else {
+	scan-dump-not "wpa-ipa" [lindex $args 0] \
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
+    }
+}
+
+# Utility for scanning demangled compiler result, invoked via dg-final.
+# Call pass if pattern is present, otherwise fail.
+#
+# Argument 0 is the regexp to match
+# Argument 1 is the name of the dumped ipa pass
+# Argument 2 handles expected failures and the like
+proc scan-wpa-ipa-dump-dem { args } {
+
+    if { [llength $args] < 2 } {
+	error "scan-wpa-ipa-dump-dem: too few arguments"
+	return
+    }
+    if { [llength $args] > 3 } {
+	error "scan-wpa-ipa-dump-dem: too many arguments"
+	return
+    }
+    if { [llength $args] >= 3 } {
+	scan-dump-dem "wpa-ipa" [lindex $args 0] \
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
+		      [lindex $args 2]
+    } else {
+	scan-dump-dem "wpa-ipa" [lindex $args 0] \
+		      "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
+    }
+}
+
+# Call pass if demangled pattern is not present, otherwise fail.
+#
+# Argument 0 is the regexp to match
+# Argument 1 is the name of the dumped ipa pass
+# Argument 2 handles expected failures and the like
+proc scan-wpa-ipa-dump-dem-not { args } {
+
+    if { [llength $args] < 2 } {
+	error "scan-wpa-ipa-dump-dem-not: too few arguments"
+	return
+    }
+    if { [llength $args] > 3 } {
+	error "scan-wpa-ipa-dump-dem-not: too many arguments"
+	return
+    }
+    if { [llength $args] >= 3 } {
+	scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
+			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa" \
+			  [lindex $args 2]
+    } else {
+	scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
+			  "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".exe.wpa"
+    }
+}
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 0a53f9e..9737758 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -38,6 +38,7 @@ load_gcc_lib scanlang.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
 load_gcc_lib scanipa.exp
+load_gcc_lib scanwpaipa.exp
 load_gcc_lib multiline.exp
 load_gcc_lib prune.exp
 load_gcc_lib target-libpath.exp
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index ea3da2c..15c459a 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 scanipa.exp
+load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp
 load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index b3c7eb9..e9f5f48 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -44,6 +44,7 @@ load_gcc_lib scanlang.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
 load_gcc_lib scanipa.exp
+load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp
 load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp
diff --git a/libvtv/testsuite/lib/libvtv.exp b/libvtv/testsuite/lib/libvtv.exp
index edf5fdd..540b8ad 100644
--- a/libvtv/testsuite/lib/libvtv.exp
+++ b/libvtv/testsuite/lib/libvtv.exp
@@ -43,6 +43,7 @@ load_gcc_lib scandump.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
 load_gcc_lib scanipa.exp
+load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp
 load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]