C optimizer

Wade Guthrie evil at arcturus.UUCP
Wed Feb 15 07:15:49 AEST 1989


In article <515 at larry.UUCP>, jwp at larry.UUCP (Jeffrey W Percival) writes:
 
> my real question is, would *most* compilers optimize this . . .

While we're talking about optimizers (and, since all the furor about
optimizing one's code has died down :->), what do most optimizers on
most C compilers do?  Where is TFM that I should be 'R'ing (and in which
FM should I look?)  I would expect the following optimizations:

	1) constant expression reduction
	2) loop inversion
	3) reducing things like intval/2 == intval >> 1 when they are
	   faster.  I actually saw a programmer write something
	   LAST YEAR that used intval >> n instead of dividing.  Scary.

What else should I expect?  From what compilers?  On what machines?
In short, what should I do myself and what should I let the *general*
optimizer/compiler do?


Wade Guthrie
evil at arcturus.UUCP
Rockwell International
Anaheim, CA

(Rockwell doesn't necessarily believe / stand by what I'm saying; how could
they when *I* don't even know what I'm talking about???)



More information about the Comp.lang.c mailing list