diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-03-11 20:45:13 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-03-11 20:45:13 +0000 |
| commit | 7fa30b8e5d2774867787a4e4db17bf27358e5aac (patch) | |
| tree | 4d9e0bcb0ca26dc548a838a82992a0f5a4409e92 /lib/Transforms/Scalar/CodeGenPrepare.cpp | |
| parent | c6678b0014f915de8010fcfbb39461d371a5ca52 (diff) | |
| download | llvm-7fa30b8e5d2774867787a4e4db17bf27358e5aac.tar.gz llvm-7fa30b8e5d2774867787a4e4db17bf27358e5aac.tar.bz2 llvm-7fa30b8e5d2774867787a4e4db17bf27358e5aac.tar.xz | |
stpcpy is so similar to strcpy, it doesn't deserve a complete copy of the __strcpy_chk -> strcpy code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index c428d2b0b0..c26d74d085 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/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<ConstantInt>(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<ConstantInt>(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; |
