]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: skip useless loads for non-SSA params
authorMatthew Dempsky <mdempsky@google.com>
Wed, 15 Feb 2017 21:12:53 +0000 (13:12 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 15 Feb 2017 23:12:43 +0000 (23:12 +0000)
Change-Id: I78ca43a0f0a6a162a2ade1352e2facb29432d4ac
Reviewed-on: https://go-review.googlesource.com/37102
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 21f6e651d8db7bd3eb1c652e816bd679d5e726de..403e03f9ff08d56fa47c4e618608c72f6ac430a8 100644 (file)
@@ -120,19 +120,11 @@ func buildssa(fn *Node) *ssa.Func {
                }
        }
 
-       // Populate arguments.
+       // Populate SSAable arguments.
        for _, n := range fn.Func.Dcl {
-               if n.Class != PPARAM {
-                       continue
-               }
-               var v *ssa.Value
-               if s.canSSA(n) {
-                       v = s.newValue0A(ssa.OpArg, n.Type, n)
-               } else {
-                       // Not SSAable. Load it.
-                       v = s.newValue2(ssa.OpLoad, n.Type, s.decladdrs[n], s.startmem)
+               if n.Class == PPARAM && s.canSSA(n) {
+                       s.vars[n] = s.newValue0A(ssa.OpArg, n.Type, n)
                }
-               s.vars[n] = v
        }
 
        // Convert the AST-based IR to the SSA-based IR