[testsuite] Add scan-ltrans-tree-dump
authorTom de Vries <tom@codesourcery.com>
Wed, 2 May 2018 12:16:32 +0000 (12:16 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Wed, 2 May 2018 12:16:32 +0000 (12:16 +0000)
2018-05-02  Tom de Vries  <tom@codesourcery.com>

PR testsuite/85106
* gcc.dg/ipa/ipa-icf-38.c: Use scan-ltrans-tree-dump.
* lib/scanltranstree.exp: New file.
* lib/target-supports.exp (scan-ltrans-tree-dump_required_options)
(scan-ltrans-tree-dump-times_required_options)
(scan-ltrans-tree-dump-not_required_options)
(scan-ltrans-tree-dump-dem_required_options)
(scan-ltrans-tree-dump-dem-not_required_options): New proc.
* lib/gcc-dg.exp: Include scanltranstree.exp.

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

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

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

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

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

From-SVN: r259838

15 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/ipa-icf-38.c
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/scanltranstree.exp [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp
libatomic/ChangeLog
libatomic/testsuite/lib/libatomic.exp
libgomp/ChangeLog
libgomp/testsuite/lib/libgomp.exp
libitm/ChangeLog
libitm/testsuite/lib/libitm.exp
libvtv/ChangeLog
libvtv/testsuite/lib/libvtv.exp

index 3abedbe019dd09f252e2a15276c8bc48ec0fd6c2..1c50825790b831b7e473333aacdf652c7cb470ab 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * doc/sourcebuild.texi (Commands for use in dg-final, Scan optimization
+       dump files): Add ltrans-tree.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index ad4f446721d7b307b814645f25baaeb5b6765dcf..16164ae2cf3e7728c0430fd8991f6ac8b6c00c36 100644 (file)
@@ -2588,8 +2588,8 @@ assembly output.
 
 @subsubsection Scan optimization dump files
 
-These commands are available for @var{kind} of @code{tree}, @code{rtl},
-@code{ipa}, and @code{wpa-ipa}.
+These commands are available for @var{kind} of @code{tree}, @code{ltrans-tree},
+@code{rtl}, @code{ipa}, and @code{wpa-ipa}.
 
 @table @code
 @item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
index 80b6d373d0ef52e3077e970b33ed2dab025c3d4e..e6ee793567a164ce35087de9a40e2d030673df4b 100644 (file)
@@ -1,3 +1,15 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * gcc.dg/ipa/ipa-icf-38.c: Use scan-ltrans-tree-dump.
+       * lib/scanltranstree.exp: New file.
+       * lib/target-supports.exp (scan-ltrans-tree-dump_required_options)
+       (scan-ltrans-tree-dump-times_required_options)
+       (scan-ltrans-tree-dump-not_required_options)
+       (scan-ltrans-tree-dump-dem_required_options)
+       (scan-ltrans-tree-dump-dem-not_required_options): New proc.
+       * lib/gcc-dg.exp: Include scanltranstree.exp.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index 6e7936a6a687cfc71dc0dba9fadd0a0c6b293181..85531ab1cf3f938736b76db6719150d5374e2f83 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "-O2 -fdump-ipa-icf -flto" } */
+/* { dg-options "-O2 -fdump-ipa-icf -flto -fdump-tree-fixup_cfg4" } */
 /* { dg-require-effective-target lto } */
 /* { dg-additional-sources "ipa-icf-38a.c" }*/
 
@@ -29,3 +29,5 @@ int main()
 
 /* { dg-final { scan-wpa-ipa-dump "Semantic equality hit:foo->bar" "icf"  } } */
 /* { dg-final { scan-wpa-ipa-dump "Equal symbols: 1" "icf"  } } */
+/* { dg-final { scan-ltrans-tree-dump "Function foo" "fixup_cfg4" } } */
+/* { dg-final { scan-ltrans-tree-dump-not "Function bar" "fixup_cfg4" } } */
index 2fca9e87afcd52d53657fe02de26570c91ab0717..a15c5d5e2a6443ef02f51a3d261b786f5d7f946b 100644 (file)
@@ -21,6 +21,7 @@ load_lib target-supports-dg.exp
 load_lib scanasm.exp
 load_lib scanrtl.exp
 load_lib scantree.exp
+load_lib scanltranstree.exp
 load_lib scanipa.exp
 load_lib scanwpaipa.exp
 load_lib scanlang.exp
diff --git a/gcc/testsuite/lib/scanltranstree.exp b/gcc/testsuite/lib/scanltranstree.exp
new file mode 100644 (file)
index 0000000..f536f84
--- /dev/null
@@ -0,0 +1,148 @@
+#   Copyright (C) 2000-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 ltrans tree 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 tree pass
+# Argument 2 handles expected failures and the like
+proc scan-ltrans-tree-dump { args } {
+
+    if { [llength $args] < 2 } {
+       error "scan-ltrans-tree-dump: too few arguments"
+       return
+    }
+    if { [llength $args] > 3 } {
+       error "scan-ltrans-tree-dump: too many arguments"
+       return
+    }
+    if { [llength $args] >= 3 } {
+       scan-dump "ltrans-tree" [lindex $args 0] \
+                 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
+                 [lindex $args 2]
+    } else {
+       scan-dump "ltrans-tree" [lindex $args 0] \
+                 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
+    }
+}
+
+# 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 tree pass
+# Argument 3 handles expected failures and the like
+proc scan-ltrans-tree-dump-times { args } {
+
+    if { [llength $args] < 3 } {
+       error "scan-ltrans-tree-dump-times: too few arguments"
+       return
+    }
+    if { [llength $args] > 4 } {
+       error "scan-ltrans-tree-dump-times: too many arguments"
+       return
+    }
+    if { [llength $args] >= 4 } {
+       scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \
+                       "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" \
+                       ".exe.ltrans0" [lindex $args 3]
+    } else {
+       scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \
+                       "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" ".exe.ltrans0"
+    }
+}
+
+# Call pass if pattern is not present, otherwise fail.
+#
+# Argument 0 is the regexp to match
+# Argument 1 is the name of the dumped tree pass
+# Argument 2 handles expected failures and the like
+proc scan-ltrans-tree-dump-not { args } {
+
+    if { [llength $args] < 2 } {
+       error "scan-ltrans-tree-dump-not: too few arguments"
+       return
+    }
+    if { [llength $args] > 3 } {
+       error "scan-ltrans-tree-dump-not: too many arguments"
+       return
+    }
+    if { [llength $args] >= 3 } {
+       scan-dump-not "ltrans-tree" [lindex $args 0] \
+                     "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
+                     [lindex $args 2]
+    } else {
+       scan-dump-not "ltrans-tree" [lindex $args 0] \
+                     "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
+    }
+}
+
+# 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 tree pass
+# Argument 2 handles expected failures and the like
+proc scan-ltrans-tree-dump-dem { args } {
+
+    if { [llength $args] < 2 } {
+       error "scan-ltrans-tree-dump-dem: too few arguments"
+       return
+    }
+    if { [llength $args] > 3 } {
+       error "scan-ltrans-tree-dump-dem: too many arguments"
+       return
+    }
+    if { [llength $args] >= 3 } {
+       scan-dump-dem "ltrans-tree" [lindex $args 0] \
+                     "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0" \
+                     [lindex $args 2]
+    } else {
+       scan-dump-dem "ltrans-tree" [lindex $args 0] \
+                     "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".exe.ltrans0"
+    }
+}
+
+# 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 tree pass
+# Argument 2 handles expected failures and the like
+proc scan-ltrans-tree-dump-dem-not { args } {
+
+    if { [llength $args] < 2 } {
+       error "scan-ltrans-tree-dump-dem-not: too few arguments"
+       return
+    }
+    if { [llength $args] > 3 } {
+       error "scan-ltrans-tree-dump-dem-not: too many arguments"
+       return
+    }
+    if { [llength $args] >= 3 } {
+       scan-dump-dem-not "ltrans-tree" [lindex $args 0] \
+                         "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
+                         ".exe.ltrans0" [lindex $args 2]
+    } else {
+       scan-dump-dem-not "ltrans-tree" [lindex $args 0] \
+                         "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
+                         ".exe.ltrans0"
+    }
+}
index 590b62c28e603c9c43cd5c2f5990153e49a3dd6e..cfc22a2297587351ac7f8eed692adc9c42a69033 100644 (file)
@@ -8809,6 +8809,26 @@ proc force_conventional_output_for { test } {
     }
 }
 
