[Bug c/54896] New: Some optimization slowness with GCC 4.7.2

2012-10-10 Thread tammy at Cadence dot COM


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



 Bug #: 54896

   Summary: Some optimization slowness with GCC 4.7.2

Classification: Unclassified

   Product: gcc

   Version: 4.7.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ta...@cadence.com





We have some code which consist from switch with many cases and non-random

memory writes. Look like there is nothing to optimize at all, but compiling

optimized version takes long time.



Attach is the code to generate source code to reproduce this problem,

generate_bigdata.c.





$ gcc generate_bigdata.c  

$ ./a.out 

  (This step will generate the testcase, BigData.c.)

$ time /gcc-4.7.2/bin/gcc -m32 BigData.c -c -o BigData.o

1.504u 0.077s 0:01.61 97.5% 0+0k 320+10024io 0pf+0w

$ time /gcc-4.7.2/bin/gcc -m32 -O1 BigData.c -c -o BigData.o

50.438u 0.191s 0:50.67 99.9%0+0k 256+10024io 0pf+0w

$ time /gcc-4.7.2/bin/gcc -m32 -O4 BigData.c -c -o BigData.o

111.710u 3.977s 1:55.73 99.9%   0+0k 1024+9384io 0pf+0w



We tried with gcc44, the optimization takes long also but not as bad as 472.



Sure, code refactoring is best solution and disabling optimization for

particular file is good enough, but will be good idea to improve GCC too.


[Bug c/54896] Some optimization slowness with GCC 4.7.2

2012-10-10 Thread tammy at Cadence dot COM


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



--- Comment #2 from Tammy Hsu  2012-10-10 22:09:04 
UTC ---

Created attachment 28416

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28416

This can be used to generate BigData.c


[Bug c++/58208] New: deque 32-bit "-O3" bug

2013-08-20 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

Bug ID: 58208
   Summary: deque 32-bit "-O3" bug
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tammy at Cadence dot COM

The following testcase works with gcc473, but crash with gcc481:
$ cat main.C
int main () {}

$ cat qt.C
#include 
#include 

std::deque l1;

$ cat build.orig
#!/bin/csh -fex

set GCCVER = /home/tammy/gcc481
setenv CXXFLAGS "-fpic -m32 -std=c++11 -O3"

rm -f libqt.so import main.o

${GCCVER}/bin/g++ -c $CXXFLAGS qt.C
${GCCVER}/bin/g++ -m32 -shared -o libqt.so qt.o
${GCCVER}/bin/g++ -c $CXXFLAGS main.C
${GCCVER}/bin/g++ -o import main.o -Wl,-rpath,${GCCVER}/lib -m32 -L. -lqt

$ ./build.orig
set GCCVER = /home/tammy/gcc481
setenv CXXFLAGS -fpic -m32 -std=c++11 -O3
rm -f libqt.so import main.o
/home/tammy/gcc481/bin/g++ -c -fpic -m32 -std=c++11 -O3 qt.C
/home/tammy/gcc481/bin/g++ -m32 -shared -o libqt.so qt.o
/home/tammy/gcc481/bin/g++ -c -fpic -m32 -std=c++11 -O3 main.C
/home/tammy/gcc481/bin/g++ -o import main.o -Wl,-rpath,/home/tammy/gcc481/lib
-m32 -L. -lqt
$ ./import
Segmentation fault
$ 

The 64-bit version works. If I change "-O3" to "-O2" or "-O3
-fno-tree-vectorize", it works also.


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-23 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

Tammy Hsu  changed:

   What|Removed |Added

   Severity|normal  |major

--- Comment #2 from Tammy Hsu  ---
Can you assign someone to take a look this issue?


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-24 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #4 from Tammy Hsu  ---
Sorry, I forgot to mention that I need to set LD_LIBRARY_PATH to "." to run
import.
I build the gcc473 and gcc481 by using the same configuration and on the same
RHEL 5.5 system, however the gcc473 version works and gcc481 with -m32
crash

May I know how you configure your gcc481 or if you have added any extra bug
fixes?


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-25 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #8 from Tammy Hsu  ---
Thanks a lot for trying rebuilding twice!!
you don't think it is caused by optimization code? if we use "-O2" or "-O3
-fno-tree-vectorize" then it won't seg fault


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-26 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #9 from Tammy Hsu  ---
I tried to run the g++ build on RHEL 5.5 on a RHEL 6.3 system, import seg
fault.

I then tried to rebuild gcc481 on RHEL 6.3 and rerun the testcase, it still
crash.

The glibc on RHEL 6.3 is glibc-2.12-1.80.el6.x86_64 and the kernel is
2.6.32-279.el6.

Also I tried to use the /bin/g++ on fedora 19 (gcc4.8.1). It misses
/usr/include/gnu/stubs.h and fails at compilation.
$ /bin/g++ -c  -fpic -m32 -std=c++11 -O3 qt.C
In file included from /usr/include/features.h:399:0,
 from
/usr/include/c++/4.8.1/x86_64-redhat-linux/32/bits/os_defines.h:39,
 from
