dfh@scirtp.UUCP (David F. Hinnant) (09/13/85)
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