;; Removes useless LD's
;; Tries to guess the value of the 1st and 2nd operands.
;; If they're the same, this LD is useless

OLEVEL: 3
OFLAG: 100

REPLACE {{
  ld $1, $2
}}

IF {{
  (GVAL($1) == GVAL($2)) ||
  ((IS_REG8($1) || IS_REG8($2)) &&
   (LOVAL(GVAL($1)) == LOVAL(GVAL($2)))
   )
}}

WITH {{
}}
