[LLVMdev] [Patch] Fix for ExpandShiftWithUnknownAmountBit when shift amount is zero

Chris Lattner clattner at apple.com
Mon Oct 4 09:34:28 PDT 2010


On Aug 24, 2010, at 5:58 PM, Martinez, Javier E wrote:

> 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.
>  

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101004/7df18508/attachment.html>


More information about the llvm-dev mailing list