summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-07-03 10:59:52 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-07-03 10:59:52 +0000
commit8df90b843d15c1d60b978609ec05d98921c3e191 (patch)
tree71ac22f26ff7eba76df79a7d4b8838a27c80845f /llvm/lib
parent8853bd9592038ccb13210ac2c3a8103eed97f05a (diff)
downloadbcm5719-llvm-8df90b843d15c1d60b978609ec05d98921c3e191.tar.gz
bcm5719-llvm-8df90b843d15c1d60b978609ec05d98921c3e191.zip
[X86][SSE] LowerINSERT_VECTOR_ELT - ensure insertion index correctness. NFCI.
Assert that the insertion index is in range and use uint64_t for the index to fix MSVC/cppcheck truncation warning. llvm-svn: 365025
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6050b9217ce..53890af9702 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -17094,7 +17094,8 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
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);
OpenPOWER on IntegriCloud