Re: Optimizing Across && And ||

bill@amber.ssd.csd.harris.com (Bill Leonard)
Tue, 28 Feb 1995 19:26:27 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: Optimizing Across && And || bill@amber.ssd.csd.harris.com (1995-02-19)
Re: Optimizing Across && And || bart@cs.uoregon.edu (1995-02-21)
Re: Optimizing Across && And || whalley@fork.cs.fsu.edu (David Whalley) (1995-02-22)
Re: Optimizing Across && And || bart@cs.uoregon.edu (1995-02-23)
Re: Optimizing Across && And || bill@amber.ssd.csd.harris.com (1995-02-24)
Re: Optimizing Across && And || glew@ichips.intel.com (1995-02-27)
Re: Optimizing Across && And || bill@amber.ssd.csd.harris.com (1995-02-28)
Re: Optimizing Across && And || bill@amber.ssd.csd.harris.com (1995-02-28)
Re: Optimizing Across && And || ryg@summit.novell.com (1995-03-03)
Re: Optimizing Across && And || leichter@zodiac.rutgers.edu (1995-03-07)
Re: Optimizing Across && And || preston@tera.com (1995-03-08)
Re: Optimizing Across && And || pardo@cs.washington.edu (1995-03-13)
Re: Optimizing Across && And || chase@centerline.com (1995-03-14)
[4 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: bill@amber.ssd.csd.harris.com (Bill Leonard)
Keywords: C, optimize
Organization: Harris Computer Systems, Ft. Lauderdale FL
References: 95-02-110 95-02-179
Date: Tue, 28 Feb 1995 19:26:27 GMT

bart@cs.uoregon.edu (Barton C. Massey) writes:
> I suspect that this sort of thing occurs often in macro expansions.
>
> For example, an implementation of the stdio putc() macro for a
> very popular OS expands to a complicated conditional expression
> including
> ((p)->_flag & _IOLBF) && -(p)->cnt < (p)->_bufsiz
> which is executed once each time an io buffer is output.


True, but at least some of those fields involved in the test are modified
by the I/O operation, so the next test must still reevaluate them. Because
most compilers don't keep aliasing or global data-flow information for
individual fields of structures, once you pass a pointer to the structure
to a function (like _flsbuf), the compiler must assume the whole structure
changed.


> People often write code like
> putc(x);
> putc(y);
> or even
> for(i=0; i<100000; i++) {
> putc(x[i]);
> putc(y[i]);
> }
> in which case there are some serious opportunities for
> optimization here.


Not really, unless your putc differs considerably from every other putc
I've ever examined.


> Of course, you'll now insist that I go find
> examples of this sort of putc() usage, in real programs, in
> places where it matters...


Nope, I wouldn't be that cruel. :-)


--
Bill Leonard
Harris Computer Systems Corporation
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
Bill.Leonard@mail.hcsc.com
--


Post a followup to this message

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