public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/41455]  New: memcpy not tail called if it's a struct assignment
@ 2009-09-24  3:29 TabonyEE at austin dot rr dot com
  2009-09-24  6:29 ` [Bug rtl-optimization/41455] " ramana at gcc dot gnu dot org
  2009-12-14  9:56 ` ramana at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: TabonyEE at austin dot rr dot com @ 2009-09-24  3:29 UTC (permalink / raw)
  To: gcc-bugs

For the following code,

typedef struct {
  char c[11111];
} s;

void f(s *a, s *b){
  *a = *b;
}

compiling for ARM, with -Os, mainline GCC generates the following:

        str     lr, [sp, #-4]!
        ldr     r2, .L2
        bl      memcpy
        ldr     pc, [sp], #4
.L3:
        .align  2
.L2:
        .word   11112

GCC 3.4.6 generates a tail call:

        ldr     r2, .L2
        @ lr needed for prologue
        b       memcpy
.L3:
        .align  2
.L2:
        .word   11112

The first release of GCC to regress in this way was 4.0.0.

Here is a backtrace from emit_block_move_hints.

#0  emit_block_move_hints (x=0x2ba56160cae0, y=0x2ba56160cb20,
size=0x2ba5615cedc0, method=BLOCK_OP_NORMAL, expected_align=0,
expected_size=-1)
    at ../../gcc/expr.c:1163
#1  0x0000000000656f33 in emit_block_move (x=0x2ba56160cae0, y=0x2ba56160cb20,
size=0x2ba5615cedc0, method=BLOCK_OP_NORMAL) at ../../gcc/expr.c:1233
#2  0x000000000066076d in store_expr (exp=0x2ba5610fa0c0,
target=0x2ba56160cae0, call_param_p=0, nontemporal=0 '\0') at
../../gcc/expr.c:4779
#3  0x000000000065ee57 in expand_assignment (to=0x2ba5610fa080,
from=0x2ba5610fa0c0, nontemporal=0 '\0') at ../../gcc/expr.c:4428

Is there any way store_expr() could pass BLOCK_OP_TAILCALL to
emit_block_move()?  If not, then can this be transformed into a tail call
later?


-- 
           Summary: memcpy not tail called if it's a struct assignment
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: TabonyEE at austin dot rr dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: arm-elf


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


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

* [Bug rtl-optimization/41455] memcpy not tail called if it's a struct assignment
  2009-09-24  3:29 [Bug rtl-optimization/41455] New: memcpy not tail called if it's a struct assignment TabonyEE at austin dot rr dot com
@ 2009-09-24  6:29 ` ramana at gcc dot gnu dot org
  2009-12-14  9:56 ` ramana at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu dot org @ 2009-09-24  6:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ramana at gcc dot gnu dot org  2009-09-24 06:29 -------
Confirmed with trunk

Because Tail calling is now done at the tree level. I remember me or someone
fixing this by detecting block moves in tree-tail-call.c and then set up the
flags accordingly. IIRC the same problem applied to builtins earlier.

Let me take a look.


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-09-24 06:29:30
               date|                            |


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


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

* [Bug rtl-optimization/41455] memcpy not tail called if it's a struct assignment
  2009-09-24  3:29 [Bug rtl-optimization/41455] New: memcpy not tail called if it's a struct assignment TabonyEE at austin dot rr dot com
  2009-09-24  6:29 ` [Bug rtl-optimization/41455] " ramana at gcc dot gnu dot org
@ 2009-12-14  9:56 ` ramana at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu dot org @ 2009-12-14  9:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug rtl-optimization/41455] memcpy not tail called if it's a struct assignment
       [not found] <bug-41455-4@http.gcc.gnu.org/bugzilla/>
@ 2012-06-06 10:29 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-06 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|arm-elf                     |arm-elf, x86_64-*-*
   Last reconfirmed|2009-09-24 06:29:30         |2012-06-06 6:29:30

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-06 10:29:39 UTC ---
Re-confirmed.  Can be reproduced on x86_64 with -Os -mstringop-strategy=libcall


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

end of thread, other threads:[~2012-06-06 10:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-24  3:29 [Bug rtl-optimization/41455] New: memcpy not tail called if it's a struct assignment TabonyEE at austin dot rr dot com
2009-09-24  6:29 ` [Bug rtl-optimization/41455] " ramana at gcc dot gnu dot org
2009-12-14  9:56 ` ramana at gcc dot gnu dot org
     [not found] <bug-41455-4@http.gcc.gnu.org/bugzilla/>
2012-06-06 10:29 ` rguenth at gcc dot gnu.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).