public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/44194]  New: struct returned by value generates useless stores
@ 2010-05-19  5:06 jhaberman at gmail dot com
  2010-05-19  9:39 ` [Bug rtl-optimization/44194] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 52+ messages in thread
From: jhaberman at gmail dot com @ 2010-05-19  5:06 UTC (permalink / raw)
  To: gcc-bugs

Test case:

--

#include <stdint.h>

struct twoints { uint64_t a, b; } foo();
void bar(uint64_t a, uint64_t b);

void func() {
  struct twoints s = foo();
  bar(s.a, s.b);
}

--

$ gcc -save-temps -Wall -c -o testbad.o -msse2 -O3 -fomit-frame-pointer
testbad.c 
$ objdump -d -r -M intel testbad.o

testbad.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <func>:
   0:   48 83 ec 28             sub    rsp,0x28
   4:   31 c0                   xor    eax,eax
   6:   e8 00 00 00 00          call   b <func+0xb>
                        7: R_X86_64_PC32        foo-0x4
   b:   48 89 04 24             mov    QWORD PTR [rsp],rax
   f:   48 89 54 24 08          mov    QWORD PTR [rsp+0x8],rdx
  14:   48 89 d6                mov    rsi,rdx
  17:   48 89 44 24 10          mov    QWORD PTR [rsp+0x10],rax
  1c:   48 89 54 24 18          mov    QWORD PTR [rsp+0x18],rdx
  21:   48 89 c7                mov    rdi,rax
  24:   48 83 c4 28             add    rsp,0x28
  28:   e9 00 00 00 00          jmp    2d <func+0x2d>
                        29: R_X86_64_PC32       bar-0x4

--

As you can see above, rax and rdx are stored to the stack twice, but these
stores are unnecessary.

$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)


-- 
           Summary: struct returned by value generates useless stores
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jhaberman at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


^ permalink raw reply	[flat|nested] 52+ messages in thread
[parent not found: <bug-44194-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-11-02  0:29 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19  5:06 [Bug rtl-optimization/44194] New: struct returned by value generates useless stores jhaberman at gmail dot com
2010-05-19  9:39 ` [Bug rtl-optimization/44194] " rguenth at gcc dot gnu dot org
2010-05-19 10:14 ` jakub at gcc dot gnu dot org
2010-05-19 10:22 ` rguenth at gcc dot gnu dot org
2010-07-10  1:38 ` jhaberman at gmail dot com
2010-07-10  1:40 ` pinskia at gcc dot gnu dot org
2010-07-10  1:42 ` pinskia at gcc dot gnu dot org
2010-07-10  1:48 ` jhaberman at gmail dot com
     [not found] <bug-44194-4@http.gcc.gnu.org/bugzilla/>
2011-02-24  5:10 ` jhaberman at gmail dot com
2011-04-12 22:39 ` eraman at google dot com
2011-04-14 18:59 ` eraman at google dot com
2011-04-14 22:22 ` ebotcazou at gcc dot gnu.org
2011-04-15  9:10 ` rguenth at gcc dot gnu.org
2011-04-15 19:19 ` eraman at google dot com
2011-04-15 19:34 ` rguenther at suse dot de
2011-04-15 22:27 ` eraman at google dot com
2011-04-17 10:47 ` rguenther at suse dot de
2011-04-21  0:22 ` eraman at google dot com
2011-04-21  8:37 ` rguenther at suse dot de
2011-06-14 22:59 ` eraman at gcc dot gnu.org
2011-06-15 16:50 ` ebotcazou at gcc dot gnu.org
2011-06-15 20:35 ` eraman at google dot com
2011-06-15 21:11 ` ebotcazou at gcc dot gnu.org
2011-06-15 23:17 ` xinliangli at gmail dot com
2011-06-16  5:27 ` ebotcazou at gcc dot gnu.org
2011-06-16  7:43 ` xinliangli at gmail dot com
2011-06-16  8:37 ` rguenther at suse dot de
2011-06-16 17:16 ` eraman at google dot com
2011-06-17  8:22 ` rguenther at suse dot de
2011-06-18  9:06 ` xinliangli at gmail dot com
2011-06-18  9:29 ` ebotcazou at gcc dot gnu.org
2011-06-18 16:34 ` xinliangli at gmail dot com
2011-06-20  9:22 ` rguenther at suse dot de
2011-06-20 15:28 ` ebotcazou at gcc dot gnu.org
2011-06-20 16:27 ` xinliangli at gmail dot com
2011-06-20 16:52 ` eraman at google dot com
2011-06-22  7:58 ` ebotcazou at gcc dot gnu.org
2011-07-07 14:58 ` ebotcazou at gcc dot gnu.org
2011-12-05 17:49 ` ebotcazou at gcc dot gnu.org
2012-03-22  9:10 ` rguenth at gcc dot gnu.org
2012-03-22 17:13 ` ubizjak at gmail dot com
2012-03-22 18:35 ` ebotcazou at gcc dot gnu.org
2012-07-02 14:04 ` rguenth at gcc dot gnu.org
2012-08-06  1:23 ` chip at pobox dot com
2012-09-12 22:31 ` ebotcazou at gcc dot gnu.org
2012-09-12 23:22 ` chip at pobox dot com
2012-09-13  0:00 ` ebotcazou at gcc dot gnu.org
2012-09-14 13:30 ` ebotcazou at gcc dot gnu.org
2012-09-14 13:38 ` ebotcazou at gcc dot gnu.org
2012-09-14 17:24 ` chip at pobox dot com
2012-10-21 12:36 ` ebotcazou at gcc dot gnu.org
2012-11-02  0:29 ` eraman 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).