public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/23451] New: [3.4 4.0 regression] Redundant reloading from stack frame
@ 2005-08-18  7:25 debian-gcc at lists dot debian dot org
  2005-08-18 12:06 ` [Bug target/23451] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2005-08-18  7:25 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/301746]

  Matthias

Rechecked with gcc-4.0, bug submitter writes:

This is a regression from gcc-3.2 in that gcc-3.2 does not have this
problem bug gcc-3.3 does.

The attached program generates the following code on i386 with
gcc -S -O2:

...

.L2:
	movl	-16(%ebp), %eax
	xorl	%esi, %esi
	testl	%eax, %eax
	je	.L8

As you can see %eax now contains the value in -16(%ebp).

	subl	$12, %esp
	movl	-16(%ebp), %eax

gcc-3.4 decides to reload for no reason at all.

	pushl	%eax
	call	strlen
	movl	%eax, %esi
	addl	$16, %esp
.L5:
	pushl	%eax
	pushl	%edi
	pushl	%ebx
	leal	2(%edi,%esi), %eax
	pushl	%eax
	call	malloc
	movl	%eax, (%esp)
	movl	%eax, %ebx
	call	mempcpy
	movl	-16(%ebp), %edi

Again the value of -16(%ebp) is in %edi.

	addl	$16, %esp
	testl	%edi, %edi
	je	.L6
	movb	$61, (%eax)
	pushl	%ecx
	pushl	%esi
	movl	-16(%ebp), %edx

gcc-3.4 decides to reload it yet again.

	pushl	%edx
	incl	%eax
	pushl	%eax
	call	mempcpy
	addl	$16, %esp


-----------------------------------------------

typedef unsigned int size_t;
extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
extern char *strchrnul (__const char *__s, int __c) __attribute__ ((__pure__));
extern void *mempcpy (void *__restrict __dest,
        __const void *__restrict __src, size_t __n) ;
extern void *malloc(size_t);

extern void setvareq(char *s, int flags);
extern char *endofname(const char *);
extern void sh_error(const char *, ...) __attribute__ ((__noreturn__));

void
setvar(const char *name, const char *val, int flags)
{
 char *p, *q;
 size_t namelen;
 char *nameeq;
 size_t vallen;

 q = endofname(name);
 p = strchrnul(q, '=');
 namelen = p - name;
 if (!namelen || p != q)
  sh_error("%.*s: bad variable name", namelen, name);
 vallen = 0;
 if (val == ((void *)0)) {
  flags |= 2;
 } else {
  vallen = strlen(val);
 }
 p = mempcpy(nameeq = malloc(namelen + vallen + 2), name, namelen);
 if (val) {
  *p++ = '=';
  p = mempcpy(p, val, vallen);
 }
 *p = '\0';
 setvareq(nameeq, flags | 1);
}

-- 
           Summary: [3.4 4.0 regression] Redundant reloading from stack
                    frame
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org,herbert at gondor dot
                    apana dot org dot au
GCC target triplet: i486-linux


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


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

* [Bug target/23451] [3.4/4.0/4.1 regression] Redundant reloading from stack frame
  2005-08-18  7:25 [Bug target/23451] New: [3.4 4.0 regression] Redundant reloading from stack frame debian-gcc at lists dot debian dot org
@ 2005-08-18 12:06 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:17 ` mmitchel at gcc dot gnu dot org
  2005-09-29  3:39 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 12:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-18 12:01 -------
I think this is just a ra issue which have no hope of being fixed in a release branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization, ra
            Summary|[3.4 4.0 regression]        |[3.4/4.0/4.1 regression]
                   |Redundant reloading from    |Redundant reloading from
                   |stack frame                 |stack frame
   Target Milestone|---                         |4.0.2


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


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

* [Bug target/23451] [3.4/4.0/4.1 regression] Redundant reloading from stack frame
  2005-08-18  7:25 [Bug target/23451] New: [3.4 4.0 regression] Redundant reloading from stack frame debian-gcc at lists dot debian dot org
  2005-08-18 12:06 ` [Bug target/23451] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-09-27 16:17 ` mmitchel at gcc dot gnu dot org
  2005-09-29  3:39 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:17 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug target/23451] [3.4/4.0/4.1 regression] Redundant reloading from stack frame
  2005-08-18  7:25 [Bug target/23451] New: [3.4 4.0 regression] Redundant reloading from stack frame debian-gcc at lists dot debian dot org
  2005-08-18 12:06 ` [Bug target/23451] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
  2005-09-27 16:17 ` mmitchel at gcc dot gnu dot org
@ 2005-09-29  3:39 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-29  3:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|i486-linux                  |i486-*-*


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


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

end of thread, other threads:[~2005-09-29  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-18  7:25 [Bug target/23451] New: [3.4 4.0 regression] Redundant reloading from stack frame debian-gcc at lists dot debian dot org
2005-08-18 12:06 ` [Bug target/23451] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
2005-09-27 16:17 ` mmitchel at gcc dot gnu dot org
2005-09-29  3:39 ` pinskia 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).