1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-07 21:28:59 +00:00

6502: Fix local variable read optimization

This commit is contained in:
Karol Stasiak 2019-01-08 23:46:08 +01:00
parent 492300d298
commit 42ecc574f3

View File

@ -120,7 +120,7 @@ object LocalVariableReadOptimization extends AssemblyOptimization[AssemblyLine]
// TODO: consider handling some more opcodes
case (x@AssemblyLine0(op, Absolute | ZeroPage, MemoryAddressConstant(th)), _) :: xs
if OpcodeClasses.ChangesMemoryAlways(op) && map.contains(th.name) =>
if (OpcodeClasses.ChangesMemoryAlways(op) || OpcodeClasses.ChangesMemoryIfNotImplied(op)) && map.contains(th.name) =>
x :: optimizeImpl(xs, variables, map - th.name)
case (x@AssemblyLine0(LABEL, _, _), _) :: xs => x :: optimizeImpl(xs, variables, Map())