Need advice on bounds checking approaches

Jeffrey A Law law@cygnus.com
Mon Apr 10 10:20:00 GMT 2000


  In message < msr9cevotm.fsf@tucson-net-82.eng.ascend.com >you write:
  > > Presumably you're trying to delete one conditional trap that is subsumed 
  > by
  > > an earlier conditional trap?
  > 
  > I'm not sure what you mean by "subsumed" in this context.  What I'm
  > trying to optimize is this case:
  > 
  > 	if (x)
  > 	  p->a = 1;
  > 	p->b = 2;
  > 	p->c = 3;
  > 	p->d = 4;
  > 	p++;
  > 	p->e = 5;
  > 	p->f = 6;
  > 	p->g = 7;
  > 	p->h = 8;
  > 
  > Without optimization, the bounds of `p' are checked eight times, once
  > per `->' operator.  The necessary checks are at `p->a = 1', `p->b =
  > 2', `p->e = 5'; the rest are redundant and should be deleted.  p->a is
  > separated from the others by a BB boundary, so there's nothing special
  > here.  p->b .. p->h are in the same BB, but p->e .. p->h have LOG_LINKS
  > that point to the increment of p.value, and so differ from p->a .. p->d.
By subsumed I mean a check that is redundant due to an earlier check.


  > > If so, that might be best modeled after an
  > > identical optimization we do on jumps.   See jump.c
  > 
  > Would you kindly give a more specific clue about where to look in
  > jump.c?
thread_jumps I believe does something similar to what you need.  I also
believe CSE does similar things as part of it's follow-jumps/skip-blocks
optimizations.


jeff




More information about the Gcc mailing list