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.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.