public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39874] New: [4.4 regression] missing DCE
@ 2009-04-23 19:13 alexvod at google dot com
2009-04-23 19:18 ` [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission) pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: alexvod at google dot com @ 2009-04-23 19:13 UTC (permalink / raw)
To: gcc-bugs
The following code:
void func();
void test(char *signature)
{
char ch = signature[0];
if (ch == 15 || ch == 3)
{
if (ch == 15) func();
}
}
is compiled in suboptimal way by gcc 4.4. Check for ch==3 can be completely
eliminated since func is only called if ch==15. gcc 4.3 is able to properly
infer this and eliminate the unneeded check, but gcc 4.4 fails to do this.
Althouth, found originally on ARM, this bug also reproduces on x86 as well.
gcc 4.3.1 (with -m32 -O2):
test:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $15, %al // %al compared only with 15
jne .L8
popl %ebp
jmp func
.L8:
popl %ebp
ret
gcc 4.4.0:
test:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $15, %al
sete %dl
cmpb $3, %al // compiler was not able to optimize ch==3
je .L4
testb %dl, %dl
jne .L8
.L4:
leave
ret
.p2align 4,,7
.p2align 3
.L8:
leave
.p2align 4,,8
.p2align 3
jmp func
Bisection shows that it was introduced by
http://gcc.gnu.org/viewcvs?view=rev&revision=140288
--
Summary: [4.4 regression] missing DCE
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alexvod at google dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86-unknown-linux-gnu, arm-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission)
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
@ 2009-04-23 19:18 ` pinskia at gcc dot gnu dot org
2009-04-24 9:24 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-23 19:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-23 19:18 -------
Works on powerpc-darwin, where THRUTH_ORIF_EXPR is not converted into
THRUTH_OR_EXPR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission)
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
2009-04-23 19:18 ` [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission) pinskia at gcc dot gnu dot org
@ 2009-04-24 9:24 ` rguenth at gcc dot gnu dot org
2010-05-24 13:08 ` sandra at codesourcery dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-24 9:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-04-24 09:24 -------
*** This bug has been marked as a duplicate of 28685 ***
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission)
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
2009-04-23 19:18 ` [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission) pinskia at gcc dot gnu dot org
2009-04-24 9:24 ` rguenth at gcc dot gnu dot org
@ 2010-05-24 13:08 ` sandra at codesourcery dot com
2010-06-01 2:23 ` sandra at codesourcery dot com
2010-06-08 18:16 ` sandra at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: sandra at codesourcery dot com @ 2010-05-24 13:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from sandra at codesourcery dot com 2010-05-24 13:08 -------
I'm testing a fix for this (better comparison combination logic in the
ifconvert pass).
--
sandra at codesourcery dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandra at codesourcery dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission)
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
` (2 preceding siblings ...)
2010-05-24 13:08 ` sandra at codesourcery dot com
@ 2010-06-01 2:23 ` sandra at codesourcery dot com
2010-06-08 18:16 ` sandra at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: sandra at codesourcery dot com @ 2010-06-01 2:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from sandra at codesourcery dot com 2010-06-01 02:22 -------
Patch posted here:
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00001.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission)
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
` (3 preceding siblings ...)
2010-06-01 2:23 ` sandra at codesourcery dot com
@ 2010-06-08 18:16 ` sandra at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: sandra at gcc dot gnu dot org @ 2010-06-08 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from sandra at gcc dot gnu dot org 2010-06-08 18:16 -------
Subject: Bug 39874
Author: sandra
Date: Tue Jun 8 18:15:53 2010
New Revision: 160445
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160445
Log:
2010-06-08 Sandra Loosemore <sandra@codesourcery.com>
PR tree-optimization/39874
PR middle-end/28685
gcc/
* gimple.h (maybe_fold_and_comparisons, maybe_fold_or_comparisons):
Declare.
* gimple-fold.c (canonicalize_bool, same_bool_comparison_p,
same_bool_result_p): New.
(and_var_with_comparison, and_var_with_comparison_1,
and_comparisons_1, and_comparisons, maybe_fold_and_comparisons): New.
(or_var_with_comparison, or_var_with_comparison_1,
or_comparisons_1, or_comparisons, maybe_fold_or_comparisons): New.
* tree-ssa-reassoc.c (eliminate_redundant_comparison): Use
maybe_fold_and_comparisons or maybe_fold_or_comparisons instead
of combine_comparisons.
* tree-ssa-ifcombine.c (ifcombine_ifandif, ifcombine_iforif): Likewise.
gcc/testsuite/
* gcc.dg/pr39874.c: New file.
Added:
trunk/gcc/testsuite/gcc.dg/pr39874.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-fold.c
trunk/gcc/gimple.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-ifcombine.c
trunk/gcc/tree-ssa-reassoc.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39874
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-06-08 18:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 19:13 [Bug tree-optimization/39874] New: [4.4 regression] missing DCE alexvod at google dot com
2009-04-23 19:18 ` [Bug tree-optimization/39874] [4.4 regression] missing VRP (submission) pinskia at gcc dot gnu dot org
2009-04-24 9:24 ` rguenth at gcc dot gnu dot org
2010-05-24 13:08 ` sandra at codesourcery dot com
2010-06-01 2:23 ` sandra at codesourcery dot com
2010-06-08 18:16 ` sandra at gcc dot gnu dot org
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).