mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-06 18:46:18 +00:00
Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9f4b17d14a
commit
e853a8665e
@ -683,31 +683,19 @@ static void UpdateCallGraphAfterInlining(CallSite CS,
|
|||||||
static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M,
|
static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M,
|
||||||
BasicBlock *InsertBlock,
|
BasicBlock *InsertBlock,
|
||||||
InlineFunctionInfo &IFI) {
|
InlineFunctionInfo &IFI) {
|
||||||
LLVMContext &Context = Src->getContext();
|
|
||||||
Type *VoidPtrTy = Type::getInt8PtrTy(Context);
|
|
||||||
Type *AggTy = cast<PointerType>(Src->getType())->getElementType();
|
Type *AggTy = cast<PointerType>(Src->getType())->getElementType();
|
||||||
Type *Tys[3] = { VoidPtrTy, VoidPtrTy, Type::getInt64Ty(Context) };
|
IRBuilder<> Builder(InsertBlock->begin());
|
||||||
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");
|
|
||||||
|
|
||||||
Value *Size;
|
Value *Size;
|
||||||
if (IFI.DL == nullptr)
|
if (IFI.DL == nullptr)
|
||||||
Size = ConstantExpr::getSizeOf(AggTy);
|
Size = ConstantExpr::getSizeOf(AggTy);
|
||||||
else
|
else
|
||||||
Size = ConstantInt::get(Type::getInt64Ty(Context),
|
Size = Builder.getInt64(IFI.DL->getTypeStoreSize(AggTy));
|
||||||
IFI.DL->getTypeStoreSize(AggTy));
|
|
||||||
|
|
||||||
// Always generate a memcpy of alignment 1 here because we don't know
|
// Always generate a memcpy of alignment 1 here because we don't know
|
||||||
// the alignment of the src pointer. Other optimizations can infer
|
// the alignment of the src pointer. Other optimizations can infer
|
||||||
// better alignment.
|
// better alignment.
|
||||||
Value *CallArgs[] = {
|
Builder.CreateMemCpy(Dst, Src, Size, /*Align=*/1);
|
||||||
DstCast, SrcCast, Size,
|
|
||||||
ConstantInt::get(Type::getInt32Ty(Context), 1),
|
|
||||||
ConstantInt::getFalse(Context) // isVolatile
|
|
||||||
};
|
|
||||||
builder.CreateCall(MemCpyFn, CallArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// HandleByValArgument - When inlining a call site that has a byval argument,
|
/// HandleByValArgument - When inlining a call site that has a byval argument,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user