1
0
mirror of https://github.com/golang/go synced 2024-11-18 17:54:57 -07:00

cmd/compile/internal/gc: skip useless loads for non-SSA params

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>
This commit is contained in:
Matthew Dempsky 2017-02-15 13:12:53 -08:00
parent 862fde81fc
commit a6b3331236

View 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
if n.Class == PPARAM && s.canSSA(n) {
s.vars[n] = s.newValue0A(ssa.OpArg, n.Type, n)
}
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)
}
s.vars[n] = v
}
// Convert the AST-based IR to the SSA-based IR