public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/26479] New: suboptimal register allocation for return register
@ 2006-02-27 5:29 hp at gcc dot gnu dot org
2006-03-03 18:54 ` [Bug rtl-optimization/26479] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: hp at gcc dot gnu dot org @ 2006-02-27 5:29 UTC (permalink / raw)
To: gcc-bugs
For this code, at -O2, R13 is needlessly used, where R10 would suffice.
(Leading to two extra move insns.) Curiously, if-conversion exposes
the suboptimal allocation; with -fno-if-conversion you get the better
allocation, but looking at the assembled code, there's no reason to not
use r10. Observed with 108225 and 111226. Code is from bzip2recover.c.
extern int _IO_getc (void *) ;
extern int *__errno_location (void) __attribute__ ((__const__));
void readError ( void );
typedef
struct {
void* handle;
int buffer;
int buffLive;
char mode;
}
BitStream;
int bsGetBit ( BitStream* bs )
{
if (bs->buffLive > 0) {
bs->buffLive --;
return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
} else {
int retVal = _IO_getc (bs->handle);
if ( retVal == (-1) ) {
if ((*__errno_location ()) != 0) readError();
return 2;
}
bs->buffLive = 7;
bs->buffer = retVal;
return ( ((bs->buffer) >> 7) & 0x1 );
}
}
--
Summary: suboptimal register allocation for return register
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hp at gcc dot gnu dot org
GCC target triplet: cris-axis-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
@ 2006-03-03 18:54 ` pinskia at gcc dot gnu dot org
2006-03-03 18:56 ` 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 @ 2006-03-03 18:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-03-03 18:54 -------
Interesting it shows up on powerpc64 also with the work around of turning off
if conversion fixing the issue too.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC target triplet|cris-axis-linux-gnu |cris-axis-linux-gnu,
| |powerpc64-*
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-03-03 18:54:10
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
2006-03-03 18:54 ` [Bug rtl-optimization/26479] " pinskia at gcc dot gnu dot org
@ 2006-03-03 18:56 ` pinskia at gcc dot gnu dot org
2006-03-03 19:00 ` 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 @ 2006-03-03 18:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-03-03 18:56 -------
With -O2:
L4:
addi r1,r1,128
mr r3,r2
ld r0,16(r1)
ld r31,-8(r1)
mtlr r0
blr
With -O2 -fno-if-conversion:
L4:
addi r1,r1,128
ld r0,16(r1)
ld r31,-8(r1)
mtlr r0
blr
I have not looked enough into the RTL to figure out why this is going wrong.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ra
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
2006-03-03 18:54 ` [Bug rtl-optimization/26479] " pinskia at gcc dot gnu dot org
2006-03-03 18:56 ` pinskia at gcc dot gnu dot org
@ 2006-03-03 19:00 ` pinskia at gcc dot gnu dot org
2008-09-14 3:18 ` 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 @ 2006-03-03 19:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-03-03 19:00 -------
Oh, if I turn off the first pass of scheduling it also works so that means this
is truely a ra issue. if conversion is just exposing the problem by moving the
load of constant above the branch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-03-03 19:00 ` pinskia at gcc dot gnu dot org
@ 2008-09-14 3:18 ` pinskia at gcc dot gnu dot org
2008-09-24 16:50 ` hp 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 @ 2008-09-14 3:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-09-14 03:16 -------
I think this was fixed for 4.3.0:
.L3:
lwz 0,20(1)
lwz 31,12(1)
addi 1,1,16
mtlr 0
blr
HP,
can you try this again on cris?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-09-14 3:18 ` pinskia at gcc dot gnu dot org
@ 2008-09-24 16:50 ` hp at gcc dot gnu dot org
2008-09-24 16:52 ` hp at gcc dot gnu dot org
2008-09-24 16:59 ` hp at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-09-24 16:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from hp at gcc dot gnu dot org 2008-09-24 16:49 -------
(In reply to comment #4)
> I think this was fixed for 4.3.0:
> HP,
> can you try this again on cris?
At 140627, the problem is still there on the 4.3 branch for CRIS. I'll attach
a diff of the generated assembly of -O2 compared to -O2 -fno-if-conversion.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-09-24 16:50 ` hp at gcc dot gnu dot org
@ 2008-09-24 16:52 ` hp at gcc dot gnu dot org
2008-09-24 16:59 ` hp at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-09-24 16:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from hp at gcc dot gnu dot org 2008-09-24 16:51 -------
Created an attachment (id=16402)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16402&action=view)
Diff of asembly of -O2 vs -O2 -fno-if-conversion at r.140627
See previous comment.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/26479] suboptimal register allocation for return register
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-09-24 16:52 ` hp at gcc dot gnu dot org
@ 2008-09-24 16:59 ` hp at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-09-24 16:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from hp at gcc dot gnu dot org 2008-09-24 16:57 -------
I guess I should turn the code in the description into a testcase in gcc.dg so
target maintainers can add their xfailed scan-assembler-not and we'd see
xpasses if/when this is magically fixed...
(After the IRA adjustments for CRIS!)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26479
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-09-24 16:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-27 5:29 [Bug rtl-optimization/26479] New: suboptimal register allocation for return register hp at gcc dot gnu dot org
2006-03-03 18:54 ` [Bug rtl-optimization/26479] " pinskia at gcc dot gnu dot org
2006-03-03 18:56 ` pinskia at gcc dot gnu dot org
2006-03-03 19:00 ` pinskia at gcc dot gnu dot org
2008-09-14 3:18 ` pinskia at gcc dot gnu dot org
2008-09-24 16:50 ` hp at gcc dot gnu dot org
2008-09-24 16:52 ` hp at gcc dot gnu dot org
2008-09-24 16:59 ` hp 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).