cmd/compile: reordering struct field accesses can alter performance #22479
What version of Go are you using (
Pasting code here:
The extra instruction doesn't really matter - it's the extra load that matters.
This is a tricky problem to solve in general, because it requires some alias analysis. Perhaps something could be done for this simpler situation (different constant offsets from the same pointer).