public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
@ 2005-08-12 0:50 pinskia at gcc dot gnu dot org
2005-08-12 0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 0:50 UTC (permalink / raw)
To: gcc-bugs
Take the following code:
int a, b;
int f(int bool1)
{
int c;
int c1 = a/b;
if(bool1)
c = 0;
else
c = a/b;
return c;
}
On the mainline, we produce (at -O2 -fomit-frame-pointer):
f:
subl $8, %esp
xorl %ecx, %ecx
movl 12(%esp), %eax
movl %ebx, (%esp)
movl b, %edx
movl %esi, 4(%esp)
movl a, %ebx
testl %eax, %eax
jne .L4
movl %ebx, %eax
movl %edx, %esi
cltd
idivl %esi
movl %eax, %ecx
.L4:
movl (%esp), %ebx
movl %ecx, %eax
movl 4(%esp), %esi
addl $8, %esp
ret
Which is just a mess.
in 4.0.0, we produced:
f:
movl 4(%esp), %edx
xorl %eax, %eax
testl %edx, %edx
jne .L4
movl a, %eax
cltd
idivl b
.L4:
ret
There are two ways of fixing this, one way is to sink loads; the other simple way (most likely for 4.1) is
to call dce before fre. I think the reason why the testcase which Steven committed did not catch this is
because sink will sink the divide which is what is only in Steven's testcase.
--
Summary: [4.1 Regression] FRE before DCE makes a mess of loads or
need to sink loads
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
@ 2005-08-12 0:50 ` pinskia at gcc dot gnu dot org
2005-08-23 16:34 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 0:50 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
2005-08-12 0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
@ 2005-08-23 16:34 ` pinskia at gcc dot gnu dot org
2005-08-23 16:54 ` dberlin at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 16:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-23 16:32 -------
I will need someone to test DCE before FRE for me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
2005-08-12 0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
2005-08-23 16:34 ` pinskia at gcc dot gnu dot org
@ 2005-08-23 16:54 ` dberlin at gcc dot gnu dot org
2005-08-23 17:02 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2005-08-23 16:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dberlin at gcc dot gnu dot org 2005-08-23 16:52 -------
Could you show what the code looks like before and after FRE?
I imagine FRE eliminates one a/b, which isn't really making a mess of loads.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-08-23 16:54 ` dberlin at gcc dot gnu dot org
@ 2005-08-23 17:02 ` pinskia at gcc dot gnu dot org
2005-08-23 19:54 ` dberlin at gcc dot gnu dot org
2005-08-26 15:53 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-23 16:53 -------
(In reply to comment #2)
> I imagine FRE eliminates one a/b, which isn't really making a mess of loads.
It is eliminating the loads of a and b too but nothing (maybe it is the job of the ra), moves the loads
back into the conditional branch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-08-23 17:02 ` pinskia at gcc dot gnu dot org
@ 2005-08-23 19:54 ` dberlin at gcc dot gnu dot org
2005-08-26 15:53 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2005-08-23 19:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dberlin at gcc dot gnu dot org 2005-08-23 18:56 -------
FRE can't really do anything about this.
DOM would do the same thing if it was run before DCE.
I'll make the sinker sink loads.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-08-23 19:54 ` dberlin at gcc dot gnu dot org
@ 2005-08-26 15:53 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-26 15:53 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-08-26 15:20:00
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2005-10-31 4:58 ` mmitchel at gcc dot gnu dot org
@ 2005-10-31 4:59 ` pinskia at physics dot uc dot edu
4 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2005-10-31 4:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2005-10-31 04:59 -------
Subject: Re: [4.1 Regression] FRE before DCE makes a mess of loads or need to
sink loads
>
>
>
> ------- Comment #7 from mmitchel at gcc dot gnu dot org 2005-10-31 04:58 -------
> Why have we regressed relative to 4.0?
Because passes were reordered in 4.1.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2005-10-29 1:21 ` pinskia at gcc dot gnu dot org
@ 2005-10-31 4:58 ` mmitchel at gcc dot gnu dot org
2005-10-31 4:59 ` pinskia at physics dot uc dot edu
4 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31 4:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mmitchel at gcc dot gnu dot org 2005-10-31 04:58 -------
Why have we regressed relative to 4.0?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
2005-10-12 0:53 ` pinskia at gcc dot gnu dot org
2005-10-17 9:35 ` steven at gcc dot gnu dot org
@ 2005-10-29 1:21 ` pinskia at gcc dot gnu dot org
2005-10-31 4:58 ` mmitchel at gcc dot gnu dot org
2005-10-31 4:59 ` pinskia at physics dot uc dot edu
4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-29 1:21 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
2005-10-12 0:53 ` pinskia at gcc dot gnu dot org
@ 2005-10-17 9:35 ` steven at gcc dot gnu dot org
2005-10-29 1:21 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-17 9:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from steven at gcc dot gnu dot org 2005-10-17 09:35 -------
Re. comment #5 -- it's always a possibility ;-)
Just show that it's worth it. I doubt it is, really.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
@ 2005-10-12 0:53 ` pinskia at gcc dot gnu dot org
2005-10-17 9:35 ` steven at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-12 0:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2005-10-12 00:53 -------
(In reply to comment #4)
> I'll make the sinker sink loads.
Since that will not happen until 4.2 at the earliest because it needs some
cleanup as mentioned on
http://gcc.gnu.org/wiki/Improved%20Aliasing%20Todo%20List
Is adding an extra DCE before FRE and such, a possibility?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23346
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-10-31 4:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-12 0:50 [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
2005-08-12 0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
2005-08-23 16:34 ` pinskia at gcc dot gnu dot org
2005-08-23 16:54 ` dberlin at gcc dot gnu dot org
2005-08-23 17:02 ` pinskia at gcc dot gnu dot org
2005-08-23 19:54 ` dberlin at gcc dot gnu dot org
2005-08-26 15:53 ` pinskia at gcc dot gnu dot org
[not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
2005-10-12 0:53 ` pinskia at gcc dot gnu dot org
2005-10-17 9:35 ` steven at gcc dot gnu dot org
2005-10-29 1:21 ` pinskia at gcc dot gnu dot org
2005-10-31 4:58 ` mmitchel at gcc dot gnu dot org
2005-10-31 4:59 ` pinskia at physics dot uc dot edu
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).