Hi,
this patch updates testsuite to cover both fat and slim LTO when linker plugin
is used and also both linker plugin and collect2 paths.  I didn't wanted to
slow down testing too much so I just distributes the flags across existing runs
with aim to maximize the coverage of testing matrix that is bit large now.
I believe it is sufficient and testsuite now runs a bit faster than previously
since slim LTO saves some effort.

sync and pr34850 tests doesn't pass with slim LTO. The reason is that they
excpects diagnostics that is output too late in compilation (usually at
expansion time).  These should be probably fixed as QOI issue but they are not
real bug - the diagnostics will be output at linktime.  I will open PR tracking
this.  We probably should output pretty much everything till end of early opts
except for stuff that really looks for optimization results.  Especially now
when we handle always inline in early inlining.

Honza

        * lib/lto.exp: When linker plugin is available test both
        plugin/non-plugin LTO paths as well as fat and slim LTO.
        lib/c-torture.exp: Likewise.
        lib/gcc-dg.exp: Likweise
        * gcc.c-torture/compile/sync-1.c: Do not run with slim LTO.
        * gcc.c-torture/compile/sync-2.c: Do not run with slim LTO.
        * gcc.c-torture/compile/sync-3.c: Do not run with slim LTO.
        * gcc.dg/noncompile/920507-1.c: Do not run with slim LTO.
        * g++.dg/torture/pr34850.C: Do not run with slim LTO
Index: lib/lto.exp
===================================================================
*** lib/lto.exp (revision 179274)
--- lib/lto.exp (working copy)
*************** proc lto_init { args } {
*** 66,79 ****
      # You can put this in the environment before site.exp is written or
      # add it to site.exp directly.
      if ![info exists LTO_OPTIONS] {
!       set LTO_OPTIONS [list   \
!           {-O0 -flto -flto-partition=none } \
!           {-O2 -flto -flto-partition=none } \
!           {-O0 -flto -flto-partition=1to1 } \
!           {-O2 -flto -flto-partition=1to1 } \
!           {-O0 -flto}         \
!           {-O2 -flto}         \
!       ]
      }
  }
  
--- 66,89 ----
      # You can put this in the environment before site.exp is written or
      # add it to site.exp directly.
      if ![info exists LTO_OPTIONS] {
!         if [check_effective_target_lto] {
!         set LTO_OPTIONS [list \
!             {-O0 -flto -flto-partition=none -fuse-linker-plugin} \
!             {-O2 -flto -flto-partition=none -fuse-linker-plugin 
-fno-fat-lto-objects } \
!             {-O0 -flto -flto-partition=1to1 -fno-use-linker-plugin } \
!             {-O2 -flto -flto-partition=1to1 -fno-use-linker-plugin } \
!             {-O0 -flto -fuse-linker-plugin -fno-fat-lto-objects }     \
!             {-O2 -flto -fuse-linker-plugin}   \
!         ]
!       } else {
!         set LTO_OPTIONS [list \
!             {-O0 -flto -flto-partition=none } \
!             {-O2 -flto -flto-partition=none } \
!             {-O0 -flto -flto-partition=1to1 } \
!             {-O2 -flto -flto-partition=1to1 } \
!             {-O0 -flto }      \
!             {-O2 -flto}               \
!       }
      }
  }
  
