This is the mail archive of the gcc@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]

Re: Multiple cse and loop opts



  In message <199901121508.JAA24738@isua2.iastate.edu>you write:
  > 
  > >  >   I can try to look at this especially if someone could suggest a good
  > >  > starting approach.  The rtl for the two loops should be very
  > >  > similar after the first CSE, I suspect.
  > >Yes.  I'm kind of surprised that neither cse nor the jump pass after cse
  > >removed the switch with no real body.  I believe both passes have the
  > >capability of doing this.  
  > 
  >   The examples that I just tried are below.  The switch was removed if
  > the number of cases was less than five.
Probably because the switch was implemented as cascaded if/else statements
when it got that small.

  >   The assembly generated from egcs-1.1.1 for the examples is also
  > below.  Both still contain the actual loop.  Notice the slightly less
  > efficient code for the loop that contained the switch.  Interestingly,
  > the switch and if examples _do_ generate the same assembly if the
  > number of cases in the switch is less than five.  An example of the
  > switch with only four cases and its corresponding assembly is the last
  > example.
I meant for you to look at why cse & jump are not deleting the switch
statement.  This is the kind of thing they are designed to do.


Given that "j" is never used it should be possible for the compiler to
remove the entire switch statement.

jeff


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