[PATCH] Fix an assert in legalization caused by 81f64c04

escha escha at apple.com
Fri May 29 10:51:36 PDT 2015


> On May 29, 2015, at 10:42 AM, Matt Arsenault <arsenm2 at gmail.com> wrote:
> 
> 
>> On May 29, 2015, at 10:25 AM, Fiona <escha at apple.com <mailto:escha at apple.com>> wrote:
>> 
>>  On an out of tree target, the shift type is i64 (because that's the pointer type, and pre-legalization, shifts are created with shift type == pointer type). 
> 
> Shifts should be using TLI::getShiftAmountTy() during SelectionDAGBuilder, so not ever the pointer type. Are you not overriding that?


The shift in question is created by the DAGCombiner, here:

      SDValue Shift = DAG.getNode(ISD::SRA, DL, XType,
                                  N0,
                                  DAG.getConstant(XType.getSizeInBits() - 1, DL,
                                         getShiftAmountTy(N0.getValueType())));

getShiftAmountTy, also in the DAGCombiner, does this:

    /// 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();
    }

Note how it uses PointerTy prior to legalization.

—escha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/705e39bc/attachment.html>


More information about the llvm-commits mailing list