cmd/compile: superfluous MOV instructions #32969
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
Using
go1.12
onlinux/amd64
Consider the following benchmark:
This currently reports the following on my system:
I expect
BenchmarkIdeal
andBenchmarkCast
to be the same, but there is a ~1ns loss of performance.The assembly of the inner loop between
BenchmarkIdeal
andBenchmarkCast
is:It seems that although the call to
UnsafeString
is inlined, the compiler still emits a number ofMOV
instructions that seem superfluous. Ideally, the compiler would emit assembly that is functionally identical to theBenchmarkIdeal
case.The text was updated successfully, but these errors were encountered: