This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/26479] New: suboptimal register allocation for return register
- From: "hp at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2006 04:50:12 -0000
- Subject: [Bug rtl-optimization/26479] New: suboptimal register allocation for return register
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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