aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssagen
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-05-24 04:41:58 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-05-26 23:50:54 +0000
commit1ec056244e1a058ea3a21f0abd1165d710398416 (patch)
tree3ce7c908aa3044f6f86f3c2841f6f31fa5e578c2 /src/cmd/compile/internal/ssagen
parent6da1661371410c46af84c578d644052894226314 (diff)
downloadgo-1ec056244e1a058ea3a21f0abd1165d710398416.tar.gz
go-1ec056244e1a058ea3a21f0abd1165d710398416.zip
[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>
Diffstat (limited to 'src/cmd/compile/internal/ssagen')
-rw-r--r--src/cmd/compile/internal/ssagen/pgen.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssagen/pgen.go b/src/cmd/compile/internal/ssagen/pgen.go
index 62567535d7..93157bfa11 100644
--- a/src/cmd/compile/internal/ssagen/pgen.go
+++ b/src/cmd/compile/internal/ssagen/pgen.go
@@ -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.
lastHasPtr := false