aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-02 06:05:42 +0000
committerChris Lattner <sabre@nondot.org>2009-12-02 06:05:42 +0000
commit262590904ae923498bc704da374110de14289a2a (patch)
tree0a917bfbcfd3b3b2c63f613fb59364e01995bb94 /lib/Transforms
parent53f9966b7a5454affde814ceb105c7f26f330617 (diff)
downloadexternal_llvm-262590904ae923498bc704da374110de14289a2a.zip
external_llvm-262590904ae923498bc704da374110de14289a2a.tar.gz
external_llvm-262590904ae923498bc704da374110de14289a2a.tar.bz2
tidy up, remove dependence on order of evaluation of function args from EmitMemCpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index f9b929c..0d03e55 100644
--- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -128,8 +128,7 @@ public:
/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
Value *LibCallOptimization::CastToCStr(Value *V, IRBuilder<> &B) {
- return
- B.CreateBitCast(V, Type::getInt8PtrTy(*Context), "cstr");
+ return B.CreateBitCast(V, Type::getInt8PtrTy(*Context), "cstr");
}
/// EmitStrLen - Emit a call to the strlen function to the builder, for the
@@ -157,27 +156,25 @@ Value *LibCallOptimization::EmitStrLen(Value *Ptr, IRBuilder<> &B) {
Value *LibCallOptimization::EmitMemCpy(Value *Dst, Value *Src, Value *Len,
unsigned Align, IRBuilder<> &B) {
Module *M = Caller->getParent();
- Intrinsic::ID IID = Intrinsic::memcpy;
- const Type *Tys[1];
- Tys[0] = Len->getType();
- Value *MemCpy = Intrinsic::getDeclaration(M, IID, Tys, 1);
- return B.CreateCall4(MemCpy, CastToCStr(Dst, B), CastToCStr(Src, B), Len,
+ const Type *Ty = Len->getType();
+ Value *MemCpy = Intrinsic::getDeclaration(M, Intrinsic::memcpy, &Ty, 1);
+ Dst = CastToCStr(Dst, B);
+ Src = CastToCStr(Src, B);
+ return B.CreateCall4(MemCpy, Dst, Src, Len,
ConstantInt::get(Type::getInt32Ty(*Context), Align));
}
-/// EmitMemMOve - Emit a call to the memmove function to the builder. This
+/// EmitMemMove - Emit a call to the memmove function to the builder. This
/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
Value *LibCallOptimization::EmitMemMove(Value *Dst, Value *Src, Value *Len,
unsigned Align, IRBuilder<> &B) {
Module *M = Caller->getParent();
- Intrinsic::ID IID = Intrinsic::memmove;
- const Type *Tys[1];
- Tys[0] = TD->getIntPtrType(*Context);
- Value *MemMove = Intrinsic::getDeclaration(M, IID, Tys, 1);
- Value *D = CastToCStr(Dst, B);
- Value *S = CastToCStr(Src, B);
+ const Type *Ty = TD->getIntPtrType(*Context);
+ Value *MemMove = Intrinsic::getDeclaration(M, Intrinsic::memmove, &Ty, 1);
+ Dst = CastToCStr(Dst, B);
+ Src = CastToCStr(Src, B);
Value *A = ConstantInt::get(Type::getInt32Ty(*Context), Align);
- return B.CreateCall4(MemMove, D, S, Len, A);
+ return B.CreateCall4(MemMove, Dst, Src, Len, A);
}
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is