From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5528 invoked by alias); 27 Feb 2006 04:50:17 -0000 Received: (qmail 5518 invoked by uid 48); 27 Feb 2006 04:50:12 -0000 Date: Mon, 27 Feb 2006 05:29:00 -0000 Subject: [Bug rtl-optimization/26479] New: suboptimal register allocation for return register X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hp at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg03013.txt.bz2 List-Id: 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