On Thu, Jul 15, 2004 at 09:13:42AM -0700, Shawn Jefferson wrote: > I wanted to make sure I understood it all before I > suggested that this particular optimization maybe > isn't useful. If the programmer is comparing memory > with the same value that they just put in it, then > they probably wanted to do that and the compiler > shouldn't remove it, unless there are other scenarios > where this would be handy. Ok, sorry. I've cited the example from memory without actually checking it. And in the given case, the additional load is not removed, because it is needed to make the following conditional branch work. Here is a working example: ---------------------------------------------------------------------------- char i, j, k; int main (void) { j = i; k = j; return 0; } ---------------------------------------------------------------------------- ; ; j = i; ; lda _i sta _j ; ; k = j; ; sta _k ; ; return 0; ; ldx #$00 txa ; ; } ; rts ---------------------------------------------------------------------------- If you compile the code without optimization, you can see that the compiler generates an additional load of j for the second statement in main(). Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Thu Jul 15 20:19:51 2004
This archive was generated by hypermail 2.1.8 : 2004-07-15 20:19:59 CEST