diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -4127,6 +4127,8 @@ /// Return a SCEV corresponding to ~V = -1-V const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) { + assert(!V->getType()->isPointerTy() && "Can't negate pointer"); + if (const SCEVConstant *VC = dyn_cast(V)) return getConstant( cast(ConstantExpr::getNot(VC->getValue()))); @@ -10673,7 +10675,8 @@ return isImpliedCondOperands(Pred, LHS, RHS, FoundRHS, FoundLHS, Context); // Don't try to getNotSCEV pointers. - if (LHS->getType()->isPointerTy() || FoundLHS->getType()->isPointerTy()) + if (LHS->getType()->isPointerTy() || RHS->getType()->isPointerTy() || + FoundLHS->getType()->isPointerTy() || FoundRHS->getType()->isPointerTy()) return false; // There's no clear preference between forms 3. and 4., try both.