* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
@ 2007-11-07 10:17 ` jakub at gcc dot gnu dot org
2007-11-07 10:24 ` jakub at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-07 10:17 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-11-07 10:17:34
date| |
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
2007-11-07 10:17 ` [Bug rtl-optimization/34012] " jakub at gcc dot gnu dot org
@ 2007-11-07 10:24 ` jakub at gcc dot gnu dot org
2007-11-07 11:03 ` bonzini at gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-07 10:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2007-11-07 10:24 -------
With 4.2 and earlier, we get:
movabsq $578721382704613384, %rax
movq %rsp, %rdi
movq %rax, (%rsp)
movq %rax, 8(%rsp)
movq %rax, 16(%rsp)
movq %rax, 24(%rsp)
movq %rax, 32(%rsp)
movq %rax, 40(%rsp)
movq %rax, 48(%rsp)
movq %rax, 56(%rsp)
movq %rax, 64(%rsp)
movq %rax, 72(%rsp)
call bar
with the trunk:
movabsq $578721382704613384, %rax
movabsq $578721382704613384, %r11
movq %rax, (%rsp)
movabsq $578721382704613384, %rax
movq %rsp, %rdi
movq %rax, 8(%rsp)
movabsq $578721382704613384, %r10
movabsq $578721382704613384, %r9
movabsq $578721382704613384, %r8
movabsq $578721382704613384, %rsi
movabsq $578721382704613384, %rcx
movabsq $578721382704613384, %rdx
movabsq $578721382704613384, %rax
movq %r11, 16(%rsp)
movq %r10, 24(%rsp)
movq %r9, 32(%rsp)
movq %r8, 40(%rsp)
movq %rsi, 48(%rsp)
movq %rcx, 56(%rsp)
movq %rdx, 64(%rsp)
movq %rax, 72(%rsp)
call bar
which is far worse. The predicate on the source operand on movdi_1_rex64
allows it (general_operand), but the constraints don't (but letting forwprop to
try all constraints to see what is and is not desirable would be weird).
Alternatively, perhaps forwprop could try to emit_move_insn and see if it
doesn't create more insns than the one it is substing into, if more than one,
it should just punt, otherwise it can just subst into it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
2007-11-07 10:17 ` [Bug rtl-optimization/34012] " jakub at gcc dot gnu dot org
2007-11-07 10:24 ` jakub at gcc dot gnu dot org
@ 2007-11-07 11:03 ` bonzini at gnu dot org
2007-11-07 11:04 ` bonzini at gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: bonzini at gnu dot org @ 2007-11-07 11:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from bonzini at gnu dot org 2007-11-07 11:03 -------
fwprop should check costs just like combine does. Unfortunately the cost do
need a little bit of tweaking even if one implements the idea.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-11-07 11:03 ` bonzini at gnu dot org
@ 2007-11-07 11:04 ` bonzini at gnu dot org
2007-11-07 13:40 ` jakub at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: bonzini at gnu dot org @ 2007-11-07 11:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from bonzini at gnu dot org 2007-11-07 11:04 -------
Created an attachment (id=14495)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14495&action=view)
patch that fixes the bug
I'm not sure about the correctness of the i386.c hunk. The problem is that a
cost of 0 is mapped by insn_rtx_cost to COSTS_N_INSNS(1) == 4.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-11-07 11:04 ` bonzini at gnu dot org
@ 2007-11-07 13:40 ` jakub at gcc dot gnu dot org
2007-11-07 13:54 ` paolo dot bonzini at lu dot unisi dot ch
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-07 13:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2007-11-07 13:40 -------
BTW, why don't you use just rtx_cost instead of insn_rtx_cost?
In each case you have an insn, so you can do single_set on it and run
rtx_cost (SET_SRC (set), SET) on it directly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-11-07 13:40 ` jakub at gcc dot gnu dot org
@ 2007-11-07 13:54 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-07 17:02 ` bonzini at gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot bonzini at lu dot unisi dot ch @ 2007-11-07 13:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot bonzini at lu dot unisi dot ch 2007-11-07 13:53 -------
Subject: Re: [4.3 Regression] Pessimization caused
by fwprop
> BTW, why don't you use just rtx_cost instead of insn_rtx_cost?
> In each case you have an insn, so you can do single_set on it and run
> rtx_cost (SET_SRC (set), SET) on it directly.
You're right. I was just mimicking combine to see if the problem was
simple to solve or more deeply rooted.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-11-07 13:54 ` paolo dot bonzini at lu dot unisi dot ch
@ 2007-11-07 17:02 ` bonzini at gnu dot org
2007-11-07 20:18 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: bonzini at gnu dot org @ 2007-11-07 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from bonzini at gnu dot org 2007-11-07 17:02 -------
Created an attachment (id=14499)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14499&action=view)
patch using rtx_cost
This patch uses rtx_cost instead of insn_rtx_cost, which is faster and does not
require touching i386.c.
--
bonzini at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14495|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-11-07 17:02 ` bonzini at gnu dot org
@ 2007-11-07 20:18 ` jakub at gcc dot gnu dot org
2007-11-08 6:10 ` paolo dot bonzini at lu dot unisi dot ch
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-07 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jakub at gcc dot gnu dot org 2007-11-07 20:18 -------
Created an attachment (id=14502)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14502&action=view)
gcc43-pr34012.patch
Updated patch with testcase. Paolo, are you bootstrapping/regtesting this or
should I? I can do that on x86_64-linux, ppc64-linux and ia64-linux overnight.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-11-07 20:18 ` jakub at gcc dot gnu dot org
@ 2007-11-08 6:10 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-08 17:05 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot bonzini at lu dot unisi dot ch @ 2007-11-08 6:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot bonzini at lu dot unisi dot ch 2007-11-08 06:10 -------
Subject: Re: [4.3 Regression] Pessimization caused
by fwprop
jakub at gcc dot gnu dot org wrote:
> ------- Comment #7 from jakub at gcc dot gnu dot org 2007-11-07 20:18 -------
> Created an attachment (id=14502)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14502&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14502&action=view)
> gcc43-pr34012.patch
>
> Updated patch with testcase. Paolo, are you bootstrapping/regtesting this or
> should I? I can do that on x86_64-linux, ppc64-linux and ia64-linux overnight.
I could have done it only on Monday and only for x86_64 (CPU time for
the local x86_64 is "reserved" by another guy till then...) so yes, it's
much better if you do it. Thanks!
Paolo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-11-08 6:10 ` paolo dot bonzini at lu dot unisi dot ch
@ 2007-11-08 17:05 ` jakub at gcc dot gnu dot org
2007-11-09 13:03 ` jakub at gcc dot gnu dot org
2007-11-09 13:05 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-08 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2007-11-08 17:05 -------
Bootstrapped/regtested on x86_64-linux, ppc64-linux (-m64 default) and
ia64-linux. No regressions. Could you please send it to gcc-patches?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-11-08 17:05 ` jakub at gcc dot gnu dot org
@ 2007-11-09 13:03 ` jakub at gcc dot gnu dot org
2007-11-09 13:05 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-09 13:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2007-11-09 13:03 -------
Subject: Bug 34012
Author: jakub
Date: Fri Nov 9 13:02:25 2007
New Revision: 130043
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130043
Log:
PR rtl-optimization/34012
* fwprop.c (try_fwprop_subst): Do not replace if the new
SET_SRC has a higher cost than the old one.
* gcc.target/i386/pr34012.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr34012.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fwprop.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/34012] [4.3 Regression] Pessimization caused by fwprop
2007-11-07 10:12 [Bug rtl-optimization/34012] New: [4.3 Regression] Pessimization caused by fwprop jakub at gcc dot gnu dot org
` (10 preceding siblings ...)
2007-11-09 13:03 ` jakub at gcc dot gnu dot org
@ 2007-11-09 13:05 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-09 13:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jakub at gcc dot gnu dot org 2007-11-09 13:05 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34012
^ permalink raw reply [flat|nested] 13+ messages in thread