[llvm-commits] [PATCH] Fix for PR 14652 and 14740

Akira Hatanaka ahatanak at gmail.com
Thu Jan 17 19:54:12 PST 2013


Probably these were not really bugs in this context, but I think using Op1
instead of Op2 makes more sense to people who read this code.

On Thu, Jan 17, 2013 at 7:47 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:

> I created a new patch which factors out the code in
> SelectionDAGBuilder::visitShift and fixes the bug I mentioned in my
> previous email.
>
> Note that, in the patch, I also fixed two lines in
> SelectionDAGBuilder::visitShift, which I think are bugs (please correct me
> if I am wrong). I believe these bugs haven't caused any problems in
> practice, but I think it is still important to fix them.
>
> First, we should pass the type of LHS (the shiftee), not the type of the
> RHS (shift amount), to getShiftAmountTy:
>
> -  MVT ShiftTy = TLI.getShiftAmountTy(Op2.getValueType());
>
> Second, we should compute the log of the size of the LHS (the shiftee)
> when we decide whether ShiftSize is large enough:
>
> -    else if (ShiftSize >=
> Log2_32_Ceil(Op2.getValueType().getSizeInBits()))
>
>
>
> On Thu, Jan 17, 2013 at 2:38 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>
>> On Tue, Jan 15, 2013 at 2:51 PM, Akira Hatanaka <ahatanak at gmail.com>
>> wrote:
>> >
>> > The attached patch is an attempt to fix the following bugs:
>> >
>> > http://llvm.org/bugs/show_bug.cgi?id=14652
>> > http://llvm.org/bugs/show_bug.cgi?id=14740
>> >
>> > It fixes the code which scalarizes vector shifts and ensures that the
>> type
>> > of the shift amount operand is the type TargetLowering::getShiftAmountTy
>> > returns. This is the same approach taken in
>> SelectionDAGBuilder::visitShift.
>> >
>> > The command that was failing in 14652 passes after this patch is applied
>> > and fixes 14740 as well.
>>
>> The approach seems fine.  Can you factor out the logic into a utility
>> function?
>>
>> -Eli
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130117/b3dee6bb/attachment.html>


More information about the llvm-commits mailing list