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: Need advice on bounds checking approaches


Jeffrey A Law <law@cygnus.com> writes:

>   > It is very easy to eliminate redundant checks at the end of the main
>   > loop in combine_instructions:
> This looks very compile-time expensive since you have to walk the LOG_LINKs
> chain all the way back to the top of the dependency chain.

I'll look for a cheaper way to do this.

> 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.

> 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?

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