public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/41589] New: lto does not eliminate unused variables
@ 2009-10-05 14:03 andi-gcc at firstfloor dot org
2009-10-05 14:04 ` [Bug lto/41589] " andi-gcc at firstfloor dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: andi-gcc at firstfloor dot org @ 2009-10-05 14:03 UTC (permalink / raw)
To: gcc-bugs
Using built-in specs.
COLLECT_GCC=gcc45
COLLECT_LTO_WRAPPER=/pkg/gcc-4.5-091004/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/pkg/gcc-4.5-091004
--enable-checking=release --enable-languages=c,c++ --disable-nls --enable-lto
Thread model: posix
gcc version 4.5.0 20091004 (experimental) (GCC)
With the attached simple lto test case I would have expected f1 and f2 and y to
be optimized away when built with -fwhole-program. But that was not the case.
nm ./tlto
...
0000000000601020 b completed.5856
0000000000601010 W data_start
0000000000601028 b dtor_idx.5858
0000000000400560 T f1
0000000000400550 T f2
00000000004004f0 t frame_dummy
0000000000400520 T main
U printf@@GLIBC_2.2.5
0000000000601030 B y
--
Summary: lto does not eliminate unused variables
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andi-gcc at firstfloor dot org
GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
2009-10-05 14:04 ` [Bug lto/41589] " andi-gcc at firstfloor dot org
@ 2009-10-05 14:04 ` andi-gcc at firstfloor dot org
2009-10-05 14:05 ` andi-gcc at firstfloor dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: andi-gcc at firstfloor dot org @ 2009-10-05 14:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from andi-gcc at firstfloor dot org 2009-10-05 14:04 -------
Created an attachment (id=18710)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18710&action=view)
tlto1.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
@ 2009-10-05 14:04 ` andi-gcc at firstfloor dot org
2009-10-05 14:04 ` andi-gcc at firstfloor dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: andi-gcc at firstfloor dot org @ 2009-10-05 14:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from andi-gcc at firstfloor dot org 2009-10-05 14:04 -------
Created an attachment (id=18711)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18711&action=view)
tlto2.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
2009-10-05 14:04 ` [Bug lto/41589] " andi-gcc at firstfloor dot org
2009-10-05 14:04 ` andi-gcc at firstfloor dot org
@ 2009-10-05 14:05 ` andi-gcc at firstfloor dot org
2009-10-05 14:20 ` [Bug tree-optimization/41589] " rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: andi-gcc at firstfloor dot org @ 2009-10-05 14:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from andi-gcc at firstfloor dot org 2009-10-05 14:04 -------
Created an attachment (id=18712)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18712&action=view)
Makefile.lto
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
` (2 preceding siblings ...)
2009-10-05 14:05 ` andi-gcc at firstfloor dot org
@ 2009-10-05 14:20 ` rguenth at gcc dot gnu dot org
2009-10-05 15:17 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-05 14:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-10-05 14:20 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu dot
| |org
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Component|lto |tree-optimization
Ever Confirmed|0 |1
Keywords| |lto, missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2009-10-05 14:20:35
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
` (3 preceding siblings ...)
2009-10-05 14:20 ` [Bug tree-optimization/41589] " rguenth at gcc dot gnu dot org
@ 2009-10-05 15:17 ` pinskia at gcc dot gnu dot org
2009-10-05 15:42 ` andi-gcc at firstfloor dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-05 15:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2009-10-05 15:16 -------
I think this optimization is up to the linker as the variables are marked as
hidden and not marked as local to the Translational unit.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
` (4 preceding siblings ...)
2009-10-05 15:17 ` pinskia at gcc dot gnu dot org
@ 2009-10-05 15:42 ` andi-gcc at firstfloor dot org
2009-10-05 17:07 ` pinskia at gcc dot gnu dot org
2009-11-12 13:23 ` hubicka at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: andi-gcc at firstfloor dot org @ 2009-10-05 15:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from andi-gcc at firstfloor dot org 2009-10-05 15:42 -------
I use binutils 2.19 (from opensuse 11.1).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
` (5 preceding siblings ...)
2009-10-05 15:42 ` andi-gcc at firstfloor dot org
@ 2009-10-05 17:07 ` pinskia at gcc dot gnu dot org
2009-11-12 13:23 ` hubicka at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-05 17:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2009-10-05 17:07 -------
(In reply to comment #6)
> I use binutils 2.19 (from opensuse 11.1).
What I meant was that -ffunction-sections -fdata-sections and then
-Wl,--gc-sections to remove the unused variables/functions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/41589] lto does not eliminate unused variables
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
` (6 preceding siblings ...)
2009-10-05 17:07 ` pinskia at gcc dot gnu dot org
@ 2009-11-12 13:23 ` hubicka at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2009-11-12 13:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from hubicka at gcc dot gnu dot org 2009-11-12 13:23 -------
There are some bugs on LTO and unused vars elimination, but in this testcase we
end up with:
main:
.LFB2:
subq $8, %rsp
.LCFI0:
movl y(%rip), %esi
movl $.LC0, %edi
xorl %eax, %eax
addl $5, %esi
movl %esi, y(%rip)
call printf
xorl %eax, %eax
addq $8, %rsp
.LCFI1:
ret
.LFE2:
While GCC might be able to recognize that main is not reentrant and thus
computing the static variable is useless, this is bit tricky to do.
Honza
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-11-12 13:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-05 14:03 [Bug lto/41589] New: lto does not eliminate unused variables andi-gcc at firstfloor dot org
2009-10-05 14:04 ` [Bug lto/41589] " andi-gcc at firstfloor dot org
2009-10-05 14:04 ` andi-gcc at firstfloor dot org
2009-10-05 14:05 ` andi-gcc at firstfloor dot org
2009-10-05 14:20 ` [Bug tree-optimization/41589] " rguenth at gcc dot gnu dot org
2009-10-05 15:17 ` pinskia at gcc dot gnu dot org
2009-10-05 15:42 ` andi-gcc at firstfloor dot org
2009-10-05 17:07 ` pinskia at gcc dot gnu dot org
2009-11-12 13:23 ` hubicka at gcc dot gnu dot 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).