[Patch] Fix for ExpandShiftWithUnknownAmountBit when shift amount is zero

Hello,

A while back I submitted a patch for this function. The patch, added in revision 90482, left the case of a shift by zero undefined. Attached is another patch to deal with that condition.

Thanks,

Javier

LegalizeIntegerTypes.cpp.patch (3.41 KB)

Hi Javier,

This patch seems ok, but it will pessimize all of the existing targets, which produce an undefined result on overflow instead of performing an undefined operation. Does your target really produce undefined behavior on this condition, or does it just produce an undefined result?

If you really need to get this in, please add a new TargetLowering hook (along the same lines of getShiftAmountTy() which would return an enum indicating the behavior on overflow. The legalize code can then use this hook to determine if it needs to generate the extra code.

Thanks!

-Chris