Currently reassociateShiftAmtsOfTwoSameDirectionShifts() only handles two shifts one after another.
If the shifts are shl, we still can easily perform the fold, with no extra legality checks:
https://rise4fun.com/Alive/OQbM
If we have right-shift however, we won't be able to make it any simpler than it already is.
After this the only thing missing here is constant-folding: (NewShAmt >= bitwidth(X))
- If it's a logical shift, then constant-fold to 0 (not undef)
- If it's a ashr, then a splat of original signbit
https://rise4fun.com/Alive/E1K
https://rise4fun.com/Alive/i0V