public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/18293] New: Redundant copy operation introduced by expand
@ 2004-11-03 22:24 steven at gcc dot gnu dot org
2004-11-03 22:58 ` [Bug middle-end/18293] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-03 22:24 UTC (permalink / raw)
To: gcc-bugs
Given this piece of code,
struct deferred_access;
extern struct deferred_access *D25481;
struct deferred_access *
foo (void)
{
return (struct deferred_access *) ((long unsigned int) D25481 * 16);
}
which generates on i686 in .00.expand (-fdump-rtl-expand-details):
;; return (struct deferred_access *) ((long unsigned int) (int) D25481 * 16)
(insn 10 9 11 (set (reg:SI 60)
(mem/f/i:SI (symbol_ref:SI ("D25481") [flags 0x40] <var_decl
0x401d489c D25481>) [2 D25481+0 S4 A32])) -1 (nil)
(nil))
(insn 11 10 12 (set (reg:SI 61)
(reg:SI 60)) -1 (nil)
(nil))
(insn 12 11 13 (parallel [
(set (reg:SI 62)
(ashift:SI (reg:SI 61)
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) -1 (nil)
(expr_list:REG_EQUAL (mult:SI (reg:SI 60)
(const_int 16 [0x10]))
(nil)))
(insn 13 12 14 (set (reg:SI 58 [ <result> ])
(reg:SI 62)) -1 (nil)
(nil))
Notice the unnecessary copy insn 11:
(insn 11 10 12 (set (reg:SI 61) (reg:SI 60)) -1 (nil) (nil))
Is there some way, oh RTL gurus tell me!, to avoid introducing this
garbage RTL that only introduces work for the RTL optimizers?
--
Summary: Redundant copy operation introduced by expand
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,sayle at gcc dot gnu dot
org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
@ 2004-11-03 22:58 ` pinskia at gcc dot gnu dot org
2004-11-04 17:20 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 22:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 22:58 -------
Confirmed. This is related to casts somehow.
Also this happens on 3.3 which is even more funny and just show the deficiencies in the expanders
which no one noticed before.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |compile-time-hog, memory-
| |hog, missed-optimization
Known to fail| |3.3 4.0.0
Last reconfirmed|0000-00-00 00:00:00 |2004-11-03 22:58:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
2004-11-03 22:58 ` [Bug middle-end/18293] " pinskia at gcc dot gnu dot org
@ 2004-11-04 17:20 ` pinskia at gcc dot gnu dot org
2004-11-09 21:33 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-04 17:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-04 17:20 -------
I am testing this patch (which is a modified version of the one which you gave me), it should help -O0
compile time as we no longer have an extra INSN which gets removed right after the register allocator:
Index: expmed.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.200
diff -u -p -r1.200 expmed.c
--- expmed.c 21 Oct 2004 10:51:00 -0000 1.200
+++ expmed.c 4 Nov 2004 16:55:46 -0000
@@ -2638,7 +2638,10 @@ expand_mult_const (enum machine_mode mod
}
else if (alg->op[0] == alg_m)
{
- accum = copy_to_mode_reg (mode, op0);
+ if (REG_P (op0) && GET_MODE (op0) == mode && alg->ops == 2)
+ accum = op0;
+ else
+ accum = copy_to_mode_reg (mode, op0);
val_so_far = 1;
}
else
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
2004-11-03 22:58 ` [Bug middle-end/18293] " pinskia at gcc dot gnu dot org
2004-11-04 17:20 ` pinskia at gcc dot gnu dot org
@ 2004-11-09 21:33 ` pinskia at gcc dot gnu dot org
2004-11-12 15:35 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-09 21:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-09 21:33 -------
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00775.html>. Mine.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-09 21:33 ` pinskia at gcc dot gnu dot org
@ 2004-11-12 15:35 ` pinskia at gcc dot gnu dot org
2004-12-08 2:15 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-12 15:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-12 15:35 -------
Note if we change this we have to look at the IV-OPT cost analysis mechanism and retune it to be more
correct as we will miss some optimizations.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-12 15:35 ` pinskia at gcc dot gnu dot org
@ 2004-12-08 2:15 ` cvs-commit at gcc dot gnu dot org
2004-12-08 2:29 ` pinskia at gcc dot gnu dot org
2004-12-08 2:49 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-08 2:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-12-08 02:15 -------
Subject: Bug 18293
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: sayle@gcc.gnu.org 2004-12-08 02:15:39
Modified files:
gcc : ChangeLog expmed.c loop.c
Log message:
PR middle-end/18293
* expmed.c (EXACT_POWER_OF_2_OR_ZERO_P): Move definition earlier.
(expand_mult): Special case powers of two to avoid synth_mult.
* loop.c (product_cheap_p): Handle case where expand_mult does
require/generate any instructions (i.e. multiplication by zero).
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6742&r2=2.6743
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expmed.c.diff?cvsroot=gcc&r1=1.211&r2=1.212
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&r1=1.516&r2=1.517
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-12-08 2:15 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-08 2:29 ` pinskia at gcc dot gnu dot org
2004-12-08 2:49 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-08 2:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-08 02:29 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18293] Redundant copy operation introduced by expand
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-12-08 2:29 ` pinskia at gcc dot gnu dot org
@ 2004-12-08 2:49 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-08 2:49 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18293
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-12-08 2:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-03 22:24 [Bug middle-end/18293] New: Redundant copy operation introduced by expand steven at gcc dot gnu dot org
2004-11-03 22:58 ` [Bug middle-end/18293] " pinskia at gcc dot gnu dot org
2004-11-04 17:20 ` pinskia at gcc dot gnu dot org
2004-11-09 21:33 ` pinskia at gcc dot gnu dot org
2004-11-12 15:35 ` pinskia at gcc dot gnu dot org
2004-12-08 2:15 ` cvs-commit at gcc dot gnu dot org
2004-12-08 2:29 ` pinskia at gcc dot gnu dot org
2004-12-08 2:49 ` pinskia 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).