This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/26479] New: suboptimal register allocation for return register


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]