Teach MemoryBuiltins and InstructionSimplify that operator new never returns NULL.
[oota-llvm.git] / lib / Analysis / InstructionSimplify.cpp
index af65cb74083409359fe1c4130ec0abebdac23964..b867af1dc3de2ce72fbc4939f8fdb5806b005e33 100644 (file)
@@ -1739,7 +1739,7 @@ static Constant *computePointerICmp(const DataLayout *TD,
   RHS = RHS->stripPointerCasts();
 
   // A non-null pointer is not equal to a null pointer.
-  if (llvm::isKnownNonNull(LHS) && isa<ConstantPointerNull>(RHS) &&
+  if (llvm::isKnownNonNull(LHS, TLI) && isa<ConstantPointerNull>(RHS) &&
       (Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE))
     return ConstantInt::get(GetCompareTy(LHS),
                             !CmpInst::isTrueWhenEqual(Pred));