On Wed, 3 May 2023, Thomas Schwinge wrote:

> Hi!
> 
> This very likely isn't the only instance of such a kind of problem in the
> GCC testsuite ;-) -- but it's one that I've run into, and analyzed:
> 
> On 2011-09-27T19:23:22+0200, Jan Hubicka <hubi...@ucw.cz> wrote:
> > this patch updates testsuite to cover both fat and slim LTO when linker 
> > plugin
> > is used [...]
> 
> This change here:
> 
> > *** 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_linker_plugin_available] {
> > !       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}               \
> > !     }
> >       }
> >   }
> 
> ... is problematic: initializing the persistent 'LTO_OPTIONS' dependent
> on 'check_linker_plugin_available' that is (potentially) variable per
> testing variant ('RUNTESTFLAGS=--target_board=unix\{-m64,-m32\}', for
> example).
> 
> Similarly:
> 
> > *** 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 }
> > !     }
> >   }
> 
> ..., and:
> 
> > *** 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 }
> > !     }
> >   }
> 
> OK to push the attached

LGTM, please leave the others a chance to comment in case they
spotted anything wrong.

Richard.

> "Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' 
> the 'LTO_TORTURE_OPTIONS'"?
> 
> 
> Gr??e
>  Thomas
> 
> 
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra?e 201, 80634 
> M?nchen; Gesellschaft mit beschr?nkter Haftung; Gesch?ftsf?hrer: Thomas 
> Heurung, Frank Th?rauf; Sitz der Gesellschaft: M?nchen; Registergericht 
> M?nchen, HRB 106955
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

Reply via email to