First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 36598
Product:  
Component:  
Status: NEW
Resolution:
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 36598 depends on: 14295 Show dependency tree
Show dependency graph
Bug 36598 blocks:

Additional Comments:





Mark bug as waiting for feedback
Mark bug as suspended




View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2009-02-20 19:49 Opened: 2008-06-22 13:26
Testcase gcc.dg/memcpy-1.c fails on AVR target.

Failure occurs because the return value is not simplified to avoid memcpy. This
test works on i686 and I can't see why same optimization should not apply to
AVR

Test is:

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
struct a {int a,b,c;} a;
int test(struct a a)
{
struct a nasty_local;
__builtin_memcpy (&nasty_local,&a, sizeof(a));
return nasty_local.a;
}

On i686 we get:

;; Function test (test)

Analyzing Edge Insertions.
test (struct a a)
{
<bb 2>:
  return a.a;

}


BUT on AVR we get:


;; Function test (test)

Analyzing Edge Insertions.
test (struct a a)
{
  struct a nasty_local;

<bb 2>:
  nasty_local = a;
  return nasty_local.a;

}

I have confirmed the final AVR code is suboptimal.

------- Comment #1 From joseph@codesourcery.com 2008-06-22 13:32 -------
Subject: Re:   New: Failed optimisation of return of struct
 argment in memcpy-1.c

On Sun, 22 Jun 2008, hutchinsonandy at gcc dot gnu dot org wrote:

> Testcase gcc.dg/memcpy-1.c fails on AVR target.

Have you looked at bug 31677 which suggests using the option "--param 
sra-max-structure-size=32"?  If that works for AVR, you could submit a 
patch to add it to the testcase for all targets.

------- Comment #2 From Andy Hutchinson 2008-06-22 14:33 -------
Thanks for information

--param sra-max-structure-size=32 does indeed remove test failure and produces
optimal code.

But changing the testcase does not remove the optimization problem - unless
sra-max-structure-size was always used. So there is problem somewhere else to
fix.

See also:

http://gcc.gnu.org/ml/gcc-patches/2007-12/msg01144.html

Andy

------- Comment #3 From Richard Guenther 2008-06-22 14:50 -------
This is really not a task for SRA but for struct copy propagation (which we
do not do).  See PR14295.

As this testcase was for SRA you can either XFAIL it for avr or see if the
cost metrics need adjustment.

------- Comment #4 From Andy Hutchinson 2008-06-22 16:11 -------
Quite possibly due to cost metrics. They are far from ideal.

Will mark test XFAIL until we can investigate and fix.

------- Comment #5 From Andy Hutchinson 2008-06-30 22:39 -------
Subject: Bug 36598

Author: hutchinsonandy
Date: Mon Jun 30 22:38:34 2008
New Revision: 137298

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137298
Log:
PR target/36598
* gcc.dg/memcpy-1.c: Mark test XFAIL for avr target.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/memcpy-1.c

------- Comment #6 From John David Anglin 2009-02-20 18:05 -------
*** Bug 39245 has been marked as a duplicate of this bug. ***

------- Comment #7 From John David Anglin 2009-02-20 18:08 -------
Test also fails on powerpc64 with -m32, arm.

------- Comment #8 From Uros Bizjak 2009-02-20 19:49 -------
(In reply to comment #7)
> Test also fails on powerpc64 with -m32, arm.

And sh4.

http://gcc.gnu.org/ml/gcc-testresults/2009-02/msg01952.html

First Last Prev Next    No search results available      Search page      Enter new bug