Check and return early for ConstantPointerNull and UndefValue
specifically in isKnownNonNullAt, and assert that ConstantData never
make it to isKnownNonNullFromDominatingCondition.
This confirms that isKnownNonNullFromDominatingCondition never walks
through the use-list of an instance of ConstantData. Given that such
use-lists cross module boundaries, it never really made sense to do so,
and was potentially very expensive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282333
91177308-0d34-0410-b5e6-
96231b3b80d8
const Instruction *CtxI,
const DominatorTree *DT) {
assert(V->getType()->isPointerTy() && "V must be pointer type");
+ assert(!isa<ConstantData>(V) && "Did not expect ConstantPointerNull");
unsigned NumUsesExplored = 0;
for (auto *U : V->users()) {
bool llvm::isKnownNonNullAt(const Value *V, const Instruction *CtxI,
const DominatorTree *DT) {
+ if (isa<ConstantPointerNull>(V) || isa<UndefValue>(V))
+ return false;
+
if (isKnownNonNull(V))
return true;