[InstCombine] make sure type is integer before calling ComputeNumSignBits
authorSanjay Patel <spatel@rotateright.com>
Tue, 16 Oct 2018 14:44:50 +0000 (14:44 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 16 Oct 2018 14:44:50 +0000 (14:44 +0000)
llvm-svn: 344610

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index 5ffbf83..ecda713 100644 (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.