]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: make no-op rewrite funcs smaller
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 31 Dec 2020 12:41:53 +0000 (12:41 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 22 Mar 2021 16:01:44 +0000 (16:01 +0000)
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>
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/ssa/rewrite386splitload.go
src/cmd/compile/internal/ssa/rewriteAMD64splitload.go
src/cmd/compile/internal/ssa/rewriteWasm.go
src/cmd/compile/internal/ssa/rewritedec.go
src/cmd/compile/internal/ssa/rewritedec64.go

index 6388aab3621b902ec73d221150332385d5907f64..a3ce726dc32d624ff9359cd6c70e39eaec46a002 100644 (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)
 
index 90b5df8ae063572b03abe2d3257f231a518887bb..670e7f4f8f6b5f3eb6cd0007f4307134aa7becdd 100644 (file)
@@ -156,7 +156,5 @@ func rewriteValue386splitload_Op386CMPWload(v *Value) bool {
        }
 }
 func rewriteBlock386splitload(b *Block) bool {
-       switch b.Kind {
-       }
        return false
 }
index 1b8680c052b8ce73ee2cf9ff8c052ea9624ee2a6..ae50aaa466f214c74096cae7e194e266ee4290c5 100644 (file)
@@ -847,7 +847,5 @@ func rewriteValueAMD64splitload_OpAMD64CMPWloadidx2(v *Value) bool {
        }
 }
 func rewriteBlockAMD64splitload(b *Block) bool {
-       switch b.Kind {
-       }
        return false
 }
index 7258bc4f8e5971e46660ab87b9bb666b6236f2dd..6efcdfe37148150e07abd38f2ff6feaad8089931 100644 (file)
@@ -4902,7 +4902,5 @@ func rewriteValueWasm_OpZeroExt8to64(v *Value) bool {
        }
 }
 func rewriteBlockWasm(b *Block) bool {
-       switch b.Kind {
-       }
        return false
 }
index e0fa9768d959bc70b15691965c024ea45c473b1b..4b7db60551aee0b8eaaad89a819753202ff39b4a 100644 (file)
@@ -409,7 +409,5 @@ func rewriteValuedec_OpStringPtr(v *Value) bool {
        return false
 }
 func rewriteBlockdec(b *Block) bool {
-       switch b.Kind {
-       }
        return false
 }
index 60b727f45fdcb1fdb55960db18fb8e1e6aa4c76b..7d9656a4c827a1024c8adf96c3db03b40c19a2e4 100644 (file)
@@ -2458,7 +2458,5 @@ func rewriteValuedec64_OpZeroExt8to64(v *Value) bool {
        }
 }
 func rewriteBlockdec64(b *Block) bool {
-       switch b.Kind {
-       }
        return false
 }