Browse Source

copy: consider identity element for more instructions

udiv %x, 1 == %x, and for each of sub, or, xor, sar, shr, and shl,
<op> %x, 0 == %x.
Michael Forney 4 years ago
parent
commit
2bbfcf61b3
1 changed files with 7 additions and 1 deletions
  1. 7 1
      copy.c

+ 7 - 1
copy.c

@@ -27,10 +27,16 @@ iscopy(Ins *i, Ref r, Fn *fn)
 	case Ocopy:
 	case Ocopy:
 		return 1;
 		return 1;
 	case Omul:
 	case Omul:
-		return iscon(i->arg[1], 1, fn);
 	case Odiv:
 	case Odiv:
+	case Oudiv:
 		return iscon(i->arg[1], 1, fn);
 		return iscon(i->arg[1], 1, fn);
 	case Oadd:
 	case Oadd:
+	case Osub:
+	case Oor:
+	case Oxor:
+	case Osar:
+	case Oshl:
+	case Oshr:
 		return iscon(i->arg[1], 0, fn);
 		return iscon(i->arg[1], 0, fn);
 	default:
 	default:
 		break;
 		break;