/usr/include/c++/4.8.1/x86_64-redhat-linux/32/bits/c++config.h:420,
 from /usr/include/c++/4.8.1/bits/stl_algobase.h:59,
 from /usr/include/c++/4.8.1/deque:60,
 from qt.C:1:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or
directory
 # include 
   ^
compilation terminated.


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-26 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #11 from Tammy Hsu  ---
Thank you. Yes, on the fedora 19 systems, I don't have these 3 i686 rpms
installed. I will add them. 

Do you have any comments on the crash issue we have on CentOS 5.8 or RHEL
5.5/RHEL 6.3 after building gcc481 on them?


[Bug target/58208] deque 32-bit "-O3" bug

2013-08-28 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #12 from Tammy Hsu  ---
I installed the required i686 rpms on the Fedora 19 system, and the testcase
works without crash (using the /bin/g++).

I then built gcc481 on the Fedora 19 system, the testcase also works fine when
I compile/link it with my own build gcc481.

So it may really be a glibc compatibility issue (as Mikael said in comment 7).
>From Mikael and I have done:

Not working if build gcc481 on:
RHEL 5.5 - glibc 2.5
CentOS 5.8 - glibc 2.5 (done by Mikael)
RHEL 6.3 - glibc 2.12

Working if build gcc481 on
Fedora 17 - glibc 2.15 (done by Mikael)
Fedora 19 - glibc-2.17

Also if I use the gcc481 built on RHEL 5.5 or RHEL 6.3, and run on Fedora 19,
the testcase works also. So something changed between gcc4.7.3 and gcc 4.8.1
that causes "-ftree-vectorize" optimization not work well (32bit only) with
older glibc.


[Bug c++/58437] New: Sorting value in reverse order is much slower compare to gcc44

2013-09-16 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

Bug ID: 58437
   Summary: Sorting value in reverse order is much slower compare
to gcc44
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tammy at Cadence dot COM

For the following testcase:

===
#include 
#include 

using namespace std;

int main()
{
const size_t num = 1000;
vector v(num);

generate(v.begin(), v.end(), &rand);
sort(v.begin(), v.end());
sort(v.rbegin(), v.rend());
}
==

If we compile it with "g++ -O3", it takes 1 sec to sort random
values with either gcc445 or gcc481. Gcc445 takes 0.33 sec to sort
value in reverse order, but gcc 4.7/4.8 takes 2 secs.

Is there any way to improve the run-time performance?


[Bug target/58208] deque 32-bit "-O3" bug

2013-09-16 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #13 from Tammy Hsu  ---
Hi Mikael,

My last comment probably is not clear enough. The import (testcase) I built on
RHEL 5.5 crashes on RHEL 5.5, but if I ran it on Fedora 19, it works.

So if you take the import you built on CentOS 5.8 (crashes on CentOS 5.8) to
the Fedora 17 system, I think it will run fine.

May be the above information will give you some hint regarding what's the cause
of this issue?

Thanks, Tammy


[Bug libstdc++/58437] [4.7/4.8/4.9 Regression] Sorting value in reverse order is much slower compare to gcc44

2013-09-17 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

--- Comment #11 from Tammy Hsu  ---
Jeffrey,

It's weird indeed. We are still using gcc445 for our production releases and
are in the process of evaluating gcc481/gcc473. The performance tests show
slowness in some tests

I also don't have gcc45x available in house, so don't know if this bug exists
in gcc45. BTW, it's really nice to know someone else encountered the same
issue.

Tammy


[Bug libstdc++/58437] [4.7/4.8/4.9 Regression] Sorting value in reverse order is much slower compare to gcc44

2013-09-17 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

--- Comment #9 from Tammy Hsu  ---
Marc/Paolo/Chris,

Thanks a lot for your help. It's awesome to see so many activities within hours
after submitting the bug.

Thanks, Tammy


[Bug libstdc++/58437] [4.7/4.8/4.9 Regression] Sorting value in reverse order is much slower compare to gcc44

2013-09-19 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

--- Comment #24 from Tammy Hsu  ---
Yes, it is a question. And thank you for the answer... :-)


[Bug libstdc++/58437] [4.7/4.8/4.9 Regression] Sorting value in reverse order is much slower compare to gcc44

2013-09-19 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

--- Comment #22 from Tammy Hsu  ---
Thanks a lot. We will test it out with our real application.
Just want to do things right, the patch is the one described in Attachment
30861. And I just need to patch the
/include/c++/4.8.1/bits/stl_algo.h, don't need to rebuild gcc481.


[Bug libstdc++/58437] [4.7/4.8/4.9 Regression] Sorting value in reverse order is much slower compare to gcc44

2013-09-23 Thread tammy at Cadence dot COM
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58437

--- Comment #26 from Tammy Hsu  ---
Thanks a lot for the patch. It addresses the issue on the standalone test and
shows also in our real tool test results. With this patch, the major
degradations are gone. Compared to gcc445, there is a slight overall
improvement for this tool now.

Really appreciate all the comments and the creation of a patch in such a short
of time