Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: inline small static initializers #18872

Closed
randall77 opened this issue Jan 31, 2017 · 3 comments
Closed

cmd/compile: inline small static initializers #18872

randall77 opened this issue Jan 31, 2017 · 3 comments

Comments

@randall77
Copy link
Contributor

type T struct {
	a, b, c, d int
}
func f(p *T) {
	*p = T{1, 2, 3, 4}
}

The code for f is:

(tmp1.go:8)	MOVQ	"".statictmp_0(SB), AX
(tmp1.go:8)	MOVQ	"".statictmp_0+8(SB), CX
(tmp1.go:8)	MOVQ	"".statictmp_0+16(SB), DX
(tmp1.go:8)	MOVQ	"".statictmp_0+24(SB), BX
(tmp1.go:8)	MOVQ	"".p+8(FP), SI
(tmp1.go:8)	MOVQ	AX, (SI)
(tmp1.go:8)	MOVQ	CX, 8(SI)
(tmp1.go:8)	MOVQ	DX, 16(SI)
(tmp1.go:8)	MOVQ	BX, 24(SI)

That's kind of dumb to copy from a statictmp. Just use MOVQ $1, (SI) and so forth.

@josharian
Copy link
Contributor

This was broken by the fix to #12841. The trick here is to figure out how to selectively disable that optimization so that #12841 doesn't regress.

@josharian josharian self-assigned this May 10, 2017
@josharian
Copy link
Contributor

CL shortly.

@gopherbot
Copy link

CL https://golang.org/cl/43154 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants