aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewriteMIPS64.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-12-09 14:59:40 -0800
committerKeith Randall <khr@golang.org>2021-02-23 20:05:01 +0000
commitd2911d76127deaa08644979cec7d990559f0aa54 (patch)
treebbb8f48fbcbdebc660deb24f83d0961d4d2caa03 /src/cmd/compile/internal/ssa/rewriteMIPS64.go
parentd434c2338b11b9ecf19865e8ec3f2721706f29cf (diff)
downloadgo-d2911d76127deaa08644979cec7d990559f0aa54.tar.gz
go-d2911d76127deaa08644979cec7d990559f0aa54.zip
cmd/compile: fold MOV*nop and MOV*const
MOV*nop and MOV*reg seem superfluous. They are there to keep type information around that would otherwise get thrown away. Not sure what we need it for. I think our compiler needs a normalization of how types are represented in SSA, especially after lowering. MOV*nop gets in the way of some optimization rules firing, like for load combining. For now, just fold MOV*nop and MOV*const. It's certainly safe to do that, as the type info on the MOV*const isn't ever useful. R=go1.17 Change-Id: I3630a80afc2455a8e9cd9fde10c7abe05ddc3767 Reviewed-on: https://go-review.googlesource.com/c/go/+/276792 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteMIPS64.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS64.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
index d78f6089af..073cf8726c 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
@@ -339,6 +339,8 @@ func rewriteValueMIPS64(v *Value) bool {
return rewriteValueMIPS64_OpMIPS64MOVHstorezero(v)
case OpMIPS64MOVVload:
return rewriteValueMIPS64_OpMIPS64MOVVload(v)
+ case OpMIPS64MOVVnop:
+ return rewriteValueMIPS64_OpMIPS64MOVVnop(v)
case OpMIPS64MOVVreg:
return rewriteValueMIPS64_OpMIPS64MOVVreg(v)
case OpMIPS64MOVVstore:
@@ -3584,6 +3586,21 @@ func rewriteValueMIPS64_OpMIPS64MOVVload(v *Value) bool {
}
return false
}
+func rewriteValueMIPS64_OpMIPS64MOVVnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVVnop (MOVVconst [c]))
+ // result: (MOVVconst [c])
+ for {
+ if v_0.Op != OpMIPS64MOVVconst {
+ break
+ }
+ c := auxIntToInt64(v_0.AuxInt)
+ v.reset(OpMIPS64MOVVconst)
+ v.AuxInt = int64ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueMIPS64_OpMIPS64MOVVreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVVreg x)