This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/23756] Missed optimization for PIC code with internal visibility
- From: "christophe dot guillon at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2010 14:55:35 -0000
- Subject: [Bug middle-end/23756] Missed optimization for PIC code with internal visibility
- References: <bug-23756-7904@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from christophe dot guillon at st dot com 2010-01-28 14:55 -------
This enhancement is still pending on gcc 4.4.3 on x86.
A function declared internal sets the GOT pointer while it could be avoided in
a callee-set-GOT model as on x86 ABI.
By defintion an internal function can only be accessed through functions of the
same module and thus, if the ABI forces the GOT pointer to be in ebx - which I
think is the case -, it does not have to be rematerialized.
See the original description also.
Compile the attached internal.c file with:
$ gcc -O3 -S -fpic internal.c
Check the .s file:
.type f, @function
f:
call __i686.get_pc_thunk.cx
addl $_GLOBAL_OFFSET_TABLE_, %ecx
The GOT pointer is materialized in ecx while it is guaranteed to be available
in ebx as soon as f is actually internal.
--
christophe dot guillon at st dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |christophe dot guillon at st
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23756