diff options
author | Ed Schouten <ed@80386.nl> | 2009-04-06 13:06:48 +0000 |
---|---|---|
committer | Ed Schouten <ed@80386.nl> | 2009-04-06 13:06:48 +0000 |
commit | 5b9fc263ae4393b035cdb7734855e3c7085ccc0e (patch) | |
tree | f3f1b594b7be486b140c8c5ed8d7fd663d5a0ea3 /lib/Transforms | |
parent | 4ab710ddbd5a068277094c22ed759e4e7f456e14 (diff) | |
download | external_llvm-5b9fc263ae4393b035cdb7734855e3c7085ccc0e.zip external_llvm-5b9fc263ae4393b035cdb7734855e3c7085ccc0e.tar.gz external_llvm-5b9fc263ae4393b035cdb7734855e3c7085ccc0e.tar.bz2 |
Let the strcat optimizer return the pointer to the start of the buffer,
instead of the place where it started to perform the string copy.
- PR3661
- Patch by Benjamin Kramer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/SimplifyLibCalls.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index b878e4b..c84c233 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -514,11 +514,11 @@ struct VISIBILITY_HIDDEN StrCatOpt : public LibCallOptimization { // Now that we have the destination's length, we must index into the // destination's pointer to get the actual memcpy destination (end of // the string .. we're concatenating). - Dst = B.CreateGEP(Dst, DstLen, "endptr"); + Value *CpyDst = B.CreateGEP(Dst, DstLen, "endptr"); // We have enough information to now generate the memcpy call to do the // concatenation for us. Make a memcpy to copy the nul byte with align = 1. - EmitMemCpy(Dst, Src, ConstantInt::get(TD->getIntPtrType(), Len+1), 1, B); + EmitMemCpy(CpyDst, Src, ConstantInt::get(TD->getIntPtrType(), Len+1), 1, B); return Dst; } }; |