Why do we need transform the shl to mul in ReassociatePass?

In most target, the shl instruction’s cost is cheeper than mul, so we’ll transform most the mul instructions into shl ASAP.
While I also see some pass, eg ReassociatePass will transform the mul into shl without other optimizetion together. And in the later combine pass, we transform the mul back into shl, so my question is why we need such transform in ReassociatePass ?

  • a case show the transform in ReassociatePass :
%sub104 = shl i64 %sub.ptr.sub.neg, 32 -> %sub104 = mul i64 %sub.ptr.sub.neg, 4294967296

I think ReassociatePass in particular transforms it so it can more easily apply its “mul” optimizations to shifts. If it were written today, we’d probably wouldn’t do it that way, but I don’t think anyone has really looked at reassociate in a while.

Thanks you.