diff options
author | Keith Randall <khr@golang.org> | 2020-12-09 14:59:40 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-02-23 20:05:01 +0000 |
commit | d2911d76127deaa08644979cec7d990559f0aa54 (patch) | |
tree | bbb8f48fbcbdebc660deb24f83d0961d4d2caa03 /src/cmd/compile/internal/ssa/rewriteARM.go | |
parent | d434c2338b11b9ecf19865e8ec3f2721706f29cf (diff) | |
download | go-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/rewriteARM.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewriteARM.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteARM.go b/src/cmd/compile/internal/ssa/rewriteARM.go index c958aae2c4..1adbceb0ad 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM.go +++ b/src/cmd/compile/internal/ssa/rewriteARM.go @@ -202,6 +202,8 @@ func rewriteValueARM(v *Value) bool { return rewriteValueARM_OpARMMOVWloadshiftRA(v) case OpARMMOVWloadshiftRL: return rewriteValueARM_OpARMMOVWloadshiftRL(v) + case OpARMMOVWnop: + return rewriteValueARM_OpARMMOVWnop(v) case OpARMMOVWreg: return rewriteValueARM_OpARMMOVWreg(v) case OpARMMOVWstore: @@ -6501,6 +6503,21 @@ func rewriteValueARM_OpARMMOVWloadshiftRL(v *Value) bool { } return false } +func rewriteValueARM_OpARMMOVWnop(v *Value) bool { + v_0 := v.Args[0] + // match: (MOVWnop (MOVWconst [c])) + // result: (MOVWconst [c]) + for { + if v_0.Op != OpARMMOVWconst { + break + } + c := auxIntToInt32(v_0.AuxInt) + v.reset(OpARMMOVWconst) + v.AuxInt = int32ToAuxInt(c) + return true + } + return false +} func rewriteValueARM_OpARMMOVWreg(v *Value) bool { v_0 := v.Args[0] // match: (MOVWreg x) |