PR7750: !CExpr->isNullValue() only properly computes whether CExpr is nonnull
authorEli Friedman <eli.friedman@gmail.com>
Thu, 29 Jul 2010 18:03:33 +0000 (18:03 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 29 Jul 2010 18:03:33 +0000 (18:03 +0000)
if CExpr is a ConstantInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCompares.cpp

index 6c00586412ac16e49acc4256de35ce8d79689989..d7e2b72b7fac5dce64fe6852e1405ccd5265b16a 100644 (file)
@@ -1374,7 +1374,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
       case Instruction::Or:
         // If bits are being or'd in that are not present in the constant we
         // are comparing against, then the comparison could never succeed!
-        if (Constant *BOC = dyn_cast<Constant>(BO->getOperand(1))) {
+        if (ConstantInt *BOC = dyn_cast<ConstantInt>(BO->getOperand(1))) {
           Constant *NotCI = ConstantExpr::getNot(RHS);
           if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue())
             return ReplaceInstUsesWith(ICI,