|[12 earlier articles]|
|Re: Optimizing Across && And || email@example.com (1995-03-08)|
|Re: Optimizing Across && And || firstname.lastname@example.org (1995-03-13)|
|Re: Optimizing Across && And || email@example.com (1995-03-14)|
|Re: Optimizing Across && And || firstname.lastname@example.org (1995-03-15)|
|Re: Optimizing Across && And || email@example.com (1995-03-20)|
|Re: Optimizing Across && And || firstname.lastname@example.org (1995-03-21)|
|Re: Optimizing Across && And || email@example.com (1995-04-03)|
|From:||firstname.lastname@example.org (Bill Leonard)|
|Organization:||Harris Computer Systems, Ft. Lauderdale FL|
|Date:||Mon, 3 Apr 1995 15:59:23 GMT|
email@example.com (Christopher Glaeser) writes:
> Jim Balter <uunet!netcom.com!jqb> wrote:
> > It is true that properly written programs shouldn't contain dead code.
> Macro expansion, function inline expansion, and many other optimizations
> can also expose dead code in a "properly" (i.e. well) written program.
I agree with Christopher: Properly written programs *may indeed* contain
dead code. And once the optimizer has performed some optimizations on it,
it may contain even more!
For instance, some strength reduction algorithms simply replace array
references in a loop with compiler-generated pointer dereferences, and
replace the loop test with a pointer-based comparison. If the resulting
loop contains no references to the original loop index variable, then the
assignments to that variable are removed by dead-code elimination.
Now you wouldn't want the compiler telling you your loop-index assignments
were unnecessary, would you?
Many optimizers rely on their dead-code elimination phase in this way to
"clean up" after other optimizations. It is easier and more efficient than
having each optimization perform the cleanup separately, but it does
sacrifice the ability to identify truly dead code. But that probably is
not something the average user wants anyway, in view of the points that
Christopher and others raise about assertions, validity checks, macro
Harris Computer Systems Corporation
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
Return to the
Search the comp.compilers archives again.