This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42586] load-modify-store on x86 should be a single instruction
- From: "andi-gcc at firstfloor dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jan 2010 13:18:59 -0000
- Subject: [Bug tree-optimization/42586] load-modify-store on x86 should be a single instruction
- References: <bug-42586-7834@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #19 from andi-gcc at firstfloor dot org 2010-01-03 13:18 -------
Here's another example with the bogus stack frame problem with a tail call
(the embarassing website has quite a lot of similar cases, normally
near the tail of the tables with 16 vs 22 bytes e.g. against sun cc
which also does tail optimization):
typedef long __clock_t;
typedef __clock_t clock_t;
struct lprofS_sSTACK_RECORD;
typedef struct lprofS_sSTACK_RECORD lprofS_STACK_RECORD;
struct lprofS_sSTACK_RECORD
{
clock_t time_marker_function_local_time;
clock_t time_marker_function_total_time;
char *file_defined;
char *function_name;
char *source_code;
long line_defined;
long current_line;
float local_time;
float total_time;
lprofS_STACK_RECORD *next;
};
typedef lprofS_STACK_RECORD *lprofS_STACK;
struct lprofP_sSTATE;
typedef struct lprofP_sSTATE lprofP_STATE;
struct lprofP_sSTATE
{
int stack_level;
lprofS_STACK stack_top;
};
extern void lprofC_start_timer (clock_t * time_marker);
void lprofM_resume_local_time (lprofP_STATE * S);
void
lprofM_resume_local_time (lprofP_STATE * S)
{
{
lprofC_start_timer (&(S->stack_top)->time_marker_function_local_time);
return;
}
}
gives with -m32 -fomit-frame-pointer -O2 and 4.5.0 20091219
subl $12, %esp
movl 16(%esp), %eax
movl 4(%eax), %eax
movl %eax, 16(%esp)
addl $12, %esp
jmp lprofC_start_timer
The subl/addl are completely unnecessary
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42586