mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191310 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user