+# Record that dg-final test scan-ltrans-tree-dump* requires -flto-partition=one
+# in order to force a single partition, allowing scan-ltrans-tree-dump* to scan
+# a dump file *.exe.ltrans0.*.
+
+proc scan-ltrans-tree-dump_required_options {} {
+    return "-flto-partition=one"
+}
+proc scan-ltrans-tree-dump-times_required_options {} {
+    return "-flto-partition=one"
+}
+proc scan-ltrans-tree-dump-not_required_options {} {
+    return "-flto-partition=one"
+}
+proc scan-ltrans-tree-dump-dem_required_options {} {
+    return "-flto-partition=one"
+}
+proc scan-ltrans-tree-dump-dem-not_required_options {} {
+    return "-flto-partition=one"
+}
+
 # Return 1 if the x86-64 target supports PIE with copy reloc, 0
 # otherwise.  Cache the result.
 
index 70761047cbc5308bfe1011e4f8c5feb2b6b19a3a..82a2e040c6b04c07ef322854d707b136f004f9d6 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * testsuite/lib/libatomic.exp: Include scanltranstree.exp.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index 9737758f5495fac69a6ae64b2b5fdab3a381dec9..38f3e5673e24f36e641c15bc5aba5221dc6a4f0a 100644 (file)
@@ -37,6 +37,7 @@ load_gcc_lib scandump.exp
 load_gcc_lib scanlang.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
