]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rescue stmt boundaries from OpArgXXXReg and OpSelectN.
authorDavid Chase <drchase@google.com>
Tue, 13 Apr 2021 00:53:03 +0000 (20:53 -0400)
committerDavid Chase <drchase@google.com>
Wed, 14 Apr 2021 18:46:08 +0000 (18:46 +0000)
commit4df3d0e4df734283911cf3c428d9638c9dc5af4e
tree65a4040cb386e4309172a234259139792eb7537b
parent4480c822ba37ea3795fa4dbb56d13578d7961d88
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>
src/cmd/compile/internal/dwarfgen/scope_test.go
src/cmd/compile/internal/ssa/expand_calls.go
src/cmd/compile/internal/ssa/stmtlines_test.go
src/cmd/compile/internal/ssagen/ssa.go
test/codegen/mathbits.go
test/codegen/rotate.go