Re: Possible ANSI C Optimisation Done in Practice?

ralph@inputplus.demon.co.uk (Ralph Corderoy)
5 Jan 2002 01:44:10 -0500

          From comp.compilers

Related articles
[13 earlier articles]
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? toon@moene.indiv.nluug.nl (Toon Moene) (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-27)
Re: Possible ANSI C Optimisation Done in Practice? david.thompson1@worldnet.att.net (David Thompson) (2001-12-27)
Re: Possible ANSI C Optimisation Done in Practice? david.thompson1@worldnet.att.net (David Thompson) (2002-01-03)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2002-01-05)
| List of all articles for this month |

From: ralph@inputplus.demon.co.uk (Ralph Corderoy)
Newsgroups: comp.compilers
Date: 5 Jan 2002 01:44:10 -0500
Organization: InputPlus Ltd.
References: 01-12-050 01-12-068 01-12-079 02-01-016
Keywords: optimize, comment
Posted-Date: 05 Jan 2002 01:44:10 EST

Hi David,


> > t is initialised to point to tmp and is only ever incremented.
> > Under ANSI C it's only valid to continue until t points to one char
> > past the end of tmp. tmp is a local variable to the routine, s is
> > a parameter passed in, so they can't overlap. Therefore writing to
> > *t can't affect s. Surely, this kind of reasoning is made use of
> > in a compiler, why else did ANSI `tighten' C with these kind of
> > rules?
>
> The fact that this can sometimes assist in aliasing analysis is
> mostly a happy accident.


Surely something the committee knew could be of use in optimisation.


> As already noted, C99 does so more generally and formally with
> 'restrict'; by your logic, this wouldn't have been added if it
> weren't needed, right?


I said it `tightened' it, not made it so optimal that no further
improvement was necessary, so you're wrong to imply I think restrict
can have no use.


Cheers,
Ralph.
[The committee most certainly knew that aliasing makes optimization much
harder. C89 almost had a 'noalias' keyword but it was taken out late in
the process when they realized that its definition had problems that they
couldn't fix in a reasonable amount of time. Ten years later they had
time to define 'restrict'. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.