Fixed #1806565
[fw/sdcc] / src / z80 / peeph-z80.def
index 01901e87dbe50dbbebeadd8ca11143003aca4028..bb740d2a5a4e0db04d5bb2db8d18f6204097b352 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
+// This can't go into peeph.def since %1 could be (hl+) on gbz80.
+replace restart {
+       ld      %1,%3
+       ld      %1,%2
+} by {
+       ; peephole z0 removed dead load into %1
+       ld      %1,%2
+} if notVolatile(%1 %3), operandsNotSame
+
 replace restart {
        ld      %1,#%2
        ld      a,0(%1)