While doing https://go-review.googlesource.com/c/go/+/637936/3 I tested it on some code of mine and it failed to mark many of my functions pure because one callgraph leaf use a const string as a LUT.
This would also allow the compiler to reorder theses loads with stores which could help regalloc among other things.
For an example I made up this very simple function:
func hexDigit(x uint8) rune {
return rune("0123456789abcdef"[x & 0b1111])
}
You can see that the Load op takes memory as an argument when this is not needed.

In this context we should model [] as an odd arithmetic operator by removing it's memory argument.
Chances I'll come back to this at some point.
While doing https://go-review.googlesource.com/c/go/+/637936/3 I tested it on some code of mine and it failed to mark many of my functions pure because one callgraph leaf use a
const stringas a LUT.This would also allow the compiler to reorder theses loads with stores which could help regalloc among other things.
For an example I made up this very simple function:
You can see that the Load op takes memory as an argument when this is not needed.

In this context we should model
[]as an odd arithmetic operator by removing it's memory argument.Chances I'll come back to this at some point.