Turning (op x (mul y k)) into (op x (lsl (mul y k>>n) n)) is beneficial when we can do the lsl as a shifted operand and the resulting multiply constant is simpler to generate.
Do this by doing the transformation when trying to select a shifted operand, as that ensures that it actually turns out better (the alternative would be to do it in PreprocessISelDAG, but we don't know for sure there if extracting the shift would allow a shifted operand to be used).
I think this should just return true/false, and let the caller change the constant at the same time as applying the shift.
My worry is if you use this in an if() with other statements, like:
and "SomeOtherTest()" fails, returning with the changed constant but not applying the shift.