[IR] AttributeList::getContext has a single user, remove it.

This commit is contained in:
Benjamin Kramer 2020-05-01 14:18:29 +02:00
parent 1c3fe86f0f
commit 7a5a1e9460
4 changed files with 10 additions and 18 deletions

View File

@ -544,9 +544,6 @@ public:
// AttributeList Accessors
//===--------------------------------------------------------------------===//
/// Retrieve the LLVM context.
LLVMContext &getContext() const;
/// The attributes for the specified index are returned.
AttributeSet getAttributes(unsigned Index) const;

View File

@ -266,7 +266,6 @@ class AttributeListImpl final
friend TrailingObjects;
private:
LLVMContext &Context;
unsigned NumAttrSets; ///< Number of entries in this set.
/// Bitset with a bit for each available attribute Attribute::AttrKind.
uint8_t AvailableFunctionAttrs[12] = {};
@ -275,15 +274,12 @@ private:
size_t numTrailingObjects(OverloadToken<AttributeSet>) { return NumAttrSets; }
public:
AttributeListImpl(LLVMContext &C, ArrayRef<AttributeSet> Sets);
AttributeListImpl(ArrayRef<AttributeSet> Sets);
// AttributesSetImpt is uniqued, these should not be available.
AttributeListImpl(const AttributeListImpl &) = delete;
AttributeListImpl &operator=(const AttributeListImpl &) = delete;
/// Get the context that created this AttributeListImpl.
LLVMContext &getContext() { return Context; }
/// Return true if the AttributeSet or the FunctionIndex has an
/// enum attribute of the given kind.
bool hasFnAttribute(Attribute::AttrKind Kind) const {

View File

@ -974,9 +974,8 @@ static constexpr unsigned attrIdxToArrayIdx(unsigned Index) {
return Index == AttributeList::FunctionIndex ? 0 : Index + 1;
}
AttributeListImpl::AttributeListImpl(LLVMContext &C,
ArrayRef<AttributeSet> Sets)
: Context(C), NumAttrSets(Sets.size()) {
AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
: NumAttrSets(Sets.size()) {
assert(!Sets.empty() && "pointless AttributeListImpl");
// There's memory after the node where we can store the entries in.
@ -1035,7 +1034,7 @@ AttributeList AttributeList::getImpl(LLVMContext &C,
void *Mem = pImpl->Alloc.Allocate(
AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.size()),
alignof(AttributeListImpl));
PA = new (Mem) AttributeListImpl(C, AttrSets);
PA = new (Mem) AttributeListImpl(AttrSets);
pImpl->AttrsLists.InsertNode(PA, InsertPoint);
}
@ -1360,8 +1359,6 @@ AttributeList::addAllocSizeAttr(LLVMContext &C, unsigned Index,
// AttributeList Accessor Methods
//===----------------------------------------------------------------------===//
LLVMContext &AttributeList::getContext() const { return pImpl->getContext(); }
AttributeSet AttributeList::getParamAttributes(unsigned ArgNo) const {
return getAttributes(ArgNo + FirstArgIndex);
}

View File

@ -1260,7 +1260,8 @@ normalizeForInvokeSafepoint(BasicBlock *BB, BasicBlock *InvokeParent,
// Create new attribute set containing only attributes which can be transferred
// from original call to the safepoint.
static AttributeList legalizeCallAttributes(AttributeList AL) {
static AttributeList legalizeCallAttributes(LLVMContext &Ctx,
AttributeList AL) {
if (AL.isEmpty())
return AL;
@ -1274,7 +1275,6 @@ static AttributeList legalizeCallAttributes(AttributeList AL) {
}
// Just skip parameter and return attributes for now
LLVMContext &Ctx = AL.getContext();
return AttributeList::get(Ctx, AttributeList::FunctionIndex,
AttributeSet::get(Ctx, FnAttrs));
}
@ -1520,7 +1520,8 @@ makeStatepointExplicitImpl(CallBase *Call, /* to replace */
// function attributes. In case if we can handle this set of attributes -
// set up function attrs directly on statepoint and return attrs later for
// gc_result intrinsic.
SPCall->setAttributes(legalizeCallAttributes(CI->getAttributes()));
SPCall->setAttributes(
legalizeCallAttributes(CI->getContext(), CI->getAttributes()));
Token = SPCall;
@ -1546,7 +1547,8 @@ makeStatepointExplicitImpl(CallBase *Call, /* to replace */
// function attributes. In case if we can handle this set of attributes -
// set up function attrs directly on statepoint and return attrs later for
// gc_result intrinsic.
SPInvoke->setAttributes(legalizeCallAttributes(II->getAttributes()));
SPInvoke->setAttributes(
legalizeCallAttributes(II->getContext(), II->getAttributes()));
Token = SPInvoke;