Fix an asan error where NumElements > 32 for at least one case in

test/CodeGen/X86/avg.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254043 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kaelyn Takata 2015-11-25 00:03:29 +00:00
parent 05dee7f1ac
commit c3219df36a

View File

@ -6244,7 +6244,7 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const {
unsigned NumZero = 0;
unsigned NumNonZero = 0;
unsigned NonZeros = 0;
uint64_t NonZeros = 0;
bool IsAllConstants = true;
SmallSet<SDValue, 8> Values;
for (unsigned i = 0; i < NumElems; ++i) {
@ -6258,7 +6258,8 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const {
if (X86::isZeroNode(Elt))
NumZero++;
else {
NonZeros |= (1 << i);
assert(i < sizeof(NonZeros) * 8); // Make sure the shift is within range.
NonZeros |= ((uint64_t)1 << i);
NumNonZero++;
}
}