I’ve recently come across a case where Reassociate transforms a sequence of
shifts (by constant) and
adds into an
i64 multiply by a constant (non-power of 2). Whereas shifts and adds are slow but ok on the target I’m working on, an
i64 multiply is really expensive (it gets lowered to a compiler-rt call).
I went looking at TTI to figure out if I had forgotten to override some method, but Reassociate seems completely agnostic to the Target. Is this an intentional design decision, or an artifact of the fact that Reassociate is much older than TTI?
Any advice would be appreciated!