Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: Put your code... (was Re: gotos Message-ID: <83@lakart.UUCP> Date: 2 May 88 13:55:47 GMT References: <1988Apr27.164212.12535@utzoo.uucp> Organization: Lake - The systems people Lines: 31 From article <1988Apr27.164212.12535@utzoo.uucp>, by henry@utzoo.uucp (Henry Spencer): > One can avoid this to some degree in C by using case fallthrough. Otherwise, > I agree but would phrase it differently: for "with today's larger memories" > substitute "with sensible compilers". It doesn't take much of an optimizer > to notice that the instruction sequences preceding an unconditional control- > flow merge are identical, and condense them into one by branching to the > beginning of the sequence rather than the end. Any peephole optimizer > worthy of the name ought to be willing to do this. Well said - in 1980 the Bell labs V6 Unix C compiler part 'c2' could be made to print out what it had done, and one message was 42 Common code before branches Exactly what Mr. Spencer is talking about. I'm tempted to add that a good peephole optimizer should be added to some current compilers: it gets my back up when our compiler generates code like movl d0,d0 or movl d1,d0 movl d1,d0 I've seen both of these!! No kidding! Or when it puts 'nop's into the assembler source. -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+