[PATCH] Fix an assert in legalization caused by 81f64c04
escha
escha at apple.com
Fri May 29 11:07:21 PDT 2015
> On May 29, 2015, at 11:05 AM, Matt Arsenault <arsenm2 at gmail.com> wrote:
>
>
>> On May 29, 2015, at 10:51 AM, escha <escha at apple.com <mailto:escha at apple.com>> wrote:
>>
>>
>> /// Returns a type large enough to hold any valid shift amount - before type
>> /// legalization these can be huge.
>> EVT getShiftAmountTy(EVT LHSTy) {
>> assert(LHSTy.isInteger() && "Shift amount is not an integer type!");
>> if (LHSTy.isVector())
>> return LHSTy;
>> return LegalTypes ? TLI.getScalarShiftAmountTy(LHSTy)
>> : TLI.getPointerTy();
>> }
>>
>
> I didn’t know about this one. Why does this exist? This seems insane. Does anything break if you replace everything with TLI.getShiftAmountTy()?
If I understand correctly, the reasoning is like this…
On x86:
MVT getScalarShiftAmountTy(EVT LHSTy) const override { return MVT::i8; }
But prior to legalization you can have large types, e.g. i1024, whose shift amounts won’t fit in i8. So you need to allow larger shift types.
—escha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/41f51d2b/attachment.html>
More information about the llvm-commits
mailing list