commit 2bbfcf61b38edfe3c347cd270380e5117454c0cf
parent 0437e97a1bb126cfa1974dad7b5479fa4b407f46
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 6 Jul 2021 21:31:34 -0700
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.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/copy.c b/copy.c
@@ -27,10 +27,16 @@ iscopy(Ins *i, Ref r, Fn *fn)
case Ocopy:
return 1;
case Omul:
- return iscon(i->arg[1], 1, fn);
case Odiv:
+ case Oudiv:
return iscon(i->arg[1], 1, fn);
case Oadd:
+ case Osub:
+ case Oor:
+ case Oxor:
+ case Osar:
+ case Oshl:
+ case Oshr:
return iscon(i->arg[1], 0, fn);
default:
break;