[InstCombine] make sure type is integer before calling ComputeNumSignBits

llvm-svn: 344610
This commit is contained in:
Sanjay Patel 2018-10-16 14:44:50 +00:00
parent 0c48c977b8
commit f6a7c8b1fc
1 changed files with 2 additions and 1 deletions

View File

@ -1834,7 +1834,8 @@ static bool areInverseVectorBitmasks(Constant *C1, Constant *C2) {
Value *InstCombiner::getSelectCondition(Value *A, Value *B) {
// Step 1: We need 0 or all-1's bitmasks.
Type *Ty = A->getType();
if (ComputeNumSignBits(A) != Ty->getScalarSizeInBits())
if (Ty->isIntOrIntVectorTy() &&
ComputeNumSignBits(A) != Ty->getScalarSizeInBits())
return nullptr;
// Step 2: If B is the 'not' value of A, we have our answer.