mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[OpaquePtr] Use byval type more
This commit is contained in:
parent
a6bb782422
commit
c0c934f6d5
@ -1157,7 +1157,7 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
|
||||
// instead of the pointer itself.
|
||||
if (const Argument *A = dyn_cast<Argument>(S.first))
|
||||
if (A->hasByValAttr())
|
||||
FieldType = FieldType->getPointerElementType();
|
||||
FieldType = A->getParamByValType();
|
||||
FieldIDType Id =
|
||||
B.addField(FieldType, None, false /*header*/, true /*IsSpillOfValue*/);
|
||||
FrameData.setFieldIndex(S.first, Id);
|
||||
|
@ -139,7 +139,7 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
|
||||
++I, ++ArgNo) {
|
||||
if (ByValArgsToTransform.count(&*I)) {
|
||||
// Simple byval argument? Just add all the struct element types.
|
||||
Type *AgTy = cast<PointerType>(I->getType())->getElementType();
|
||||
Type *AgTy = I->getParamByValType();
|
||||
StructType *STy = cast<StructType>(AgTy);
|
||||
llvm::append_range(Params, STy->elements());
|
||||
ArgAttrVec.insert(ArgAttrVec.end(), STy->getNumElements(),
|
||||
@ -260,7 +260,7 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
|
||||
ArgAttrVec.push_back(CallPAL.getParamAttributes(ArgNo));
|
||||
} else if (ByValArgsToTransform.count(&*I)) {
|
||||
// Emit a GEP and load for each element of the struct.
|
||||
Type *AgTy = cast<PointerType>(I->getType())->getElementType();
|
||||
Type *AgTy = I->getParamByValType();
|
||||
StructType *STy = cast<StructType>(AgTy);
|
||||
Value *Idxs[2] = {
|
||||
ConstantInt::get(Type::getInt32Ty(F->getContext()), 0), nullptr};
|
||||
@ -387,7 +387,7 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
|
||||
Instruction *InsertPt = &NF->begin()->front();
|
||||
|
||||
// Just add all the struct element types.
|
||||
Type *AgTy = cast<PointerType>(I->getType())->getElementType();
|
||||
Type *AgTy = I->getParamByValType();
|
||||
Align StructAlign = *I->getParamAlign();
|
||||
Value *TheAlloca = new AllocaInst(AgTy, DL.getAllocaAddrSpace(), nullptr,
|
||||
StructAlign, "", InsertPt);
|
||||
|
@ -1583,7 +1583,7 @@ bool MemCpyOptPass::processByValArgument(CallBase &CB, unsigned ArgNo) {
|
||||
const DataLayout &DL = CB.getCaller()->getParent()->getDataLayout();
|
||||
// Find out what feeds this byval argument.
|
||||
Value *ByValArg = CB.getArgOperand(ArgNo);
|
||||
Type *ByValTy = cast<PointerType>(ByValArg->getType())->getElementType();
|
||||
Type *ByValTy = CB.getParamByValType(ArgNo);
|
||||
uint64_t ByValSize = DL.getTypeAllocSize(ByValTy);
|
||||
MemoryLocation Loc(ByValArg, LocationSize::precise(ByValSize));
|
||||
MemCpyInst *MDep = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user