Assert that the insertion index is in range and use uint64_t for the index to fix MSVC/cppcheck truncation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365025
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!isa<ConstantSDNode>(N2))
return SDValue();
auto *N2C = cast<ConstantSDNode>(N2);
- unsigned IdxVal = N2C->getZExtValue();
+ assert(N2C->getAPIntValue().ult(NumElts) && "Out of range element index");
+ uint64_t IdxVal = N2C->getZExtValue();
bool IsZeroElt = X86::isZeroNode(N1);
bool IsAllOnesElt = VT.isInteger() && llvm::isAllOnesConstant(N1);