public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hartmut dot schirmer at arcormail dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/43965] New: doubled code (x86) Date: Mon, 03 May 2010 05:45:00 -0000 [thread overview] Message-ID: <bug-43965-19113@http.gcc.gnu.org/bugzilla/> (raw) On this test case --- struct Vector { int size( void ) const { return mSize ? *mSize : 0 ; } int* mSize; }; int diff(const Vector& a, const Vector& b) { if (a.size() != b.size()) { return a.size() - b.size(); } return 0; } --- gcc omits the following code: __Z4diffRK6VectorS1_: pushl %ebp # movl %esp, %ebp #, pushl %esi # xorl %esi, %esi # D.2130 pushl %ebx # movl 8(%ebp), %eax # a, a movl (%eax), %ecx # a_2(D)->mSize, D.2131 testl %ecx, %ecx # D.2131 je L2 #, movl (%ecx), %esi #* D.2131, D.2130 L2: movl 12(%ebp), %eax # b, b xorl %ebx, %ebx # D.2134 movl (%eax), %edx # b_4(D)->mSize, D.2135 testl %edx, %edx # D.2135 je L3 #, movl (%edx), %ebx #* D.2135, D.2134 L3: xorl %eax, %eax # D.2116 cmpl %ebx, %esi # D.2134, D.2130 je L4 #, testl %ecx, %ecx # D.2131 je L5 #, movl (%ecx), %eax #* D.2131, D.2138 L5: xorl %ecx, %ecx # D.2142 testl %edx, %edx # D.2135 je L6 #, movl (%edx), %ecx #* D.2135, D.2142 L6: subl %ecx, %eax # D.2142, D.2116 L4: popl %ebx # popl %esi # popl %ebp # ret Basicly code following the cmpl after L3 up to L6 is needless, subl could operate on same values as cmpl did # GNU C++ (GCC) version 4.5.0 (mingw32) # compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.1, MPC version 0.8.1 # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 # options passed: -fpreprocessed yy4.ii -march=atom -O2 -fverbose-asm -- Summary: doubled code (x86) Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hartmut dot schirmer at arcormail dot de GCC build triplet: i686-pc-mingw32 GCC host triplet: i686-pc-mingw32 GCC target triplet: i686-pc-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43965
next reply other threads:[~2010-05-03 5:45 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-05-03 5:45 hartmut dot schirmer at arcormail dot de [this message] 2010-05-03 5:46 ` [Bug c++/43965] " hartmut dot schirmer at arcormail dot de 2010-05-03 9:56 ` [Bug tree-optimization/43965] Missed VRP and/or jump-threading rguenth at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-43965-19113@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).