From: cuz Date: Thu, 4 Oct 2001 21:15:43 +0000 (+0000) Subject: Fixed a bug X-Git-Tag: V2.12.0~2580 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9c4b9f19dc5bdba221b1bd80277ae6b26130bb2f;p=cc65 Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1010 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 356013cae..4555cab68 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -909,12 +909,15 @@ unsigned OptStoreLoad (CodeSeg* S) /* Check if it is a store instruction followed by a load from the * same address which is itself not followed by a conditional branch. */ - if ((E->Info & OF_STORE) != 0 && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_HasLabel (N) && - (N->Info & OF_LOAD) != 0 && - strcmp (E->Arg, N->Arg) == 0 && - (X = CS_GetNextEntry (S, I+1)) != 0 && + if ((E->Info & OF_STORE) != 0 && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_HasLabel (N) && + (N->Info & OF_LOAD) != 0 && + ((E->OPC == OP65_STA && N->OPC == OP65_LDA) || + (E->OPC == OP65_STX && N->OPC == OP65_LDX) || + (E->OPC == OP65_STY && N->OPC == OP65_LDY)) && + strcmp (E->Arg, N->Arg) == 0 && + (X = CS_GetNextEntry (S, I+1)) != 0 && (X->Info & OF_FBRA) == 0) { /* Register value is not used, remove the load */