[llvm] r343377 - [X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due to rL343375

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 29 07:51:10 PDT 2018


Author: rksimon
Date: Sat Sep 29 07:51:09 2018
New Revision: 343377

URL: http://llvm.org/viewvc/llvm-project?rev=343377&view=rev
Log:
[X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due to rL343375

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=343377&r1=343376&r2=343377&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Sep 29 07:51:09 2018
@@ -5748,11 +5748,15 @@ static bool getTargetConstantBitsFromNod
     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;
     }
   }




More information about the llvm-commits mailing list