public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/33315] New: If condition not getting eliminated
@ 2007-09-05 18:53 pranav dot bhandarkar at gmail dot com
2007-09-05 19:03 ` [Bug middle-end/33315] " pranav dot bhandarkar at gmail dot com
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-09-05 18:53 UTC (permalink / raw)
To: gcc-bugs
if ( x == 8 ) statement1
if ( x != 8 ) statement1
if ( x == 9 ) statement2
if ( x != 9 ) statement2
should be replaced by
statement1
statement2
However this doesnt happen and compare and jumps do get generated.
--
Summary: If condition not getting eliminated
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pranav dot bhandarkar at gmail dot com
GCC target triplet: arm-none-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
@ 2007-09-05 19:03 ` pranav dot bhandarkar at gmail dot com
2007-09-05 20:34 ` [Bug middle-end/33315] [4.3 Regression] " rguenth at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-09-05 19:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pranav dot bhandarkar at gmail dot com 2007-09-05 19:03 -------
Created an attachment (id=14158)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14158&action=view)
Sample Testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] [4.3 Regression] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
2007-09-05 19:03 ` [Bug middle-end/33315] " pranav dot bhandarkar at gmail dot com
@ 2007-09-05 20:34 ` rguenth at gcc dot gnu dot org
2007-10-10 17:53 ` mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-05 20:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2007-09-05 20:34 -------
This is related to PR32306 and to the fact that we don't have a code hoisting
pass. And related to PR30905 because cross-jumping fixes this up on the
rtl-level for both gcc 4.1 and 4.2:
test:
pushl %ebp
movl %esp, %ebp
popl %ebp
movl $0, a
movl $0, a+4
movl $0, a+8
ret
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |spark at gcc dot gnu dot org
BugsThisDependsOn| |30905
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2007-09-05 20:34:09
date| |
Summary|If condition not getting |[4.3 Regression] If
|eliminated |condition not getting
| |eliminated
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] [4.3 Regression] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
2007-09-05 19:03 ` [Bug middle-end/33315] " pranav dot bhandarkar at gmail dot com
2007-09-05 20:34 ` [Bug middle-end/33315] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2007-10-10 17:53 ` mmitchel at gcc dot gnu dot org
2007-11-10 0:27 ` [Bug middle-end/33315] " steven at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-10 17:53 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
` (2 preceding siblings ...)
2007-10-10 17:53 ` mmitchel at gcc dot gnu dot org
@ 2007-11-10 0:27 ` steven at gcc dot gnu dot org
2007-11-23 10:57 ` j at uriah dot heep dot sax dot de
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-11-10 0:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from steven at gcc dot gnu dot org 2007-11-10 00:27 -------
As a missed optimization, this bug adds new information. But as a regression,
this is a dup of bug 30905.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.3 Regression] If |If condition not getting
|condition not getting |eliminated
|eliminated |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
` (3 preceding siblings ...)
2007-11-10 0:27 ` [Bug middle-end/33315] " steven at gcc dot gnu dot org
@ 2007-11-23 10:57 ` j at uriah dot heep dot sax dot de
2008-03-14 17:02 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: j at uriah dot heep dot sax dot de @ 2007-11-23 10:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from j at uriah dot heep dot sax dot de 2007-11-23 10:57 -------
Is the missed optimization in the following code the same?
volatile unsigned char *reg_a = (unsigned char *)42;
volatile unsigned char *reg_b = (unsigned char *)34;
extern void a(void);
extern void b(void);
extern void c(void);
void
decide(void)
{
signed char diff;
diff = *reg_a - *reg_b;
if (diff < 0)
a();
else if (diff == 0)
b();
else if (diff > 0)
c();
}
The third "if" statement is partially executed: it apparently remembered
that diff could not be less than 0, but it still tests against 0 even
though that test has just been done before. Verified on both, the AVR
and i386 target.
Interestingly, by just reordering the code, the third condition will
be eliminated by GCC 4.x (but not by GCC 3.x):
volatile unsigned char *reg_a = (unsigned char *)42;
volatile unsigned char *reg_b = (unsigned char *)34;
extern void a(void);
extern void b(void);
extern void c(void);
void
decide(void)
{
signed char diff;
diff = *reg_a - *reg_b;
if (diff < 0)
a();
else if (diff > 0)
c();
else if (diff == 0)
b();
}
If someone thinks that's an entirely different thing than the subject of this
bug, please tell me so, and I'll submit a separate one.
--
j at uriah dot heep dot sax dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |j at uriah dot heep dot sax
| |dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
` (4 preceding siblings ...)
2007-11-23 10:57 ` j at uriah dot heep dot sax dot de
@ 2008-03-14 17:02 ` rguenth at gcc dot gnu dot org
2008-10-21 8:30 ` dave at icerasemi dot com
2008-12-24 14:16 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-14 17:02 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
` (5 preceding siblings ...)
2008-03-14 17:02 ` rguenth at gcc dot gnu dot org
@ 2008-10-21 8:30 ` dave at icerasemi dot com
2008-12-24 14:16 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: dave at icerasemi dot com @ 2008-10-21 8:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dave at icerasemi dot com 2008-10-21 08:28 -------
Subject: RE: If condition not getting eliminated
Hi Ramana,
Please could you add sdkteam-gnu@icerasemi.com - then we all get to see
it ;-)
Cheers,
-----Original Message-----
From: ramana at icerasemi dot com [mailto:gcc-bugzilla@gcc.gnu.org]
Sent: 21 October 2008 08:04
To: Dave Edwards
Subject: [Bug middle-end/33315] If condition not getting eliminated
--
ramana at icerasemi dot com changed:
What |Removed |Added
------------------------------------------------------------------------
----
CC| |ramana at icerasemi dot
com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
` (6 preceding siblings ...)
2008-10-21 8:30 ` dave at icerasemi dot com
@ 2008-12-24 14:16 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 14:16 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/33315] If condition not getting eliminated
[not found] <bug-33315-4@http.gcc.gnu.org/bugzilla/>
@ 2012-02-04 2:34 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-04 2:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-04 02:33:16 UTC ---
tail merge should be able to do this. It currently does not though for the
provided testcase in comment #1 but that is PR 52009.
Also note cselim should be able to do it too.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-02-04 2:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-05 18:53 [Bug middle-end/33315] New: If condition not getting eliminated pranav dot bhandarkar at gmail dot com
2007-09-05 19:03 ` [Bug middle-end/33315] " pranav dot bhandarkar at gmail dot com
2007-09-05 20:34 ` [Bug middle-end/33315] [4.3 Regression] " rguenth at gcc dot gnu dot org
2007-10-10 17:53 ` mmitchel at gcc dot gnu dot org
2007-11-10 0:27 ` [Bug middle-end/33315] " steven at gcc dot gnu dot org
2007-11-23 10:57 ` j at uriah dot heep dot sax dot de
2008-03-14 17:02 ` rguenth at gcc dot gnu dot org
2008-10-21 8:30 ` dave at icerasemi dot com
2008-12-24 14:16 ` pinskia at gcc dot gnu dot org
[not found] <bug-33315-4@http.gcc.gnu.org/bugzilla/>
2012-02-04 2:34 ` pinskia at gcc dot gnu.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).