Re: Possible ANSI C Optimisation Done in Practice?

ralph@inputplus.demon.co.uk (Ralph Corderoy)
20 Dec 2001 09:29:42 -0500

          From comp.compilers

Related articles
[3 earlier articles]
Re: Possible ANSI C Optimisation Done in Practice? rbates@southwind.net (Rodney M. Bates) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-19)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? RLWatkins@CompuServe.Com (R. L. Watkins) (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-22)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-22)
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)
[4 later articles]
| List of all articles for this month |
From: ralph@inputplus.demon.co.uk (Ralph Corderoy)
Newsgroups: comp.compilers
Date: 20 Dec 2001 09:29:42 -0500
Organization: InputPlus Ltd.
References: 01-12-050 <200112120335.fBC3ZMg01140@budgie.cs.uwa.edu.au> 01-12-065 01-12-104
Keywords: C, optimize
Posted-Date: 20 Dec 2001 09:29:42 EST
Originator: ralph@inputplus.demon.co.uk (Ralph Corderoy)

Hi,


> Some compilers will replace calls to functions such as 'strlen()'
> with in-line code. In such a case, the optimization phase isn't even
> aware that 'strlen()' is being called. It simply optimizes the
> in-line code as if the programmer had written it that way.


Agreed, but that doesn't change my question. Either the compiler
*knows* what strlen is and that it is pure, or in addition replaces the
call to strlen with inline code. That still leaves the compiler to
determine that modifying *t doesn't affect s so the strlen call, or its
equivalent inline code, is invariant to the loop.


Cheers,


Ralph.


Post a followup to this message

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