hi,
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