[llvm-branch-commits] [llvm-branch] r68493 - in /llvm/branches/Apple/Dib: lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/StrCat.ll
Bill Wendling
isanbard at gmail.com
Mon Apr 6 21:32:25 PDT 2009
Author: void
Date: Mon Apr 6 23:32:25 2009
New Revision: 68493
URL: http://llvm.org/viewvc/llvm-project?rev=68493&view=rev
Log:
--- Merging (from foreign repository) r68443 into '.':
U test/Transforms/SimplifyLibCalls/StrCat.ll
U lib/Transforms/Scalar/SimplifyLibCalls.cpp
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!
Modified:
llvm/branches/Apple/Dib/lib/Transforms/Scalar/SimplifyLibCalls.cpp
llvm/branches/Apple/Dib/test/Transforms/SimplifyLibCalls/StrCat.ll
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=68493&r1=68492&r2=68493&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/SimplifyLibCalls.cpp Mon Apr 6 23:32:25 2009
@@ -514,11 +514,11 @@
// 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;
}
};
Modified: llvm/branches/Apple/Dib/test/Transforms/SimplifyLibCalls/StrCat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/SimplifyLibCalls/StrCat.ll?rev=68493&r1=68492&r2=68493&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/SimplifyLibCalls/StrCat.ll (original)
+++ llvm/branches/Apple/Dib/test/Transforms/SimplifyLibCalls/StrCat.ll Mon Apr 6 23:32:25 2009
@@ -1,6 +1,9 @@
; Test that the StrCatOptimizer works correctly
+; PR3661
; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
; RUN: not grep {call.*strcat}
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: grep {puts.*%arg1}
@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
More information about the llvm-branch-commits
mailing list