[llvm] r254043 - Fix an asan error where NumElements > 32 for at least one case in
Kaelyn Takata via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 24 16:03:30 PST 2015
Author: rikka
Date: Tue Nov 24 18:03:29 2015
New Revision: 254043
URL: http://llvm.org/viewvc/llvm-project?rev=254043&view=rev
Log:
Fix an asan error where NumElements > 32 for at least one case in
test/CodeGen/X86/avg.ll.
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=254043&r1=254042&r2=254043&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Nov 24 18:03:29 2015
@@ -6244,7 +6244,7 @@ X86TargetLowering::LowerBUILD_VECTOR(SDV
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(SDV
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++;
}
}
More information about the llvm-commits
mailing list