diff options
author | David Bolvansky <david.bolvansky@gmail.com> | 2019-09-17 10:12:48 +0000 |
---|---|---|
committer | David Bolvansky <david.bolvansky@gmail.com> | 2019-09-17 10:12:48 +0000 |
commit | be2487a2ba43f3929c894e8cf8fe3ddb0b9c6a24 (patch) | |
tree | 342efda7d6566f80cd109f3b6576a49da36d6d0a /llvm/lib/Analysis/MemoryBuiltins.cpp | |
parent | 3a3dddd9d72edecc774efaee153e876fe74fed6c (diff) | |
download | bcm5719-llvm-be2487a2ba43f3929c894e8cf8fe3ddb0b9c6a24.tar.gz bcm5719-llvm-be2487a2ba43f3929c894e8cf8fe3ddb0b9c6a24.zip |
[InstCombine] Annotate strdup with deref_or_null
llvm-svn: 372098
Diffstat (limited to 'llvm/lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryBuiltins.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index 52f31238227..5acdeb64a40 100644 --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/lib/Analysis/MemoryBuiltins.cpp @@ -307,6 +307,13 @@ bool llvm::isOpNewLikeFn(const Value *V, const TargetLibraryInfo *TLI, return getAllocationData(V, OpNewLike, TLI, LookThroughBitCast).hasValue(); } +/// Tests if a value is a call or invoke to a library function that +/// allocates memory (strdup, strndup). +bool llvm::isStrdupLikeFn(const Value *V, const TargetLibraryInfo *TLI, + bool LookThroughBitCast) { + return getAllocationData(V, StrDupLike, TLI, LookThroughBitCast).hasValue(); +} + /// extractMallocCall - Returns the corresponding CallInst if the instruction /// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we /// ignore InvokeInst here. |