From 4df3d0e4df734283911cf3c428d9638c9dc5af4e Mon Sep 17 00:00:00 2001 From: David Chase Date: Mon, 12 Apr 2021 20:53:03 -0400 Subject: 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 Run-TryBot: David Chase TryBot-Result: Go Bot Reviewed-by: Cherry Zhang --- test/codegen/mathbits.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test/codegen/mathbits.go') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index fff6639546..03012eff5d 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -118,7 +118,7 @@ func Len8(n uint8) int { // bits.OnesCount // // -------------------- // -// amd64:".*x86HasPOPCNT" +// TODO(register args) Restore a m d 6 4 :.*x86HasPOPCNT when only one ABI is tested. func OnesCount(n uint) int { // amd64:"POPCNTQ" // arm64:"VCNT","VUADDLV" @@ -129,7 +129,6 @@ func OnesCount(n uint) int { return bits.OnesCount(n) } -// amd64:".*x86HasPOPCNT" func OnesCount64(n uint64) int { // amd64:"POPCNTQ" // arm64:"VCNT","VUADDLV" @@ -140,7 +139,6 @@ func OnesCount64(n uint64) int { return bits.OnesCount64(n) } -// amd64:".*x86HasPOPCNT" func OnesCount32(n uint32) int { // amd64:"POPCNTL" // arm64:"VCNT","VUADDLV" @@ -151,7 +149,6 @@ func OnesCount32(n uint32) int { return bits.OnesCount32(n) } -// amd64:".*x86HasPOPCNT" func OnesCount16(n uint16) int { // amd64:"POPCNTL" // arm64:"VCNT","VUADDLV" -- cgit v1.3