Use a utility from MathExtras to clarify a check and avoid undefined behavior. Based on patch by Ahmed Charles.

llvm-svn: 141829
This commit is contained in:
Eli Friedman 2011-10-12 22:46:45 +00:00
parent 000721f058
commit 979009ea61
1 changed files with 1 additions and 1 deletions

View File

@ -1679,7 +1679,7 @@ void SelectionDAGBuilder::visitBitTestHeader(BitTestBlock &B,
UsePtrType = true; UsePtrType = true;
else { else {
for (unsigned i = 0, e = B.Cases.size(); i != e; ++i) for (unsigned i = 0, e = B.Cases.size(); i != e; ++i)
if ((uint64_t)((int64_t)B.Cases[i].Mask >> VT.getSizeInBits()) + 1 >= 2) { if (!isUIntN(VT.getSizeInBits(), B.Cases[i].Mask)) {
// Switch table case range are encoded into series of masks. // Switch table case range are encoded into series of masks.
// Just use pointer type, it's guaranteed to fit. // Just use pointer type, it's guaranteed to fit.
UsePtrType = true; UsePtrType = true;