projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8853bd9
)
[X86][SSE] LowerINSERT_VECTOR_ELT - ensure insertion index correctness. NFCI.
author
Simon Pilgrim
<llvm-dev@redking.me.uk>
Wed, 3 Jul 2019 10:59:52 +0000
(10:59 +0000)
committer
Simon Pilgrim
<llvm-dev@redking.me.uk>
Wed, 3 Jul 2019 10:59:52 +0000
(10:59 +0000)
Assert that the insertion index is in range and use uint64_t for the index to fix MSVC/cppcheck truncation warning.
llvm-svn: 365025
llvm/lib/Target/X86/X86ISelLowering.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Target/X86/X86ISelLowering.cpp
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index
6050b92
..
53890af
100644
(file)
--- 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);