[dev.ssa] cmd/compile: copy values during rewrites
Rather than require an explicit Copy on the RHS of rewrite rules,
use rulegen magic to add it.
The advantages to handling this in rulegen are:
* simpler rules
* harder to accidentally miss a Copy
Change-Id: I46853bade83bdf517eee9495bf5a553175277b53
Reviewed-on: https://go-review.googlesource.com/13242
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/compile/internal/ssa/gen/generic.rules b/src/cmd/compile/internal/ssa/gen/generic.rules
index cb6a200..8656b7c 100644
--- a/src/cmd/compile/internal/ssa/gen/generic.rules
+++ b/src/cmd/compile/internal/ssa/gen/generic.rules
@@ -34,10 +34,10 @@
(Neq16 x x) -> (ConstBool {false})
(Neq8 x x) -> (ConstBool {false})
-(Com8 (Com8 x)) -> (Copy x)
-(Com16 (Com16 x)) -> (Copy x)
-(Com32 (Com32 x)) -> (Copy x)
-(Com64 (Com64 x)) -> (Copy x)
+(Com8 (Com8 x)) -> x
+(Com16 (Com16 x)) -> x
+(Com32 (Com32 x)) -> x
+(Com64 (Com64 x)) -> x
// tear apart slices
// TODO: anything that generates a slice needs to go in here.