[llvm] 7a5a1e9 - [IR] AttributeList::getContext has a single user, remove it.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 05:28:55 PDT 2020
Author: Benjamin Kramer
Date: 2020-05-01T14:18:29+02:00
New Revision: 7a5a1e94609c0b28ff36fe8177181464c42702df
URL: https://github.com/llvm/llvm-project/commit/7a5a1e94609c0b28ff36fe8177181464c42702df
DIFF: https://github.com/llvm/llvm-project/commit/7a5a1e94609c0b28ff36fe8177181464c42702df.diff
LOG: [IR] AttributeList::getContext has a single user, remove it.
Added:
Modified:
llvm/include/llvm/IR/Attributes.h
llvm/lib/IR/AttributeImpl.h
llvm/lib/IR/Attributes.cpp
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 20b86ed5ad4b..05c076816320 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -544,9 +544,6 @@ class AttributeList {
// AttributeList Accessors
//===--------------------------------------------------------------------===//
- /// Retrieve the LLVM context.
- LLVMContext &getContext() const;
-
/// The attributes for the specified index are returned.
AttributeSet getAttributes(unsigned Index) const;
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index 94cde85e0497..46eb4a166028 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -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 @@ class AttributeListImpl final
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 {
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 4ae69046e29f..7a8068e68184 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -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);
}
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 652baa5d0587..482c43edc909 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -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;
More information about the llvm-commits
mailing list