mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
[dev.typeparams] cmd/compile: inlining tweaks for toolstash
This CL makes to minor changes motivated by making it easier to make large-scale changes to the inliner while satisfying toolstash -cmp: 1. When creating inlining variables, make sure to preserve the AutoTemp flag. This is necessary so that temporary variables introduced by rewriting f(g()) calls during typecheck stay autotemp after inlining and are (correctly) omitted from DWARF debugging information. 2. When sorting variables for stack frame layout, use a stable sort. This ensures that layout is insensitive to whether deadcode elimination happens before or after inlining. Change-Id: I672e752a873c7e16749b9873fd6573607e074309 Reviewed-on: https://go-review.googlesource.com/c/go/+/323011 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
6da1661371
commit
1ec056244e
|
@ -1029,6 +1029,7 @@ func inlvar(var_ *ir.Name) *ir.Name {
|
||||||
n.SetType(var_.Type())
|
n.SetType(var_.Type())
|
||||||
n.Class = ir.PAUTO
|
n.Class = ir.PAUTO
|
||||||
n.SetUsed(true)
|
n.SetUsed(true)
|
||||||
|
n.SetAutoTemp(var_.AutoTemp())
|
||||||
n.Curfn = ir.CurFunc // the calling function, not the called one
|
n.Curfn = ir.CurFunc // the calling function, not the called one
|
||||||
n.SetAddrtaken(var_.Addrtaken())
|
n.SetAddrtaken(var_.Addrtaken())
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,10 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(byStackVar(fn.Dcl))
|
// Use sort.Stable instead of sort.Sort so stack layout (and thus
|
||||||
|
// compiler output) is less sensitive to frontend changes that
|
||||||
|
// introduce or remove unused variables.
|
||||||
|
sort.Stable(byStackVar(fn.Dcl))
|
||||||
|
|
||||||
// Reassign stack offsets of the locals that are used.
|
// Reassign stack offsets of the locals that are used.
|
||||||
lastHasPtr := false
|
lastHasPtr := false
|
||||||
|
|
Loading…
Reference in a new issue