From: Simon Pilgrim Date: Sat, 29 Sep 2018 14:51:09 +0000 (+0000) Subject: [X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due... X-Git-Tag: llvmorg-8.0.0-rc1~7619 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a731940c60ac5230a07657cbeae4e5432924260e;p=platform%2Fupstream%2Fllvm.git [X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due to rL343375 llvm-svn: 343377 --- diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index a71c327..ca39575 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -5748,11 +5748,15 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits, if (getTargetConstantBitsFromNode(Op.getOperand(0), EltSizeInBits, UndefElts, EltBits, AllowWholeUndefs, AllowPartialUndefs)) { + EVT SrcVT = Op.getOperand(0).getValueType(); + unsigned NumSrcElts = SrcVT.getVectorNumElements(); unsigned NumSubElts = VT.getVectorNumElements(); unsigned BaseIdx = Op.getConstantOperandVal(1); UndefElts = UndefElts.extractBits(NumSubElts, BaseIdx); - EltBits.erase(EltBits.begin() + BaseIdx + NumSubElts, EltBits.end()); - EltBits.erase(EltBits.begin(), EltBits.begin() + BaseIdx); + if ((BaseIdx + NumSubElts) != NumSrcElts) + EltBits.erase(EltBits.begin() + BaseIdx + NumSubElts, EltBits.end()); + if (BaseIdx != 0) + EltBits.erase(EltBits.begin(), EltBits.begin() + BaseIdx); return true; } }