forked from OSchip/llvm-project
[NFC] Rename *ByValOrInalloca* to *PassPointeeByValue*
Summary: In preparation for preallocated. Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79152
This commit is contained in:
parent
4eabd00612
commit
a90948fd6e
|
@ -151,9 +151,7 @@ inline bool IsPotentialRetainableObjPtr(const Value *Op) {
|
|||
return false;
|
||||
// Special arguments can not be a valid retainable object pointer.
|
||||
if (const Argument *Arg = dyn_cast<Argument>(Op))
|
||||
if (Arg->hasByValAttr() ||
|
||||
Arg->hasInAllocaAttr() ||
|
||||
Arg->hasNestAttr() ||
|
||||
if (Arg->hasPassPointeeByValueAttr() || Arg->hasNestAttr() ||
|
||||
Arg->hasStructRetAttr())
|
||||
return false;
|
||||
// Only consider values with pointer types.
|
||||
|
|
|
@ -71,9 +71,9 @@ public:
|
|||
/// Return true if this argument has the swifterror attribute.
|
||||
bool hasSwiftErrorAttr() const;
|
||||
|
||||
/// Return true if this argument has the byval attribute or inalloca
|
||||
/// Return true if this argument has the byval, inalloca, or preallocated
|
||||
/// attribute. These attributes represent arguments being passed by value.
|
||||
bool hasByValOrInAllocaAttr() const;
|
||||
bool hasPassPointeeByValueAttr() const;
|
||||
|
||||
/// If this is a byval or inalloca argument, return its alignment.
|
||||
/// FIXME: Remove this function once transition to Align is over.
|
||||
|
|
|
@ -1541,10 +1541,12 @@ public:
|
|||
return paramHasAttr(ArgNo, Attribute::InAlloca);
|
||||
}
|
||||
|
||||
/// Determine whether this argument is passed by value or in an alloca.
|
||||
bool isByValOrInAllocaArgument(unsigned ArgNo) const {
|
||||
/// Determine whether this argument is passed by value, in an alloca, or is
|
||||
/// preallocated.
|
||||
bool isPassPointeeByValueArgument(unsigned ArgNo) const {
|
||||
return paramHasAttr(ArgNo, Attribute::ByVal) ||
|
||||
paramHasAttr(ArgNo, Attribute::InAlloca);
|
||||
paramHasAttr(ArgNo, Attribute::InAlloca) ||
|
||||
paramHasAttr(ArgNo, Attribute::Preallocated);
|
||||
}
|
||||
|
||||
/// Determine if there are is an inalloca argument. Only the last argument can
|
||||
|
|
|
@ -673,7 +673,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitAllocaInst(AllocaInst &I) {
|
|||
|
||||
SizeOffsetType ObjectSizeOffsetVisitor::visitArgument(Argument &A) {
|
||||
// No interprocedural analysis is done at the moment.
|
||||
if (!A.hasByValOrInAllocaAttr()) {
|
||||
if (!A.hasPassPointeeByValueAttr()) {
|
||||
++ObjectVisitorArgument;
|
||||
return unknown();
|
||||
}
|
||||
|
|
|
@ -2339,7 +2339,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
|
|||
|
||||
// A byval, inalloca, or nonnull argument is never null.
|
||||
if (const Argument *A = dyn_cast<Argument>(V))
|
||||
if (A->hasByValOrInAllocaAttr() || A->hasNonNullAttr())
|
||||
if (A->hasPassPointeeByValueAttr() || A->hasNonNullAttr())
|
||||
return true;
|
||||
|
||||
// A Load tagged with nonnull metadata is never null.
|
||||
|
|
|
@ -114,11 +114,12 @@ bool Argument::hasInAllocaAttr() const {
|
|||
return hasAttribute(Attribute::InAlloca);
|
||||
}
|
||||
|
||||
bool Argument::hasByValOrInAllocaAttr() const {
|
||||
bool Argument::hasPassPointeeByValueAttr() const {
|
||||
if (!getType()->isPointerTy()) return false;
|
||||
AttributeList Attrs = getParent()->getAttributes();
|
||||
return Attrs.hasParamAttribute(getArgNo(), Attribute::ByVal) ||
|
||||
Attrs.hasParamAttribute(getArgNo(), Attribute::InAlloca);
|
||||
Attrs.hasParamAttribute(getArgNo(), Attribute::InAlloca) ||
|
||||
Attrs.hasParamAttribute(getArgNo(), Attribute::Preallocated);
|
||||
}
|
||||
|
||||
unsigned Argument::getParamAlignment() const {
|
||||
|
|
|
@ -98,7 +98,7 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F,
|
|||
AI != AE; ++AI) {
|
||||
Type *Ty = AI->getType();
|
||||
// 'Dereference' type in case of byval or inalloca parameter attribute.
|
||||
if (AI->hasByValOrInAllocaAttr())
|
||||
if (AI->hasPassPointeeByValueAttr())
|
||||
Ty = cast<PointerType>(Ty)->getElementType();
|
||||
// Size should be aligned to pointer size.
|
||||
unsigned PtrSize = DL.getPointerSize();
|
||||
|
|
|
@ -429,7 +429,7 @@ bool ARMCallLowering::lowerFormalArguments(
|
|||
for (auto &Arg : F.args()) {
|
||||
if (!isSupportedType(DL, TLI, Arg.getType()))
|
||||
return false;
|
||||
if (Arg.hasByValOrInAllocaAttr())
|
||||
if (Arg.hasPassPointeeByValueAttr())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,8 @@ bool DeadArgumentEliminationPass::RemoveDeadArgumentsFromCallers(Function &Fn) {
|
|||
bool Changed = false;
|
||||
|
||||
for (Argument &Arg : Fn.args()) {
|
||||
if (!Arg.hasSwiftErrorAttr() && Arg.use_empty() && !Arg.hasByValOrInAllocaAttr()) {
|
||||
if (!Arg.hasSwiftErrorAttr() && Arg.use_empty() &&
|
||||
!Arg.hasPassPointeeByValueAttr()) {
|
||||
if (Arg.isUsedByMetadata()) {
|
||||
Arg.replaceAllUsesWith(UndefValue::get(Arg.getType()));
|
||||
Changed = true;
|
||||
|
|
|
@ -4336,7 +4336,7 @@ static bool isSafeToEliminateVarargsCast(const CallBase &Call,
|
|||
// The size of ByVal or InAlloca arguments is derived from the type, so we
|
||||
// can't change to a type with a different size. If the size were
|
||||
// passed explicitly we could avoid this check.
|
||||
if (!Call.isByValOrInAllocaArgument(ix))
|
||||
if (!Call.isPassPointeeByValueArgument(ix))
|
||||
return true;
|
||||
|
||||
Type* SrcTy =
|
||||
|
|
|
@ -839,7 +839,7 @@ static bool handleEndBlock(BasicBlock &BB, AliasAnalysis *AA,
|
|||
// Treat byval or inalloca arguments the same, stores to them are dead at the
|
||||
// end of the function.
|
||||
for (Argument &AI : BB.getParent()->args())
|
||||
if (AI.hasByValOrInAllocaAttr())
|
||||
if (AI.hasPassPointeeByValueAttr())
|
||||
DeadStackObjects.insert(&AI);
|
||||
|
||||
const DataLayout &DL = BB.getModule()->getDataLayout();
|
||||
|
@ -1549,7 +1549,7 @@ struct DSEState {
|
|||
// Treat byval or inalloca arguments the same as Allocas, stores to them are
|
||||
// dead at the end of the function.
|
||||
for (Argument &AI : F.args())
|
||||
if (AI.hasByValOrInAllocaAttr())
|
||||
if (AI.hasPassPointeeByValueAttr())
|
||||
State.InvisibleToCallerBeforeRet.insert(&AI);
|
||||
return State;
|
||||
}
|
||||
|
|
|
@ -1242,7 +1242,7 @@ static void AddAlignmentAssumptions(CallBase &CB, InlineFunctionInfo &IFI) {
|
|||
Function *CalledFunc = CB.getCalledFunction();
|
||||
for (Argument &Arg : CalledFunc->args()) {
|
||||
unsigned Align = Arg.getType()->isPointerTy() ? Arg.getParamAlignment() : 0;
|
||||
if (Align && !Arg.hasByValOrInAllocaAttr() && !Arg.hasNUses(0)) {
|
||||
if (Align && !Arg.hasPassPointeeByValueAttr() && !Arg.hasNUses(0)) {
|
||||
if (!DTCalculated) {
|
||||
DT.recalculate(*CB.getCaller());
|
||||
DTCalculated = true;
|
||||
|
|
Loading…
Reference in New Issue