public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/53777] New: [lto] lto does not propagate optimization flags from command lines given at "compilation time"
@ 2012-06-26  8:34 vincenzo.innocente at cern dot ch
  2012-06-26  9:10 ` [Bug lto/53777] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-06-26  8:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53777

             Bug #: 53777
           Summary: [lto] lto does not propagate optimization flags from
                    command lines given at "compilation time"
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


we are used to mix in the same library code compiled with -O2 and -Os
Lto seems to ignore the options used in the "compilation" steps
It does honor "pragma GCC optimize" though

example

cat optopt.cc
// #pragma GCC optimize ("0")

void bar(int);

inline void foo(int i, int j) {
  if (i>0) bar(i);
  if (j>0) bar(j);
  if (i>0) bar(j);
  if (j>0) bar(i);
 };


void foo1(int i, int j) {
  foo(i,j);
}
void foo2(int i, int j) {
  foo(i,j);
}
void foo3(int i, int j) {
  foo(i,j);
}

c++ -flto -fno-fat-lto-objects -Os -c optopt.cc -fPIC
c++ -flto -O2 -shared optopt.o -fPIC -o optopt.so; nm -C optopt.so
….
                 U bar(int)
00000000000007a0 T foo1(int, int)
0000000000000740 T foo2(int, int)
00000000000006e0 T foo3(int, int)
….
c++ -flto -Os -shared optopt.o -fPIC -o optopt.so; nm -C optopt.so
….
                 U bar(int)
00000000000006e0 t foo(int, int) [clone .local.0.2370]
000000000000071c T foo1(int, int)
000000000000071a T foo2(int, int)
0000000000000718 T foo3(int, int)
…


if I decomment the pragma I get what intended
c++ -flto -fno-fat-lto-objects -O2 -c optopt.cc -fPIC
c++ -flto -O2 -shared optopt.o -fPIC -o optopt.so; nm -C optopt.so
                 U bar(int)
00000000000006e0 t foo(int, int) [clone .local.0.2370]
0000000000000760 T foo1(int, int)
0000000000000750 T foo2(int, int)
0000000000000740 T foo3(int, int)

due to PR53776 I cannot specify Os using a pragma. so I am a bit stuck


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-24  4:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26  8:34 [Bug lto/53777] New: [lto] lto does not propagate optimization flags from command lines given at "compilation time" vincenzo.innocente at cern dot ch
2012-06-26  9:10 ` [Bug lto/53777] " rguenth at gcc dot gnu.org
2012-06-28  5:08 ` vincenzo.innocente at cern dot ch
2012-06-28  9:44 ` rguenth at gcc dot gnu.org
2012-06-28 12:11 ` vincenzo.innocente at cern dot ch
2021-12-24  4:12 ` pinskia at gcc dot gnu.org

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).