Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: suboptimal compilation of struct-valued switch statements #15164
For CL 21627, I evaluated replacing the switch statement in cmd/link/internal/ld.relSize with:
But this ends up compiling into much less efficient code than the existing idiom of combining into integer constants:
I think shouldn't be too tough to improve this a lot for pointer-free AMEM16, AMEM32, and AMEM64 values—I'm happy to look into that when it comes around on the guitar. General AMEM values should be doable, albeit more complicated. For specialized alg-type values, I suspect the only improvements will be in the back end. This particular case is AMEM16, no?
referenced this issue
Apr 14, 2016
Thinking out loud, there are at least three options for binary search over
I'll do some experimenting.