From 2fc395659c798b834d57ab79809fc4de09bf4191 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 11 Mar 2010 20:45:13 +0000 Subject: stpcpy is so similar to strcpy, it doesn't deserve a complete copy of the __strcpy_chk -> strcpy code. llvm-svn: 98284 --- llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp') diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp index c428d2b0b0c..c26d74d0857 100644 --- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -620,25 +620,13 @@ bool CodeGenPrepare::OptimizeCallInst(CallInst *CI) { return 0; } - if (Name == "__strcpy_chk") { + if (Name == "__strcpy_chk" || Name == "__stpcpy_chk") { ConstantInt *SizeCI = dyn_cast(CI->getOperand(3)); if (!SizeCI) return 0; if (SizeCI->isAllOnesValue()) { - Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD); - CI->replaceAllUsesWith(Ret); - CI->eraseFromParent(); - return true; - } - return 0; - } - - if (Name == "__stpcpy_chk") { - ConstantInt *SizeCI = dyn_cast(CI->getOperand(3)); - if (!SizeCI) - return 0; - if (SizeCI->isAllOnesValue()) { - Value *Ret = EmitStpCpy(CI->getOperand(1), CI->getOperand(2), B, TD); + Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD, + Name.substr(2, 6)); CI->replaceAllUsesWith(Ret); CI->eraseFromParent(); return true; -- cgit v1.2.3