public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code
@ 2004-01-09 12:12 steven at gcc dot gnu dot org
2004-01-09 12:17 ` [Bug optimization/13629] " steven at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-09 12:12 UTC (permalink / raw)
To: gcc-bugs
If an expression dominates another one on a path, the redundant
expression is always eliminated. This can pessimize the code
if the original expression was dead code:
int *data;
void partial_dead (int i, int j)
{
int k = i * j;
if (i & j)
data[0] = i * j;
}
-->
;; Function partial_dead (partial_dead)
partial_dead (i, j)
{
int k;
<bb 0>:
k = i * j;
if ((i & j) != 0) goto <L0>; else goto <L1>;
<L0>:;
*data = k;
<L1>:;
return;
}
This is, in fact, a regression:
Resulting assembly with tree-ssa:
partial_dead:
movl 4(%esp), %edx # i
movl 8(%esp), %eax # j
movl %edx, %ecx # k = i
imull %eax, %ecx # k = i * j
testl %eax, %edx # if (j & i)
je .L1 # goto <L1>
movl data, %eax
movl %ecx, (%eax) # *data = k
.L1:
ret
Resulting assembly with 3.3.1 (SuSE Linux):
partial_dead:
movl 4(%esp), %edx # i
movl 8(%esp), %eax # j
testl %eax, %edx # if (j & i)
je .L1 # goto <L1>
imull %eax, %edx
movl data, %eax
movl %edx, (%eax) # *data = i * j
.L1:
ret
--
Summary: [tree-ssa][Regression] dominator optimizations can
pessimize code
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
org,law at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/13629] [tree-ssa][Regression] dominator optimizations can pessimize code
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
@ 2004-01-09 12:17 ` steven at gcc dot gnu dot org
2004-01-09 17:15 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-09 12:17 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/13629] [tree-ssa][Regression] dominator optimizations can pessimize code
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
2004-01-09 12:17 ` [Bug optimization/13629] " steven at gcc dot gnu dot org
@ 2004-01-09 17:15 ` pinskia at gcc dot gnu dot org
2004-01-15 23:52 ` steven at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-09 17:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-09 17:15 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-01-09 17:15:40
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/13629] [tree-ssa][Regression] dominator optimizations can pessimize code
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
2004-01-09 12:17 ` [Bug optimization/13629] " steven at gcc dot gnu dot org
2004-01-09 17:15 ` pinskia at gcc dot gnu dot org
@ 2004-01-15 23:52 ` steven at gcc dot gnu dot org
2004-01-16 2:37 ` law at redhat dot com
2004-01-17 15:15 ` steven at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-15 23:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-01-15 23:52 -------
Running a DCE pass before DOM1 cures the problem:
Resulting assembly with tree-ssa + patch.DCE_before_DOM1:
partial_dead:
movl 4(%esp), %edx
movl 8(%esp), %eax
testl %eax, %edx
je .L1
imull %eax, %edx
movl data, %eax
movl %edx, (%eax)
.L1:
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/13629] [tree-ssa][Regression] dominator optimizations can pessimize code
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-01-15 23:52 ` steven at gcc dot gnu dot org
@ 2004-01-16 2:37 ` law at redhat dot com
2004-01-17 15:15 ` steven at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2004-01-16 2:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-01-16 02:37 -------
Subject: Re: [tree-ssa][Regression] dominator
optimizations can pessimize code
In message <20040115235224.12798.qmail@sources.redhat.com>, "steven at gcc dot
gnu dot org" writes:
>
>------- Additional Comments From steven at gcc dot gnu dot org 2004-01-15 23
>:52 -------
>Running a DCE pass before DOM1 cures the problem:
>
>Resulting assembly with tree-ssa + patch.DCE_before_DOM1:
>partial_dead:
> movl 4(%esp), %edx
> movl 8(%esp), %eax
> testl %eax, %edx
> je .L1
> imull %eax, %edx
> movl data, %eax
> movl %edx, (%eax)
>.L1:
> ret
I mentioned this as a short term plan to Diego yesterday, so consider it
on my todo list (though it looks like you're already doing some of the
evaluation of how that impacts the compiler which will definitely make
my life easier :-)
Long term we may want to handle this with partial dead code elimination
since real code often has partial dead code which we would like to be
able to move to eliminate it on paths where it's not needed.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/13629] [tree-ssa][Regression] dominator optimizations can pessimize code
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-01-16 2:37 ` law at redhat dot com
@ 2004-01-17 15:15 ` steven at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-17 15:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-01-17 15:15 -------
the case i showed is fixed. we need more advanced optimizations
such as partial dead code elimination in most other similar cases,
but there's no point in keeping this bug report open just for that.
So closed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-01-17 15:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-09 12:12 [Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code steven at gcc dot gnu dot org
2004-01-09 12:17 ` [Bug optimization/13629] " steven at gcc dot gnu dot org
2004-01-09 17:15 ` pinskia at gcc dot gnu dot org
2004-01-15 23:52 ` steven at gcc dot gnu dot org
2004-01-16 2:37 ` law at redhat dot com
2004-01-17 15:15 ` steven 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).