diff options
author | Davide Italiano <davide@freebsd.org> | 2015-11-18 22:29:38 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2015-11-18 22:29:38 +0000 |
commit | 455ea11d13a1f88d8c5c65f78ef21a81efab8f22 (patch) | |
tree | 968a026159c297b5f1871326eb3a8992c67c142d /llvm | |
parent | 223f4bb9b2a77f7786dbcb6d6e7216a0667a4e39 (diff) | |
download | bcm5719-llvm-455ea11d13a1f88d8c5c65f78ef21a81efab8f22.tar.gz bcm5719-llvm-455ea11d13a1f88d8c5c65f78ef21a81efab8f22.zip |
[BuildLibCalls] EmitStrNLen() is dead code. Garbage collect.
llvm-svn: 253514
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp index 8aa7b2a65ba..f5c992c805e 100644 --- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -55,32 +55,6 @@ Value *llvm::EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout &DL, return CI; } -/// EmitStrNLen - Emit a call to the strnlen function to the builder, for the -/// specified pointer. Ptr is required to be some pointer type, MaxLen must -/// be of size_t type, and the return value has 'intptr_t' type. -Value *llvm::EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B, - const DataLayout &DL, const TargetLibraryInfo *TLI) { - if (!TLI->has(LibFunc::strnlen)) - return nullptr; - - Module *M = B.GetInsertBlock()->getParent()->getParent(); - AttributeSet AS[2]; - AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); - Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; - AS[1] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs); - - LLVMContext &Context = B.GetInsertBlock()->getContext(); - Constant *StrNLen = - M->getOrInsertFunction("strnlen", AttributeSet::get(M->getContext(), AS), - DL.getIntPtrType(Context), B.getInt8PtrTy(), - DL.getIntPtrType(Context), nullptr); - CallInst *CI = B.CreateCall(StrNLen, {CastToCStr(Ptr, B), MaxLen}, "strnlen"); - if (const Function *F = dyn_cast<Function>(StrNLen->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); - - return CI; -} - /// EmitStrChr - Emit a call to the strchr function to the builder, for the /// specified pointer and character. Ptr is required to be some pointer type, /// and the return value has 'i8*' type. |