public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fb.programming at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/51041] New: g++ strange optimisation behaviour
Date: Tue, 08 Nov 2011 22:21:00 -0000	[thread overview]
Message-ID: <bug-51041-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 51041
           Summary: g++ strange optimisation behaviour
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fb.programming@gmail.com


The attached code repeatedly executes a vector * vector product to test the
performance of the system. Compiled with

 g++ -Wall -O2 file.cpp

it results in a performance of about 1.7 Gflops on an Intel i5-750, ie
the output is

 adding:          0.059 s, 1.695 GFlops, sum=0.000000

However, when adding another printf (remove the comment in front of the
last printf) the performance deteriorates strongly (same compiler
options):

 adding:          0.195 s, 0.512 GFlops, sum=0.000000
 sum=0.000000

It seems the last printf confuses the compiler optimisation completely,
although it shouldn't make a difference at all, as the same variable
is already printed a few lines above.

This is worrying as it seems the compiler fails to fully optimise the
code under odd circumstances. I've used compiler version 4.6.2 as well as
4.4.1 which is the default compiler on the system.


$ gcc-4.6.2 --version
gcc-4.6.2 (GCC) 4.6.2

$ gcc --version
gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]

$ uname -a
Linux localhost 2.6.31.14-0.8-desktop #1 SMP PREEMPT 2011-04-06 18:09:24 +0200
x86_64 x86_64 x86_64 GNU/Linux


             reply	other threads:[~2011-11-08 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 22:21 fb.programming at gmail dot com [this message]
2011-11-08 22:23 ` [Bug other/51041] " fb.programming at gmail dot com
2011-11-08 22:31 ` [Bug rtl-optimization/51041] " pinskia at gcc dot gnu.org
2023-07-07 15:13 ` [Bug rtl-optimization/51041] register allocation of SSE register in loop with across eh edges vmakarov at gcc dot gnu.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-51041-4@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: link
Be 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).