diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 16:37:51 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 16:37:51 +0000 |
| commit | fd4777c046f8eba820c27cbcf5072b6ad0a95a8d (patch) | |
| tree | dcf76d70223cc9622ae2fc1e92490e16c4fb4fcc /llvm/lib/Analysis/InstructionSimplify.cpp | |
| parent | 30d249a1b33697d73b30076937ea3b6e7af39454 (diff) | |
| download | bcm5719-llvm-fd4777c046f8eba820c27cbcf5072b6ad0a95a8d.tar.gz bcm5719-llvm-fd4777c046f8eba820c27cbcf5072b6ad0a95a8d.zip | |
Teach MemoryBuiltins and InstructionSimplify that operator new never returns NULL.
This is safe per C++11 18.6.1.1p3: [operator new returns] a non-null pointer to
suitably aligned storage (3.7.4), or else throw a bad_alloc exception. This
requirement is binding on a replacement version of this function.
Brings us a tiny bit closer to eliminating more vector push_backs.
llvm-svn: 191310
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
| -rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index af65cb74083..b867af1dc3d 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -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)); |

