]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: teach rulegen to remove unused decls
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 10 Aug 2019 17:27:45 +0000 (19:27 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 27 Aug 2019 17:04:18 +0000 (17:04 +0000)
First, add cpu and memory profiling flags, as these are useful to see
where rulegen is spending its time. It now takes many seconds to run on
a recent laptop, so we have to keep an eye on what it's doing.

Second, stop writing '_ = var' lines to keep imports and variables used
at all times. Now that rulegen removes all such unused names, they're
unnecessary.

To perform the removal, lean on go/types to first detect what names are
unused. We can configure it to give us all the type-checking errors in a
file, so we can collect all "declared but not used" errors in a single
pass.

We then use astutil.Apply to remove the relevant nodes based on the line
information from each unused error. This allows us to apply the changes
without having to do extra parser+printer roundtrips to plaintext, which
are far too expensive.

We need to do multiple such passes, as removing an unused variable
declaration might then make another declaration unused. Two passes are
enough to clean every file at the moment, so add a limit of three passes
for now to avoid eating cpu uncontrollably by accident.

The resulting performance of the changes above is a ~30% loss across the
table, since go/types is fairly expensive. The numbers were obtained
with 'benchcmd Rulegen go run *.go', which involves compiling rulegen
itself, but that seems reflective of how the program is used.

name     old time/op         new time/op         delta
Rulegen          5.61s ± 0%          7.36s ± 0%  +31.17%  (p=0.016 n=5+4)

name     old user-time/op    new user-time/op    delta
Rulegen          7.20s ± 1%          9.92s ± 1%  +37.76%  (p=0.016 n=5+4)

name     old sys-time/op     new sys-time/op     delta
Rulegen          135ms ±19%          169ms ±17%  +25.66%  (p=0.032 n=5+5)

name     old peak-RSS-bytes  new peak-RSS-bytes  delta
Rulegen         71.0MB ± 2%         85.6MB ± 2%  +20.56%  (p=0.008 n=5+5)

We can live with a bit more resource usage, but the time/op getting
close to 10s isn't good. To win that back, introduce concurrency in
main.go. This further increases resource usage a bit, but the real time
on this quad-core laptop is greatly reduced. The final benchstat is as
follows:

name     old time/op         new time/op         delta
Rulegen          5.61s ± 0%          3.97s ± 1%   -29.26%  (p=0.008 n=5+5)

name     old user-time/op    new user-time/op    delta
Rulegen          7.20s ± 1%         13.91s ± 1%   +93.09%  (p=0.008 n=5+5)

name     old sys-time/op     new sys-time/op     delta
Rulegen          135ms ±19%          269ms ± 9%   +99.17%  (p=0.008 n=5+5)

name     old peak-RSS-bytes  new peak-RSS-bytes  delta
Rulegen         71.0MB ± 2%        226.3MB ± 1%  +218.72%  (p=0.008 n=5+5)

It might be possible to reduce the cpu or memory usage in the future,
such as configuring go/types to do less work, or taking shortcuts to
avoid having to run it many times. For now, ~2x cpu and ~4x memory usage
seems like a fair trade for a faster and better rulegen.

Finally, we can remove the old code that tried to remove some unused
variables in a hacky and unmaintainable way.

Change-Id: Iff9e83e3f253babf5a1bd48cc993033b8550cee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/189798
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
17 files changed:
src/cmd/compile/internal/ssa/gen/main.go
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/ssa/rewrite386.go
src/cmd/compile/internal/ssa/rewrite386splitload.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewriteAMD64splitload.go
src/cmd/compile/internal/ssa/rewriteARM.go
src/cmd/compile/internal/ssa/rewriteARM64.go
src/cmd/compile/internal/ssa/rewriteMIPS.go
src/cmd/compile/internal/ssa/rewriteMIPS64.go
src/cmd/compile/internal/ssa/rewritePPC64.go
src/cmd/compile/internal/ssa/rewriteS390X.go
src/cmd/compile/internal/ssa/rewriteWasm.go
src/cmd/compile/internal/ssa/rewritedec.go
src/cmd/compile/internal/ssa/rewritedec64.go
src/cmd/compile/internal/ssa/rewritedecArgs.go
src/cmd/compile/internal/ssa/rewritegeneric.go

index bfecb9b29feae81588733c7f3f5db650b23d911b..9c0e0904b2b778e3a2f5fe0ac16f3224c625651d 100644 (file)
@@ -15,10 +15,14 @@ import (
        "go/format"
        "io/ioutil"
        "log"
+       "os"
        "path"
        "regexp"
+       "runtime"
+       "runtime/pprof"
        "sort"
        "strings"
+       "sync"
 )
 
 type arch struct {
@@ -93,11 +97,36 @@ func (a arch) regMaskComment(r regMask) string {
 
 var archs []arch
 
+var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
+var memprofile = flag.String("memprofile", "", "write memory profile to `file`")
+
 func main() {
        flag.Parse()
+       if *cpuprofile != "" {
+               f, err := os.Create(*cpuprofile)
+               if err != nil {
+                       log.Fatal("could not create CPU profile: ", err)
+               }
+               defer f.Close()
+               if err := pprof.StartCPUProfile(f); err != nil {
+                       log.Fatal("could not start CPU profile: ", err)
+               }
+               defer pprof.StopCPUProfile()
+       }
        sort.Sort(ArchsByName(archs))
        genOp()
        genLower()
+       if *memprofile != "" {
+               f, err := os.Create(*memprofile)
+               if err != nil {
+                       log.Fatal("could not create memory profile: ", err)
+               }
+               defer f.Close()
+               runtime.GC() // get up-to-date statistics
+               if err := pprof.WriteHeapProfile(f); err != nil {
+                       log.Fatal("could not write memory profile: ", err)
+               }
+       }
 }
 
 func genOp() {
@@ -395,11 +424,26 @@ func (a arch) Name() string {
        return s
 }
 
+// genLower generates all arch-specific rewrite Go source files. The files are
+// generated and written concurrently, since it's a CPU-intensive task that can
+// easily make use of many cores on a machine.
+//
+// Note that there is no limit on the concurrency at the moment. On a four-core
+// laptop at the time of writing, peak RSS usually reached ~230MiB, which seems
+// doable by practially any machine nowadays. If that stops being the case, we
+// can cap this func to a fixed number of architectures being generated at once.
 func genLower() {
+       var wg sync.WaitGroup
        for _, a := range archs {
-               genRules(a)
-               genSplitLoadRules(a)
+               a := a
+               wg.Add(1)
+               go func() {
+                       genRules(a)
+                       genSplitLoadRules(a)
+                       wg.Done()
+               }()
        }
+       wg.Wait()
 }
 
 // countRegs returns the number of set bits in the register mask.
index 0e89af73e94d589e3d63ae6639eb520d266c6954..500d98431cf1237e52526d42fe06d1706b396f12 100644 (file)
@@ -21,14 +21,15 @@ import (
        "go/parser"
        "go/printer"
        "go/token"
+       "go/types"
        "io"
-       "io/ioutil"
        "log"
-       "math"
        "os"
        "regexp"
        "sort"
        "strings"
+
+       "golang.org/x/tools/go/ast/astutil"
 )
 
 // rule syntax:
@@ -165,7 +166,7 @@ func genRulesSuffix(arch arch, suff string) {
        }
        sort.Strings(ops)
 
-       file := &File{arch: arch, suffix: suff}
+       genFile := &File{arch: arch, suffix: suff}
        const chunkSize = 10
        // Main rewrite routine is a switch on v.Op.
        fn := &Func{kind: "Value"}
@@ -182,7 +183,7 @@ func genRulesSuffix(arch arch, suff string) {
        }
        fn.add(sw)
        fn.add(stmtf("return false"))
-       file.add(fn)
+       genFile.add(fn)
 
        // Generate a routine per op. Note that we don't make one giant routine
        // because it is too big for some compilers.
@@ -201,7 +202,10 @@ func genRulesSuffix(arch arch, suff string) {
                                kind:   "Value",
                                suffix: fmt.Sprintf("_%s_%d", op, chunk),
                        }
-                       var rewrites bodyBase
+                       fn.add(declf("b", "v.Block"))
+                       fn.add(declf("config", "b.Func.Config"))
+                       fn.add(declf("fe", "b.Func.fe"))
+                       fn.add(declf("typ", "&b.Func.Config.Types"))
                        for _, rule := range rules[chunk:endchunk] {
                                if rr != nil && !rr.canFail {
                                        log.Fatalf("unconditional rule %s is followed by other rules", rr.match)
@@ -219,38 +223,12 @@ func genRulesSuffix(arch arch, suff string) {
                                if *genLog {
                                        rr.add(stmtf("logRule(%q)", rule.loc))
                                }
-                               rewrites.add(rr)
-                       }
-
-                       // TODO(mvdan): remove unused vars later instead
-                       uses := make(map[string]int)
-                       walk(&rewrites, func(node Node) {
-                               switch node := node.(type) {
-                               case *Declare:
-                                       // work around var shadowing
-                                       // TODO(mvdan): forbid it instead.
-                                       uses[node.name] = math.MinInt32
-                               case *ast.Ident:
-                                       uses[node.Name]++
-                               }
-                       })
-                       if uses["b"]+uses["config"]+uses["fe"]+uses["typ"] > 0 {
-                               fn.add(declf("b", "v.Block"))
-                       }
-                       if uses["config"] > 0 {
-                               fn.add(declf("config", "b.Func.Config"))
+                               fn.add(rr)
                        }
-                       if uses["fe"] > 0 {
-                               fn.add(declf("fe", "b.Func.fe"))
-                       }
-                       if uses["typ"] > 0 {
-                               fn.add(declf("typ", "&b.Func.Config.Types"))
-                       }
-                       fn.add(rewrites.list...)
                        if rr.canFail {
                                fn.add(stmtf("return false"))
                        }
-                       file.add(fn)
+                       genFile.add(fn)
                }
        }
 
@@ -258,11 +236,8 @@ func genRulesSuffix(arch arch, suff string) {
        // so we can make this one function with a switch.
        fn = &Func{kind: "Block"}
        fn.add(declf("config", "b.Func.Config"))
-       // TODO(mvdan): declare these only if needed
        fn.add(declf("typ", "&config.Types"))
-       fn.add(stmtf("_ = typ"))
        fn.add(declf("v", "b.Control"))
-       fn.add(stmtf("_ = v"))
 
        sw = &Switch{expr: exprf("b.Kind")}
        ops = ops[:0]
@@ -279,52 +254,69 @@ func genRulesSuffix(arch arch, suff string) {
        }
        fn.add(sw)
        fn.add(stmtf("return false"))
-       file.add(fn)
+       genFile.add(fn)
 
-       // gofmt result
+       // Remove unused imports and variables.
        buf := new(bytes.Buffer)
-       fprint(buf, file)
-       b := buf.Bytes()
-       src, err := format.Source(b)
+       fprint(buf, genFile)
+       fset := token.NewFileSet()
+       file, err := parser.ParseFile(fset, "", buf, parser.ParseComments)
        if err != nil {
-               fmt.Printf("%s\n", b)
-               panic(err)
+               log.Fatal(err)
        }
-       // Write to file
-       if err := ioutil.WriteFile("../rewrite"+arch.name+suff+".go", src, 0666); err != nil {
-               log.Fatalf("can't write output: %v\n", err)
-       }
-}
+       tfile := fset.File(file.Pos())
 
-func walk(node Node, fn func(Node)) {
-       fn(node)
-       switch node := node.(type) {
-       case *bodyBase:
-       case *File:
-       case *Func:
-       case *Switch:
-               walk(node.expr, fn)
-       case *Case:
-               walk(node.expr, fn)
-       case *RuleRewrite:
-       case *Declare:
-               walk(node.value, fn)
-       case *CondBreak:
-               walk(node.expr, fn)
-       case ast.Node:
-               ast.Inspect(node, func(node ast.Node) bool {
-                       fn(node)
+       for n := 0; n < 3; n++ {
+               unused := make(map[token.Pos]bool)
+               conf := types.Config{Error: func(err error) {
+                       if terr, ok := err.(types.Error); ok && strings.Contains(terr.Msg, "not used") {
+                               unused[terr.Pos] = true
+                       }
+               }}
+               _, _ = conf.Check("ssa", fset, []*ast.File{file}, nil)
+               if len(unused) == 0 {
+                       break
+               }
+               pre := func(c *astutil.Cursor) bool {
+                       if node := c.Node(); node != nil && unused[node.Pos()] {
+                               c.Delete()
+                               // Unused imports and declarations use exactly
+                               // one line. Prevent leaving an empty line.
+                               tfile.MergeLine(tfile.Position(node.Pos()).Line)
+                               return false
+                       }
+                       return true
+               }
+               post := func(c *astutil.Cursor) bool {
+                       switch node := c.Node().(type) {
+                       case *ast.GenDecl:
+                               if len(node.Specs) == 0 {
+                                       c.Delete()
+                               }
+                       }
                        return true
-               })
-       default:
-               log.Fatalf("cannot walk %T", node)
-       }
-       if wb, ok := node.(interface{ body() []Statement }); ok {
-               for _, node := range wb.body() {
-                       walk(node, fn)
                }
+               file = astutil.Apply(file, pre, post).(*ast.File)
+       }
+
+       // Write the well-formatted source to file
+       f, err := os.Create("../rewrite" + arch.name + suff + ".go")
+       if err != nil {
+               log.Fatalf("can't write output: %v", err)
+       }
+       defer f.Close()
+       // gofmt result; use a buffered writer, as otherwise go/format spends
+       // far too much time in syscalls.
+       bw := bufio.NewWriter(f)
+       if err := format.Node(bw, fset, file); err != nil {
+               log.Fatalf("can't format output: %v", err)
+       }
+       if err := bw.Flush(); err != nil {
+               log.Fatalf("can't write output: %v", err)
+       }
+       if err := f.Close(); err != nil {
+               log.Fatalf("can't write output: %v", err)
        }
-       fn(nil)
 }
 
 func fprint(w io.Writer, n Node) {
@@ -333,18 +325,13 @@ func fprint(w io.Writer, n Node) {
                fmt.Fprintf(w, "// Code generated from gen/%s%s.rules; DO NOT EDIT.\n", n.arch.name, n.suffix)
                fmt.Fprintf(w, "// generated with: cd gen; go run *.go\n")
                fmt.Fprintf(w, "\npackage ssa\n")
-               // TODO(mvdan): keep the needed imports only
-               fmt.Fprintln(w, "import \"fmt\"")
-               fmt.Fprintln(w, "import \"math\"")
-               fmt.Fprintln(w, "import \"cmd/internal/obj\"")
-               fmt.Fprintln(w, "import \"cmd/internal/objabi\"")
-               fmt.Fprintln(w, "import \"cmd/compile/internal/types\"")
-               fmt.Fprintln(w, "var _ = fmt.Println   // in case not otherwise used")
-               fmt.Fprintln(w, "var _ = math.MinInt8  // in case not otherwise used")
-               fmt.Fprintln(w, "var _ = obj.ANOP      // in case not otherwise used")
-               fmt.Fprintln(w, "var _ = objabi.GOROOT // in case not otherwise used")
-               fmt.Fprintln(w, "var _ = types.TypeMem // in case not otherwise used")
-               fmt.Fprintln(w)
+               for _, path := range []string{
+                       "fmt", "math",
+                       "cmd/internal/obj", "cmd/internal/objabi",
+                       "cmd/compile/internal/types",
+               } {
+                       fmt.Fprintf(w, "import %q\n", path)
+               }
                for _, f := range n.list {
                        f := f.(*Func)
                        fmt.Fprintf(w, "func rewrite%s%s%s%s(", f.kind, n.arch.name, n.suffix, f.suffix)
index 8f896ec0c75fc5315b70ed90a50b8da8e3e973bc..812aa9420d66f49b6e0241d59924704ac53b42f6 100644 (file)
@@ -3,18 +3,9 @@
 
 package ssa
 
-import "fmt"
 import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValue386(v *Value) bool {
        switch v.Op {
        case Op386ADCL:
@@ -24539,11 +24530,7 @@ func rewriteValue386_OpZeromask_0(v *Value) bool {
        }
 }
 func rewriteBlock386(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case Block386EQ:
                // match: (EQ (InvertFlags cmp) yes no)
index 1eaf2d9d487899595e55bbd2ede055863f946f3e..b6c1989d5230b9085c047f9b26642b4bbceccdc5 100644 (file)
@@ -3,18 +3,6 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
-import "cmd/compile/internal/types"
-
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValue386splitload(v *Value) bool {
        switch v.Op {
        case Op386CMPBconstload:
@@ -168,11 +156,6 @@ func rewriteValue386splitload_Op386CMPWload_0(v *Value) bool {
        }
 }
 func rewriteBlock386splitload(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index 8c02897f71646cf26befa2ff2951928f5c1abe3f..1f888211efdd6d23bea17c0268da6496613a7745 100644 (file)
@@ -3,18 +3,9 @@
 
 package ssa
 
-import "fmt"
 import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueAMD64(v *Value) bool {
        switch v.Op {
        case OpAMD64ADCQ:
@@ -64753,10 +64744,7 @@ func rewriteValueAMD64_OpZeroExt8to64_0(v *Value) bool {
 }
 func rewriteBlockAMD64(b *Block) bool {
        config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockAMD64EQ:
                // match: (EQ (TESTL (SHLL (MOVLconst [1]) x) y))
index 0a0ff2dfbf0a5db33ad7cd07925255012d9a4288..2cccc8d4a1da02ef5e1f1a19eea2f515ab4813e1 100644 (file)
@@ -3,18 +3,6 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
-import "cmd/compile/internal/types"
-
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueAMD64splitload(v *Value) bool {
        switch v.Op {
        case OpAMD64CMPBconstload:
@@ -217,11 +205,6 @@ func rewriteValueAMD64splitload_OpAMD64CMPWload_0(v *Value) bool {
        }
 }
 func rewriteBlockAMD64splitload(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index 72c07c94c858552ab24ac5760b1c094f775202a9..6a3237497c0f6f9484853c94df1b381d2e1615eb 100644 (file)
@@ -3,18 +3,9 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
 import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueARM(v *Value) bool {
        switch v.Op {
        case OpARMADC:
@@ -21785,11 +21776,7 @@ func rewriteValueARM_OpZeromask_0(v *Value) bool {
        }
 }
 func rewriteBlockARM(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockARMEQ:
                // match: (EQ (FlagEQ) yes no)
index 9dfd848bc4ebb310ce94f75232aecfe846dc219d..fc677726dcb63761c6341a483182ffbc3510437d 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueARM64(v *Value) bool {
        switch v.Op {
        case OpARM64ADCSflags:
@@ -38293,11 +38283,7 @@ func rewriteValueARM64_OpZeroExt8to64_0(v *Value) bool {
        }
 }
 func rewriteBlockARM64(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockARM64EQ:
                // match: (EQ (CMPWconst [0] x:(ANDconst [c] y)) yes no)
index 6e0fa2b891b10350d0afd50bbd2b398afd6f2039..5ce0ec36f7181afdbea72d448e52571b1d35e878 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueMIPS(v *Value) bool {
        switch v.Op {
        case OpAdd16:
@@ -9452,11 +9442,7 @@ func rewriteValueMIPS_OpZeromask_0(v *Value) bool {
        }
 }
 func rewriteBlockMIPS(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockMIPSEQ:
                // match: (EQ (FPFlagTrue cmp) yes no)
index db104504e911f16378b898bb8831416f8aac902a..8b75c032cc82b6c28819adccc27b31a8f722d4ea 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueMIPS64(v *Value) bool {
        switch v.Op {
        case OpAdd16:
@@ -10186,11 +10176,7 @@ func rewriteValueMIPS64_OpZeroExt8to64_0(v *Value) bool {
        }
 }
 func rewriteBlockMIPS64(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockMIPS64EQ:
                // match: (EQ (FPFlagTrue cmp) yes no)
index d35cf6eeac73ad40cfd8ab9c2d8ec8f104263456..1bc16515d4aa649712b39cd4e2d0e5624320f018 100644 (file)
@@ -3,18 +3,10 @@
 
 package ssa
 
-import "fmt"
 import "math"
-import "cmd/internal/obj"
 import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValuePPC64(v *Value) bool {
        switch v.Op {
        case OpAbs:
@@ -30305,11 +30297,7 @@ func rewriteValuePPC64_OpZeroExt8to64_0(v *Value) bool {
        }
 }
 func rewriteBlockPPC64(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockPPC64EQ:
                // match: (EQ (CMPconst [0] (ANDconst [c] x)) yes no)
index fa1de9a7a6c11940a1a4c7e21290c93616d85018..2de5e1b83f421a405b9c5bbb28afae0f9a71c1e6 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueS390X(v *Value) bool {
        switch v.Op {
        case OpAdd16:
@@ -41547,9 +41537,7 @@ func rewriteValueS390X_OpZeroExt8to64_0(v *Value) bool {
 func rewriteBlockS390X(b *Block) bool {
        config := b.Func.Config
        typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockS390XEQ:
                // match: (EQ (InvertFlags cmp) yes no)
index acfbb24f104dc446332b826b14faff36aa77acb4..98ca6f69a33729fcd173da338439d6c3d61e5f1c 100644 (file)
@@ -3,18 +3,9 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
 import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValueWasm(v *Value) bool {
        switch v.Op {
        case OpAbs:
@@ -6555,11 +6546,6 @@ func rewriteValueWasm_OpZeroExt8to64_0(v *Value) bool {
        }
 }
 func rewriteBlockWasm(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index fe135821ebb96268f46bcba738700c6aca5e80fa..389e69213d3f9d9a3200cc215f7c05881e883dc0 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValuedec(v *Value) bool {
        switch v.Op {
        case OpComplexImag:
@@ -492,11 +482,6 @@ func rewriteValuedec_OpStringPtr_0(v *Value) bool {
        return false
 }
 func rewriteBlockdec(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index a67ae1ed52c1a302dc22396142d50e91df87ce5c..3c15ddefdd21c94ba75b14262ea52ffe7ecccd30 100644 (file)
@@ -3,18 +3,8 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValuedec64(v *Value) bool {
        switch v.Op {
        case OpAdd64:
@@ -2726,11 +2716,6 @@ func rewriteValuedec64_OpZeroExt8to64_0(v *Value) bool {
        }
 }
 func rewriteBlockdec64(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index 6b811297b384a8c17b1daa93b33e02849fe65599..0f6d01f22b87517fd9f0345031cab10465edb90a 100644 (file)
@@ -3,18 +3,6 @@
 
 package ssa
 
-import "fmt"
-import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
-import "cmd/compile/internal/types"
-
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValuedecArgs(v *Value) bool {
        switch v.Op {
        case OpArg:
@@ -270,11 +258,6 @@ func rewriteValuedecArgs_OpArg_10(v *Value) bool {
        return false
 }
 func rewriteBlockdecArgs(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
-       v := b.Control
-       _ = v
        switch b.Kind {
        }
        return false
index 7117f77d2481ff1ecce2515579fd428f7242af52..db0b1749a89c0d482fd2a9fed90b6ffb261054b1 100644 (file)
@@ -3,18 +3,9 @@
 
 package ssa
 
-import "fmt"
 import "math"
-import "cmd/internal/obj"
-import "cmd/internal/objabi"
 import "cmd/compile/internal/types"
 
-var _ = fmt.Println   // in case not otherwise used
-var _ = math.MinInt8  // in case not otherwise used
-var _ = obj.ANOP      // in case not otherwise used
-var _ = objabi.GOROOT // in case not otherwise used
-var _ = types.TypeMem // in case not otherwise used
-
 func rewriteValuegeneric(v *Value) bool {
        switch v.Op {
        case OpAdd16:
@@ -49166,11 +49157,7 @@ func rewriteValuegeneric_OpZeroExt8to64_0(v *Value) bool {
        return false
 }
 func rewriteBlockgeneric(b *Block) bool {
-       config := b.Func.Config
-       typ := &config.Types
-       _ = typ
        v := b.Control
-       _ = v
        switch b.Kind {
        case BlockIf:
                // match: (If (Not cond) yes no)