This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/8776] loop invariants are not removed (most likely)
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Dec 2003 03:56:02 -0000
- Subject: [Bug optimization/8776] loop invariants are not removed (most likely)
- References: <20021201152600.8776.lomov1@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-28 03:56 -------
Here is the difference in the code:
--- temp.s Sat Dec 27 22:51:13 2003
+++ temp1.s Sat Dec 27 22:51:04 2003
@@ -5,21 +5,20 @@
.type main, @function
main:
pushl %ebp
- xorl %edx, %edx
+ movl $999999999, %eax
movl %esp, %ebp
subl $40, %esp
- leal -32(%ebp), %ecx
- movl $0, -16(%ebp)
+ leal -32(%ebp), %edx
andl $-16, %esp
- movl $0, -20(%ebp)
+ movl $0, -16(%ebp)
subl $16, %esp
+ movl $0, -20(%ebp)
movl $0, -24(%ebp)
- movl $999999999, %eax
.p2align 4,,15
.L5:
- movl $0, (%ecx,%edx,8)
+ movl $0, (%edx)
decl %eax
- movl $1072693248, 4(%ecx,%edx,8)
+ movl $1072693248, 4(%edx)
jns .L5
leave
xorl %eax, %eax
The main difference is the use of (%ecx,%edx,8) vs (%edx)
But this does not produce any difference in performance (at least on pentium 4 or
pentium 3):
tin:~/src/gnu/gcctest>time ./a.out
2.010u 0.000s 0:02.01 100.0% 0+0k 0+0io 69pf+0w
tin:~/src/gnu/gcctest>gcc -std=c99 -O3 pr8776.c -DSLOW2
tin:~/src/gnu/gcctest>!tim
time ./a.out
2.010u 0.000s 0:02.01 100.0% 0+0k 0+0io 69pf+0w
tin:~/src/gnu/gcctest>gcc -std=c99 -O3 pr8776.c -DSLOW1
tin:~/src/gnu/gcctest>!time
time ./a.out
2.010u 0.000s 0:02.01 100.0% 0+0k 0+0io 69pf+0w
So this is fixed on the mainline and 3.3.3.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Summary|[3.4 Regression] loop |loop invariants are not
|invariants are not removed |removed (most likely)
|(most likely) |
Target Milestone|3.4.0 |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8776