cmd/compile: make no-op rewrite funcs smaller

This doesn't change any behavior, but should help the compiler realise
that these funcs really do nothing at all.

Change-Id: Ib26c02ef264691acac983538ec300f91d6ff98db
Reviewed-on: https://go-review.googlesource.com/c/go/+/280314
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Daniel Martí 2020-12-31 12:41:53 +00:00
parent e838c76a6e
commit bd8b3fe5be
6 changed files with 7 additions and 12 deletions

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gen
// +build gen
// This program generates Go code that applies rewrite rules to a Value.
@ -194,7 +195,9 @@ func genRulesSuffix(arch arch, suff string) {
swc.add(stmtf("return rewriteValue%s%s_%s(v)", arch.name, suff, op))
sw.add(swc)
}
fn.add(sw)
if len(sw.List) > 0 { // skip if empty
fn.add(sw)
}
fn.add(stmtf("return false"))
genFile.add(fn)
@ -264,7 +267,9 @@ func genRulesSuffix(arch arch, suff string) {
}
sw.add(swc)
}
fn.add(sw)
if len(sw.List) > 0 { // skip if empty
fn.add(sw)
}
fn.add(stmtf("return false"))
genFile.add(fn)

View File

@ -156,7 +156,5 @@ func rewriteValue386splitload_Op386CMPWload(v *Value) bool {
}
}
func rewriteBlock386splitload(b *Block) bool {
switch b.Kind {
}
return false
}

View File

@ -847,7 +847,5 @@ func rewriteValueAMD64splitload_OpAMD64CMPWloadidx2(v *Value) bool {
}
}
func rewriteBlockAMD64splitload(b *Block) bool {
switch b.Kind {
}
return false
}

View File

@ -4902,7 +4902,5 @@ func rewriteValueWasm_OpZeroExt8to64(v *Value) bool {
}
}
func rewriteBlockWasm(b *Block) bool {
switch b.Kind {
}
return false
}

View File

@ -409,7 +409,5 @@ func rewriteValuedec_OpStringPtr(v *Value) bool {
return false
}
func rewriteBlockdec(b *Block) bool {
switch b.Kind {
}
return false
}

View File

@ -2458,7 +2458,5 @@ func rewriteValuedec64_OpZeroExt8to64(v *Value) bool {
}
}
func rewriteBlockdec64(b *Block) bool {
switch b.Kind {
}
return false
}