diff options
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
| -rw-r--r-- | lib/Analysis/ValueTracking.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index bd79cd56a18b..a5dceb6c2271 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -172,6 +172,18 @@ bool llvm::haveNoCommonBitsSet(const Value *LHS, const Value *RHS,  } +bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI) { +  for (const User *U : CxtI->users()) { +    if (const ICmpInst *IC = dyn_cast<ICmpInst>(U)) +      if (IC->isEquality()) +        if (Constant *C = dyn_cast<Constant>(IC->getOperand(1))) +          if (C->isNullValue()) +            continue; +    return false; +  } +  return true; +} +  static bool isKnownToBeAPowerOfTwo(const Value *V, bool OrZero, unsigned Depth,                                     const Query &Q); @@ -2327,6 +2339,7 @@ bool llvm::ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,    case Instruction::SExt:      if (!LookThroughSExt) return false;      // otherwise fall through to ZExt +    LLVM_FALLTHROUGH;    case Instruction::ZExt:      return ComputeMultiple(I->getOperand(0), Base, Multiple,                             LookThroughSExt, Depth+1);  | 
