This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/29978] New: suboptimal code generation
- From: "vda dot linux at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Nov 2006 18:22:00 -0000
- Subject: [Bug rtl-optimization/29978] New: suboptimal code generation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
With following testcase gcc 4.1.1 with -Os produces two back-to-back jumps:
"jump to L2 if less; jump to L2 if less-or-equal;" the first one is not needed.
-O2 is worse, but I usually use -Os anyway.
void g();
void f(long long v) {
if (v > 0777777777777LL)
g();
g();
}
/* gcc -v:
Target: i386-pc-linux-gnu
[skip]
Thread model: posix
gcc version 4.1.1
================
gcc -Os -fomit-frame-pointer -S tar.c
f:
cmpl $15, 8(%esp)
jl .L2 // not needed
jle .L2
call g
.L2:
jmp g
================
gcc -O2 -fomit-frame-pointer -S tar.c
f:
subl $12, %esp // not needed
cmpl $15, 20(%esp)
jl .L2 // not needed
jle .L2
call g
.p2align 2,,3
.L2:
addl $12, %esp // not needed
jmp g
*/
--
Summary: suboptimal code generation
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vda dot linux at googlemail dot com
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29978