aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssagen
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-04-12 20:53:03 -0400
committerDavid Chase <drchase@google.com>2021-04-14 18:46:08 +0000
commit4df3d0e4df734283911cf3c428d9638c9dc5af4e (patch)
tree65a4040cb386e4309172a234259139792eb7537b /src/cmd/compile/internal/ssagen
parent4480c822ba37ea3795fa4dbb56d13578d7961d88 (diff)
downloadgo-4df3d0e4df734283911cf3c428d9638c9dc5af4e.tar.gz
go-4df3d0e4df734283911cf3c428d9638c9dc5af4e.zip
cmd/compile: rescue stmt boundaries from OpArgXXXReg and OpSelectN.
Fixes this failure: go test cmd/compile/internal/ssa -run TestStmtLines -v === RUN TestStmtLines stmtlines_test.go:115: Saw too many (amd64, > 1%) lines without statement marks, total=88263, nostmt=1930 ('-run TestStmtLines -v' lists failing lines) The failure has two causes. One is that the first-line adjuster in code generation was relocating "first lines" to instructions that would either not have any code generated, or would have the statment marker removed by a different believed-good heuristic. The other was that statement boundaries were getting attached to register values (that with the old ABI were loads from the stack, hence real instructions). The register values disappear at code generation. The fixes are to (1) note that certain instructions are not good choices for "first value" and skip them, and (2) in an expandCalls post-pass, look for register valued instructions and under appropriate conditions move their statement marker to a compatible use. Also updates TestStmtLines to always log the score, for easier comparison of minor compiler changes. Updates #40724. Change-Id: I485573ce900e292d7c44574adb7629cdb4695c3f Reviewed-on: https://go-review.googlesource.com/c/go/+/309649 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssagen')
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index 60a849db23..b970451624 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -6638,15 +6638,15 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
inlMarksByPos[pos] = append(inlMarksByPos[pos], p)
default:
+ // Special case for first line in function; move it to the start (which cannot be a register-valued instruction)
+ if firstPos != src.NoXPos && v.Op != ssa.OpArgIntReg && v.Op != ssa.OpArgFloatReg && v.Op != ssa.OpLoadReg && v.Op != ssa.OpStoreReg {
+ s.SetPos(firstPos)
+ firstPos = src.NoXPos
+ }
// Attach this safe point to the next
// instruction.
s.pp.NextLive = s.livenessMap.Get(v)
- // Special case for first line in function; move it to the start.
- if firstPos != src.NoXPos {
- s.SetPos(firstPos)
- firstPos = src.NoXPos
- }
// let the backend handle it
Arch.SSAGenValue(&s, v)
}