Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site scirtp.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!mcnc!rti-sel!scirtp!dfh From: dfh@scirtp.UUCP (David F. Hinnant) Newsgroups: net.lang.c Subject: What does the optimiser optimise? Message-ID: <455@scirtp.UUCP> Date: Fri, 13-Sep-85 12:27:08 EDT Article-I.D.: scirtp.455 Posted: Fri Sep 13 12:27:08 1985 Date-Received: Sat, 14-Sep-85 17:14:20 EDT Distribution: net Organization: SCI Systems, Research Triangle Park, NC Lines: 48 I am wondering (for the purpose of benchmarking) what kinds of C code the optimiser (or bad-code-eliminator if you prefer) easily handles and what kinds of constructs it may-or-may-not optimise. I'm not so interested in specifics, but rather what I sould expect from different optimisers. As a starting point, how are the following code fragments handled? 1) x = (a+b); x = (a+b) +c; x = (a+b) +c / d; etc. Does the optimiser recognize that it's done (a+b) before and save this in a temporary location for future use? How complicated can the (a+b) sub-expression become? 2) for (i=1; i < x; i++) Is any optimisation done here? 3) if (x) { ..... x = 1; y = 1; z = 1; } else { ..... x = 1; y = 1; z = 1; } Is a common section of code generated for the last 3 statements? I.e., does branch-tail merging occur? 4) Is code that is never reached removed? Replies I recieve by mail will be summarized if interest merits. As always, Thanks in advance. -- David Hinnant SCI Systems, Inc. {decvax, akgua}!mcnc!rti-sel!scirtp!dfh