summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/MemoryBuiltins.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-03 22:45:19 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-03 22:45:19 +0000
commitf6665f65b740a58a5fbbcb3a82cfee19a3180cb6 (patch)
treea0962f3d5e33622349fa4c1a62a93ad98e08b01e /llvm/lib/Analysis/MemoryBuiltins.cpp
parente957a9bb1bbff982e2d17debf2f574f593017f5b (diff)
downloadbcm5719-llvm-f6665f65b740a58a5fbbcb3a82cfee19a3180cb6.tar.gz
bcm5719-llvm-f6665f65b740a58a5fbbcb3a82cfee19a3180cb6.zip
[Analysis] Become aware of MSVC's new/delete functions
The compiler can take advantage of the allocation/deallocation function's properties. We knew how to do this for Itanium but had no support for MSVC-style functions. llvm-svn: 254656
Diffstat (limited to 'llvm/lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r--llvm/lib/Analysis/MemoryBuiltins.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index b4dce494153..c64be771f1f 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -62,6 +62,14 @@ static const AllocFnsTy AllocationFnData[] = {
{LibFunc::ZnajRKSt9nothrow_t, MallocLike, 2, 0, -1}, // new[](unsigned int, nothrow)
{LibFunc::Znam, OpNewLike, 1, 0, -1}, // new[](unsigned long)
{LibFunc::ZnamRKSt9nothrow_t, MallocLike, 2, 0, -1}, // new[](unsigned long, nothrow)
+ {LibFunc::msvc_new_int, OpNewLike, 1, 0, -1}, // new(unsigned int)
+ {LibFunc::msvc_new_int_nothrow, MallocLike, 2, 0, -1}, // new(unsigned int, nothrow)
+ {LibFunc::msvc_new_longlong, OpNewLike, 1, 0, -1}, // new(unsigned long long)
+ {LibFunc::msvc_new_longlong_nothrow, MallocLike, 2, 0, -1}, // new(unsigned long long, nothrow)
+ {LibFunc::msvc_new_array_int, OpNewLike, 1, 0, -1}, // new[](unsigned int)
+ {LibFunc::msvc_new_array_int_nothrow, MallocLike, 2, 0, -1}, // new[](unsigned int, nothrow)
+ {LibFunc::msvc_new_array_longlong, OpNewLike, 1, 0, -1}, // new[](unsigned long long)
+ {LibFunc::msvc_new_array_longlong_nothrow, MallocLike, 2, 0, -1}, // new[](unsigned long long, nothrow)
{LibFunc::calloc, CallocLike, 2, 0, 1},
{LibFunc::realloc, ReallocLike, 2, 1, -1},
{LibFunc::reallocf, ReallocLike, 2, 1, -1},
@@ -308,14 +316,26 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
unsigned ExpectedNumParams;
if (TLIFn == LibFunc::free ||
TLIFn == LibFunc::ZdlPv || // operator delete(void*)
- TLIFn == LibFunc::ZdaPv) // operator delete[](void*)
+ TLIFn == LibFunc::ZdaPv || // operator delete[](void*)
+ TLIFn == LibFunc::msvc_delete_ptr32 || // operator delete(void*)
+ TLIFn == LibFunc::msvc_delete_ptr64 || // operator delete(void*)
+ TLIFn == LibFunc::msvc_delete_array_ptr32 || // operator delete[](void*)
+ TLIFn == LibFunc::msvc_delete_array_ptr64) // operator delete[](void*)
ExpectedNumParams = 1;
else if (TLIFn == LibFunc::ZdlPvj || // delete(void*, uint)
TLIFn == LibFunc::ZdlPvm || // delete(void*, ulong)
TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
TLIFn == LibFunc::ZdaPvj || // delete[](void*, uint)
TLIFn == LibFunc::ZdaPvm || // delete[](void*, ulong)
- TLIFn == LibFunc::ZdaPvRKSt9nothrow_t) // delete[](void*, nothrow)
+ TLIFn == LibFunc::ZdaPvRKSt9nothrow_t || // delete[](void*, nothrow)
+ TLIFn == LibFunc::msvc_delete_ptr32_int || // delete(void*, uint)
+ TLIFn == LibFunc::msvc_delete_ptr64_longlong || // delete(void*, ulonglong)
+ TLIFn == LibFunc::msvc_delete_ptr32_nothrow || // delete(void*, nothrow)
+ TLIFn == LibFunc::msvc_delete_ptr64_nothrow || // delete(void*, nothrow)
+ TLIFn == LibFunc::msvc_delete_array_ptr32_int || // delete[](void*, uint)
+ TLIFn == LibFunc::msvc_delete_array_ptr64_longlong || // delete[](void*, ulonglong)
+ TLIFn == LibFunc::msvc_delete_array_ptr32_nothrow || // delete[](void*, nothrow)
+ TLIFn == LibFunc::msvc_delete_array_ptr64_nothrow) // delete[](void*, nothrow)
ExpectedNumParams = 2;
else
return nullptr;
OpenPOWER on IntegriCloud