public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/25381] New: local alloc is not really that good
@ 2005-12-13 5:08 pinskia at gcc dot gnu dot org
2005-12-25 1:45 ` [Bug rtl-optimization/25381] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-13 5:08 UTC (permalink / raw)
To: gcc-bugs
Take this little (stupid) C example:
int f1(int a)
{
int b = a*2;
return b+a;
}
---
Currently we produce:
_f1:
mr r0,r3
slwi r3,r3,1
add r3,r3,r0
blr
-----
We should be able to produce:
_f1:
slwi r0,r3,1
add r3,r3,r0
blr
-------
If we look at the RTL which used:
(insn:HI 6 17 12 0 (set (reg/v:SI 121 [ a ])
(reg:SI 3 r3 [ a ])) 326 {*movsi_internal1} (nil)
(expr_list:REG_DEAD (reg:SI 3 r3 [ a ])
(expr_list:REG_EQUIV (mem/c/i:SI (plus:SI (reg/f:SI 67 ap)
(const_int 24 [0x18])) [2 a+0 S4 A32])
(nil))))
(insn:HI 12 6 20 0 (set (reg/v:SI 119 [ b ])
(ashift:SI (reg/v:SI 121 [ a ])
(const_int 1 [0x1]))) 188 {ashlsi3_no_power}
(insn_list:REG_DEP_TRUE 6 (nil))
(nil))
(insn:HI 20 12 26 0 (set (reg/i:SI 3 r3 [ <result> ])
(plus:SI (reg/v:SI 119 [ b ])
(reg/v:SI 121 [ a ]))) 94 {*addsi3_internal1}
(insn_list:REG_DEP_TRUE 6 (insn_list:REG_DEP_TRUE 12 (nil)))
(expr_list:REG_DEAD (reg/v:SI 119 [ b ])
(expr_list:REG_DEAD (reg/v:SI 121 [ a ])
(nil))))
------
And then look at what local alloc does:
Pass 0
Register 119 costs: BASE_REGS:0 GENERAL_REGS:0 NON_SPECIAL_REGS:4000
LINK_REGS:4000 CTR_REGS:4000 LINK_OR_CTR_REGS:4000 SPECIAL_REGS:4000
SPEC_OR_GEN_REGS:4000 NON_FLOAT_REGS:4000 ALL_REGS:4000 MEM:8000
Register 121 costs: BASE_REGS:0 GENERAL_REGS:0 NON_SPECIAL_REGS:6000
LINK_REGS:6000 CTR_REGS:6000 LINK_OR_CTR_REGS:6000 SPECIAL_REGS:6000
SPEC_OR_GEN_REGS:6000 NON_FLOAT_REGS:6000 ALL_REGS:6000 MEM:12000
Register 119 pref GENERAL_REGS
Register 121 pref GENERAL_REGS
Pass 1
Register 119 costs: BASE_REGS:0 GENERAL_REGS:0 NON_SPECIAL_REGS:4000
LINK_REGS:4000 CTR_REGS:4000 LINK_OR_CTR_REGS:4000 SPECIAL_REGS:4000
SPEC_OR_GEN_REGS:4000 NON_FLOAT_REGS:4000 ALL_REGS:4000 MEM:8000
Register 121 costs: BASE_REGS:0 GENERAL_REGS:0 NON_SPECIAL_REGS:6000
LINK_REGS:6000 CTR_REGS:6000 LINK_OR_CTR_REGS:6000 SPECIAL_REGS:6000
SPEC_OR_GEN_REGS:6000 NON_FLOAT_REGS:6000 ALL_REGS:6000 MEM:12000
123 registers.
Register 119 used 2 times across 2 insns in block 0; set 1 time; user var.
Register 121 used 3 times across 6 insns in block 0; set 1 time; user var.
1 basic blocks, 2 edges.
Basic block 0 prev -1, next -2, loop_depth 0, count 0, freq 10000, maybe hot.
Predecessors: ENTRY [100.0%] (fallthru)
Successors: EXIT [100.0%] (fallthru)
Registers live at start: 1 [r1] 3 [r3] 30 [r30] 67 [ap] 113 [sfp]
Registers live at end: 1 [r1] 3 [r3] 30 [r30] 67 [ap] 113 [sfp]
;; Register 119 in 3.
;; Register 121 in 0.
------
it puts 119 in r3 and 121 in r0, when the opposite is better.
--
Summary: local alloc is not really that good
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization, ra
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC build triplet: powerpc-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25381
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/25381] local alloc is not really that good
2005-12-13 5:08 [Bug rtl-optimization/25381] New: local alloc is not really that good pinskia at gcc dot gnu dot org
@ 2005-12-25 1:45 ` pinskia at gcc dot gnu dot org
2006-01-13 0:42 ` dtemirbulatov at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25 1:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-12-25 01:45 -------
Confirmed.
--
pinskia 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 |2005-12-25 01:45:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25381
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/25381] local alloc is not really that good
2005-12-13 5:08 [Bug rtl-optimization/25381] New: local alloc is not really that good pinskia at gcc dot gnu dot org
2005-12-25 1:45 ` [Bug rtl-optimization/25381] " pinskia at gcc dot gnu dot org
@ 2006-01-13 0:42 ` dtemirbulatov at gmail dot com
2006-08-26 4:23 ` pinskia at gcc dot gnu dot org
2008-09-14 4:39 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dtemirbulatov at gmail dot com @ 2006-01-13 0:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dtemirbulatov at gmail dot com 2006-01-13 00:42 -------
Created an attachment (id=10634)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10634&action=view)
workaround for the bug
verified and tested on ppc_440
# gcc -v
Using built-in specs.
Target: powerpc-440-linux-gnu
Configured with: ../gcc/configure --target=powerpc-440-linux-gnu
--host=i686-host_pc-linux-gnu
--prefix=/home/dinar/work/fsfbugz/25381/branch-4.0/gcc-20040801-core-prefix/
--with-local-prefix=/home/dinar/work/gnu/tools/gcc-4.0.0-glibc-2.3.5/powerpc-440-linux-gnu/powerpc-440-linux-gnu
--disable-multilib --with-newlib --without-headers --disable-nls
--enable-threads=no --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c --disable-shared
Thread model: single
gcc version 4.2.0 20060112 (experimental)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25381
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/25381] local alloc is not really that good
2005-12-13 5:08 [Bug rtl-optimization/25381] New: local alloc is not really that good pinskia at gcc dot gnu dot org
2005-12-25 1:45 ` [Bug rtl-optimization/25381] " pinskia at gcc dot gnu dot org
2006-01-13 0:42 ` dtemirbulatov at gmail dot com
@ 2006-08-26 4:23 ` pinskia at gcc dot gnu dot org
2008-09-14 4:39 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-26 4:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-08-26 04:23 -------
*** Bug 25848 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25381
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/25381] local alloc is not really that good
2005-12-13 5:08 [Bug rtl-optimization/25381] New: local alloc is not really that good pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-08-26 4:23 ` pinskia at gcc dot gnu dot org
@ 2008-09-14 4:39 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-14 4:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-09-14 04:38 -------
This was fixed for 4.3.0, most likely by DF.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
GCC build triplet|powerpc-darwin |
GCC target triplet| |powerpc-darwin
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25381
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-14 4:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 5:08 [Bug rtl-optimization/25381] New: local alloc is not really that good pinskia at gcc dot gnu dot org
2005-12-25 1:45 ` [Bug rtl-optimization/25381] " pinskia at gcc dot gnu dot org
2006-01-13 0:42 ` dtemirbulatov at gmail dot com
2006-08-26 4:23 ` pinskia at gcc dot gnu dot org
2008-09-14 4:39 ` 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).