Index: lib/c-torture.exp
===================================================================
*** lib/c-torture.exp   (revision 179274)
--- lib/c-torture.exp   (working copy)
*************** if [info exists ADDITIONAL_TORTURE_OPTIO
*** 52,61 ****
  
  set LTO_TORTURE_OPTIONS ""
  if [check_effective_target_lto] {
!     set LTO_TORTURE_OPTIONS [list \
!       { -O2 -flto -flto-partition=none } \
!       { -O2 -flto }
!     ]
  }
  
  global GCC_UNDER_TEST
--- 52,69 ----
  
  set LTO_TORTURE_OPTIONS ""
  if [check_effective_target_lto] {
!     # When having plugin test both slim and fat LTO and plugin/nonplugin
!     # path.
!     if [check_linker_plugin_available] {
!       set LTO_TORTURE_OPTIONS [list \
!         { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
!         { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
!       ]
!     } else {
!       set LTO_TORTURE_OPTIONS [list \
!         { -O2 -flto -flto-partition=none } \
!         { -O2 -flto -fuse-linker-plugin }
!     }
  }
  
  global GCC_UNDER_TEST
Index: lib/gcc-dg.exp
===================================================================
*** lib/gcc-dg.exp      (revision 179274)
--- lib/gcc-dg.exp      (working copy)
*************** if [info exists ADDITIONAL_TORTURE_OPTIO
*** 69,78 ****
  
  set LTO_TORTURE_OPTIONS ""
  if [check_effective_target_lto] {
!     set LTO_TORTURE_OPTIONS [list \
!       { -O2 -flto -flto-partition=none } \
!       { -O2 -flto }
!     ]
  }
  
  
--- 69,86 ----
  
  set LTO_TORTURE_OPTIONS ""
  if [check_effective_target_lto] {
!     # When having plugin test both slim and fat LTO and plugin/nonplugin
!     # path.
!     if [check_linker_plugin_available] {
!       set LTO_TORTURE_OPTIONS [list \
!         { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
!         { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
!       ]
!     } else {
!       set LTO_TORTURE_OPTIONS [list \
!         { -O2 -flto -flto-partition=none } \
!         { -O2 -flto -fuse-linker-plugin }
!     }
  }
  
  
Index: gcc.c-torture/execute/builtins/strstr-asm.c
===================================================================
*** gcc.c-torture/execute/builtins/strstr-asm.c (revision 179274)
--- gcc.c-torture/execute/builtins/strstr-asm.c (working copy)
***************
*** 2,7 ****
--- 2,8 ----
  
     Ensure all expected transformations of builtin strstr occur and
     perform correctly in presence of redirect.  */
+ /* { dg-options "-ffat-lto-objects" } */
  
  #define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
  #define ASMNAME2(prefix, cname) STRING (prefix) cname
Index: gcc.c-torture/compile/sync-1.c
===================================================================
*** gcc.c-torture/compile/sync-1.c      (revision 179274)
--- gcc.c-torture/compile/sync-1.c      (working copy)
***************
*** 1,5 ****
--- 1,6 ----
  /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" 
"" { target *-*-* } 0 } */
  /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" 
"" { target *-*-* } 0 } */
+ /* { dg-options "-ffat-lto-objects" } */
  
  /* Validate that each of the __sync builtins compiles.  This won't 
     necessarily link, since the target might not support the builtin,
Index: gcc.c-torture/compile/sync-3.c
===================================================================
*** gcc.c-torture/compile/sync-3.c      (revision 179274)
--- gcc.c-torture/compile/sync-3.c      (working copy)
***************
*** 1,4 ****
--- 1,5 ----
  /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" 
"" { target *-*-* } 0 } */
+ /* { dg-options "-ffat-lto-objects" } */
  
  /* Validate that each of the __sync builtins compiles.  This won't 
     necessarily link, since the target might not support the builtin,
Index: gcc.c-torture/compile/sync-2.c
===================================================================
*** gcc.c-torture/compile/sync-2.c      (revision 179274)
--- gcc.c-torture/compile/sync-2.c      (working copy)
***************
*** 1,4 ****
--- 1,5 ----
  /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" 
"" { target *-*-* } 0 } */
+ /* { dg-options "-ffat-lto-objects" } */
  
  /* Validate that each of the __sync builtins compiles.  This won't 
     necessarily link, since the target might not support the builtin,
Index: gcc.dg/noncompile/invalid_asm.c
===================================================================
*** gcc.dg/noncompile/invalid_asm.c     (revision 179274)
--- gcc.dg/noncompile/invalid_asm.c     (working copy)
***************
*** 1,3 ****
--- 1,4 ----
+ /* { dg-options "-ffat-lto-objects" } */
  asm_invalid_register_name()
  {
    asm("":::"this_is_an_invalid_register_name");       /* { dg-error "unknown 
register" } */
Index: gcc.dg/noncompile/920507-1.c
===================================================================
*** gcc.dg/noncompile/920507-1.c        (revision 179274)
--- gcc.dg/noncompile/920507-1.c        (working copy)
***************
*** 1,3 ****
--- 1,4 ----
+ /* { dg-options "-ffat-lto-objects" } */
  int *
  x(void)
  {
Index: gcc.dg/torture/pr36400.c
===================================================================
*** gcc.dg/torture/pr36400.c    (revision 179274)
--- gcc.dg/torture/pr36400.c    (working copy)
***************
*** 1,4 ****
--- 1,5 ----
  /* { dg-do compile } */
+ /* { dg-options "-ffat-lto-objects" } */
  
  struct barstruct { char const* some_string; };
  
Index: g++.dg/torture/pr34850.C
===================================================================
*** g++.dg/torture/pr34850.C    (revision 179283)
--- g++.dg/torture/pr34850.C    (working copy)
***************
*** 1,5 ****
--- 1,6 ----
  /* { dg-do compile } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+ /* { dg-options "-ffat-lto-objects" } */
  
  typedef unsigned char uint8_t;
  typedef unsigned int uint32_t;

Reply via email to