You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: merging shifts into loads/stores isn't complete #36223
We can use the (AX*8) indexing mode and get rid of the shift.
There is already code to do this in the compiler. However, it doesn't fire in this case, as the shift amount is in the "wrong" arugment slot.
The SSA representation is (MOVQstoreconstidx1 [5] (SHLQconst [3] v) x y). Normally these rules are written to expect the pointer first, then the shifted index, so it does not fire in this case (shifted index first, then pointer).
We should mark ops like these as commutative on the first two args, so the rewrite engine will detect this correctly. There is even a comment in the rule file:
// TODO: mark the MOVXstoreidx1 ops as commutative. Generates too many rewrite rules at the moment.
I think our rewrite engine now handles commutative ops more efficiently, so possibly not an issue anymore. Investigate, and do it.
However, I don't think we handle commutative ops any more efficiently yet. Do you have plans to work on this? I've been contemplating different approaches.
I mailed CLs 213697-213704. They start with cleanup and improvement with the existing commutativity regime, then replace it. There's probably more to do here, but I've blown through the time I allotted to this. I'll file issues for follow-up ideas.
Activity
josharian commentedon Jan 5, 2020
I did some related work in https://go-review.googlesource.com/c/go/+/167089 and https://go-review.googlesource.com/c/go/+/167090. I have better tooling now, so I may try to improve these and try again for 1.15.
However, I don't think we handle commutative ops any more efficiently yet. Do you have plans to work on this? I've been contemplating different approaches.
randall77 commentedon Jan 5, 2020
I have not made any plans yet. Go for it.
gopherbot commentedon Jan 7, 2020
Change https://golang.org/cl/213704 mentions this issue:
cmd/compile: merge more shifts into storesjosharian commentedon Jan 7, 2020
I mailed CLs 213697-213704. They start with cleanup and improvement with the existing commutativity regime, then replace it. There's probably more to do here, but I've blown through the time I allotted to this. I'll file issues for follow-up ideas.
josharian commentedon Feb 20, 2020
I write in the CL “may fix” this issue. GitHub ignored the first word. :P
Leaving to @randall77 to decide what else needs to happen to declare this fixed.
randall77 commentedon Mar 10, 2020
This is fixed with CL 217097.