+load_gcc_lib scanltranstree.exp
 load_gcc_lib scanipa.exp
 load_gcc_lib scanwpaipa.exp
 load_gcc_lib multiline.exp
index e9799b132e04cd0ef595e021c6bb5001d9ae4125..958f92bc4c7fff261595b0a46c7f6a4e06bd7e53 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * testsuite/lib/libgomp.exp: Include scanltranstree.exp.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index 15c459abe141044225e8dc12abc283943510fedf..c694f17c62ff77769447ad45d229caa95d2b1346 100644 (file)
@@ -29,6 +29,7 @@ load_gcc_lib scandump.exp
 load_gcc_lib scanlang.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
+load_gcc_lib scanltranstree.exp
 load_gcc_lib scanipa.exp
 load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp
index dc729709af7f4b5017e782da6bea033b6bf2a997..1758b6a8f7fb914ab29045a216c2f4cf34abee22 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * testsuite/lib/libitm.exp: Include scanltranstree.exp.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index e9f5f48fd806f7062abfb696f120d0d323791203..b3d247b9f98a1fce8651726910f8fe13a49b23d9 100644 (file)
@@ -43,6 +43,7 @@ load_gcc_lib scandump.exp
 load_gcc_lib scanlang.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
+load_gcc_lib scanltranstree.exp
 load_gcc_lib scanipa.exp
 load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp
index b76651dcc79a5f63d091e2d044c3a9fc44cc2404..cd1beb9004b2a54f1fa5332b1c14fbad2e4fda3f 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-02  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/85106
+       * testsuite/lib/libvtv.exp: Include scanltranstree.exp.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/85106
index 540b8adde3b14b428e2dc3740edfd46393c4d7e1..4b71c9ce7bcf8d2461258c65d861fbad59756f33 100644 (file)
@@ -42,6 +42,7 @@ load_gcc_lib scanasm.exp
 load_gcc_lib scandump.exp
 load_gcc_lib scanrtl.exp
 load_gcc_lib scantree.exp
+load_gcc_lib scanltranstree.exp
 load_gcc_lib scanipa.exp
 load_gcc_lib scanwpaipa.exp
 load_gcc_lib timeout-dg.exp