diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-09-13 12:38:49 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-09-13 12:38:49 +0000 |
commit | 0bd147da174309fe295c592ef36c6229dc99f727 (patch) | |
tree | 7fbc152c07942bbc24ea0f2fa4c2bb288bd042cd /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | ce65c060e7df3291b4010cca024b042b6fa3a0ca (diff) | |
download | llvm-0bd147da174309fe295c592ef36c6229dc99f727.zip llvm-0bd147da174309fe295c592ef36c6229dc99f727.tar.gz llvm-0bd147da174309fe295c592ef36c6229dc99f727.tar.bz2 |
Simplify code. No functionality change.
llvm-svn: 217726
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index e6f0d99..8d09f52 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -683,31 +683,19 @@ static void UpdateCallGraphAfterInlining(CallSite CS, static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M, BasicBlock *InsertBlock, InlineFunctionInfo &IFI) { - LLVMContext &Context = Src->getContext(); - Type *VoidPtrTy = Type::getInt8PtrTy(Context); Type *AggTy = cast<PointerType>(Src->getType())->getElementType(); - Type *Tys[3] = { VoidPtrTy, VoidPtrTy, Type::getInt64Ty(Context) }; - Function *MemCpyFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys); - IRBuilder<> builder(InsertBlock->begin()); - Value *DstCast = builder.CreateBitCast(Dst, VoidPtrTy, "tmp"); - Value *SrcCast = builder.CreateBitCast(Src, VoidPtrTy, "tmp"); + IRBuilder<> Builder(InsertBlock->begin()); Value *Size; if (IFI.DL == nullptr) Size = ConstantExpr::getSizeOf(AggTy); else - Size = ConstantInt::get(Type::getInt64Ty(Context), - IFI.DL->getTypeStoreSize(AggTy)); + Size = Builder.getInt64(IFI.DL->getTypeStoreSize(AggTy)); // Always generate a memcpy of alignment 1 here because we don't know // the alignment of the src pointer. Other optimizations can infer // better alignment. - Value *CallArgs[] = { - DstCast, SrcCast, Size, - ConstantInt::get(Type::getInt32Ty(Context), 1), - ConstantInt::getFalse(Context) // isVolatile - }; - builder.CreateCall(MemCpyFn, CallArgs); + Builder.CreateMemCpy(Dst, Src, Size, /*Align=*/1); } /// HandleByValArgument - When inlining a call site that has a byval argument, |