[llvm] r367953 - [Attributor] Introduce the IRAttribute helper struct
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 16:35:12 PDT 2019
Author: jdoerfert
Date: Mon Aug 5 16:35:12 2019
New Revision: 367953
URL: http://llvm.org/viewvc/llvm-project?rev=367953&view=rev
Log:
[Attributor] Introduce the IRAttribute helper struct
Summary:
Certain properties, e.g., an AttrKind, are not shared among all abstract
attributes. This patch extracts the functionality into a helper struct.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65712
Modified:
llvm/trunk/include/llvm/Transforms/IPO/Attributor.h
llvm/trunk/lib/Transforms/IPO/Attributor.cpp
Modified: llvm/trunk/include/llvm/Transforms/IPO/Attributor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/Attributor.h?rev=367953&r1=367952&r2=367953&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/Attributor.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/Attributor.h Mon Aug 5 16:35:12 2019
@@ -60,12 +60,12 @@
// manifest their result in the IR for passes to come.
//
// Attribute manifestation is not mandatory. If desired, there is support to
-// generate a single LLVM-IR attribute already in the AbstractAttribute base
-// class. In the simplest case, a subclass initializes the IRPosition properly
-// and overloads `AbstractAttribute::getAttrKind()` to return the appropriate
-// value. The Attributor manifestation framework will then create and place a
-// new attribute if it is allowed to do so (based on the abstract state). Other
-// use cases can be achieved by overloading other abstract attribute methods.
+// generate a single or multiple LLVM-IR attributes already in the helper struct
+// IRAttribute. In the simplest case, a subclass inherits from IRAttribute with
+// a proper Attribute::AttrKind as template parameter. The Attributor
+// manifestation framework will then create and place a new attribute if it is
+// allowed to do so (based on the abstract state). Other use cases can be
+// achieved by overloading AbstractAttribute or IRAttribute methods.
//
//
// The "mechanics" of adding a new "abstract attribute":
@@ -544,6 +544,12 @@ struct IRPosition {
"Expected a valid argument index!");
}
+#define IRPositionConstructorForward(NAME, BASE) \
+ explicit NAME(Argument &Arg) : BASE(Arg) {} \
+ explicit NAME(Function &Fn, IRPosition::Kind PK) : BASE(Fn, PK) {} \
+ NAME(Value *AssociatedVal, Value &AnchorVal, unsigned ArgumentNo) \
+ : BASE(AssociatedVal, AnchorVal, ArgumentNo) {}
+
IRPosition(const IRPosition &AAP)
: IRPosition(AAP.AssociatedVal, AAP.AnchorVal, AAP.AttributeIdx) {}
@@ -627,6 +633,36 @@ protected:
int AttributeIdx;
};
+/// Helper class that provides common functionality to manifest IR attributes.
+template <Attribute::AttrKind AK, typename Base>
+struct IRAttribute : public IRPosition, public Base {
+
+ /// Constructors for the IRPosition.
+ ///
+ ///{
+ IRPositionConstructorForward(IRAttribute, IRPosition);
+ ///}
+
+ /// See AbstractAttribute::manifest(...).
+ virtual ChangeStatus manifest(Attributor &A);
+
+ /// Return the kind that identifies the abstract attribute implementation.
+ Attribute::AttrKind getAttrKind() const { return AK; }
+
+ /// Return the deduced attributes in \p Attrs.
+ virtual void getDeducedAttributes(LLVMContext &Ctx,
+ SmallVectorImpl<Attribute> &Attrs) const {
+ Attrs.emplace_back(Attribute::get(Ctx, getAttrKind()));
+ }
+
+ /// Return an IR position, see struct IRPosition.
+ ///
+ ///{
+ IRPosition &getIRPosition() { return *this; }
+ const IRPosition &getIRPosition() const { return *this; }
+ ///}
+};
+
/// Base struct for all "concrete attribute" deductions.
///
/// The abstract attribute is a minimal interface that allows the Attributor to
@@ -691,15 +727,6 @@ struct AbstractAttribute {
/// Return an IR position, see struct IRPosition.
virtual const IRPosition &getIRPosition() const = 0;
- /// Return the kind that identifies the abstract attribute implementation.
- virtual Attribute::AttrKind getAttrKind() const = 0;
-
- /// Return the deduced attributes in \p Attrs.
- virtual void getDeducedAttributes(SmallVectorImpl<Attribute> &Attrs) const {
- LLVMContext &Ctx = getIRPosition().getAnchorScope().getContext();
- Attrs.emplace_back(Attribute::get(Ctx, getAttrKind()));
- }
-
/// Helper functions, for debug purposes only.
///{
virtual void print(raw_ostream &OS) const;
@@ -725,7 +752,9 @@ protected:
/// represented by the abstract attribute in the LLVM-IR.
///
/// \Return CHANGED if the IR was altered, otherwise UNCHANGED.
- virtual ChangeStatus manifest(Attributor &A);
+ virtual ChangeStatus manifest(Attributor &A) {
+ return ChangeStatus::UNCHANGED;
+ }
/// Return an IR position, see struct IRPosition.
virtual IRPosition &getIRPosition() = 0;
@@ -764,7 +793,9 @@ Pass *createAttributorLegacyPass();
/// ----------------------------------------------------------------------------
/// An abstract attribute for the returned values of a function.
-struct AAReturnedValues : public AbstractAttribute {
+struct AAReturnedValues
+ : public IRAttribute<Attribute::Returned, AbstractAttribute> {
+ IRPositionConstructorForward(AAReturnedValues, IRAttribute);
/// Check \p Pred on all returned values.
///
@@ -775,21 +806,12 @@ struct AAReturnedValues : public Abstrac
std::function<bool(Value &, const SmallPtrSetImpl<ReturnInst *> &)> &Pred)
const = 0;
- /// See AbstractAttribute::getAttrKind()
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::Returned;
- }
-
/// Unique ID (due to the unique address)
static const char ID;
};
-struct AANoUnwind : public AbstractAttribute {
-
- /// See AbstractAttribute::getAttrKind()/
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::NoUnwind;
- }
+struct AANoUnwind : public IRAttribute<Attribute::NoUnwind, AbstractAttribute> {
+ IRPositionConstructorForward(AANoUnwind, IRAttribute);
/// Returns true if nounwind is assumed.
virtual bool isAssumedNoUnwind() const = 0;
@@ -801,10 +823,8 @@ struct AANoUnwind : public AbstractAttri
static const char ID;
};
-struct AANoSync : public AbstractAttribute {
-
- /// See AbstractAttribute::getAttrKind().
- Attribute::AttrKind getAttrKind() const override { return Attribute::NoSync; }
+struct AANoSync : public IRAttribute<Attribute::NoSync, AbstractAttribute> {
+ IRPositionConstructorForward(AANoSync, IRAttribute);
/// Returns true if "nosync" is assumed.
virtual bool isAssumedNoSync() const = 0;
@@ -817,7 +837,8 @@ struct AANoSync : public AbstractAttribu
};
/// An abstract interface for all nonnull attributes.
-struct AANonNull : public AbstractAttribute {
+struct AANonNull : public IRAttribute<Attribute::NonNull, AbstractAttribute> {
+ IRPositionConstructorForward(AANonNull, IRAttribute);
/// Return true if we assume that the underlying value is nonnull.
virtual bool isAssumedNonNull() const = 0;
@@ -825,22 +846,14 @@ struct AANonNull : public AbstractAttrib
/// Return true if we know that underlying value is nonnull.
virtual bool isKnownNonNull() const = 0;
- /// See AbastractState::getAttrKind().
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::NonNull;
- }
-
/// Unique ID (due to the unique address)
static const char ID;
};
/// An abstract attribute for norecurse.
-struct AANoRecurse : public AbstractAttribute {
-
- /// See AbstractAttribute::getAttrKind()
- virtual Attribute::AttrKind getAttrKind() const override {
- return Attribute::NoRecurse;
- }
+struct AANoRecurse
+ : public IRAttribute<Attribute::NoRecurse, AbstractAttribute> {
+ IRPositionConstructorForward(AANoRecurse, IRAttribute);
/// Return true if "norecurse" is known.
virtual bool isKnownNoRecurse() const = 0;
@@ -853,12 +866,9 @@ struct AANoRecurse : public AbstractAttr
};
/// An abstract attribute for willreturn.
-struct AAWillReturn : public AbstractAttribute {
-
- /// See AbstractAttribute::getAttrKind()
- virtual Attribute::AttrKind getAttrKind() const override {
- return Attribute::WillReturn;
- }
+struct AAWillReturn
+ : public IRAttribute<Attribute::WillReturn, AbstractAttribute> {
+ IRPositionConstructorForward(AAWillReturn, IRAttribute);
/// Return true if "willreturn" is known.
virtual bool isKnownWillReturn() const = 0;
@@ -871,7 +881,8 @@ struct AAWillReturn : public AbstractAtt
};
/// An abstract interface for all noalias attributes.
-struct AANoAlias : public AbstractAttribute {
+struct AANoAlias : public IRAttribute<Attribute::NoAlias, AbstractAttribute> {
+ IRPositionConstructorForward(AANoAlias, IRAttribute);
/// Return true if we assume that the underlying value is alias.
virtual bool isAssumedNoAlias() const = 0;
@@ -879,17 +890,27 @@ struct AANoAlias : public AbstractAttrib
/// Return true if we know that underlying value is noalias.
virtual bool isKnownNoAlias() const = 0;
- /// See AbastractState::getAttrKind().
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::NoAlias;
- }
+ /// Unique ID (due to the unique address)
+ static const char ID;
+};
+
+/// An AbstractAttribute for nofree.
+struct AANoFree : public IRAttribute<Attribute::NoFree, AbstractAttribute> {
+ IRPositionConstructorForward(AANoFree, IRAttribute);
+
+ /// Return true if "nofree" is known.
+ virtual bool isKnownNoFree() const = 0;
+
+ /// Return true if "nofree" is assumed.
+ virtual bool isAssumedNoFree() const = 0;
/// Unique ID (due to the unique address)
static const char ID;
};
/// An AbstractAttribute for noreturn.
-struct AANoReturn : public AbstractAttribute {
+struct AANoReturn : public IRAttribute<Attribute::NoReturn, AbstractAttribute> {
+ IRPositionConstructorForward(AANoReturn, IRAttribute);
/// Return true if the underlying object is known to never return.
virtual bool isKnownNoReturn() const = 0;
@@ -897,20 +918,13 @@ struct AANoReturn : public AbstractAttri
/// Return true if the underlying object is assumed to never return.
virtual bool isAssumedNoReturn() const = 0;
- /// See AbstractAttribute::getAttrKind()
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::NoReturn;
- }
-
/// Unique ID (due to the unique address)
static const char ID;
};
/// An abstract interface for liveness abstract attribute.
-struct AAIsDead : public AbstractAttribute {
-
- /// See AbstractAttribute::getAttrKind()
- Attribute::AttrKind getAttrKind() const override { return Attribute::None; }
+struct AAIsDead : public AbstractAttribute, public IRPosition {
+ IRPositionConstructorForward(AAIsDead, IRPosition);
/// Returns true if \p BB is assumed dead.
virtual bool isAssumedDead(const BasicBlock *BB) const = 0;
@@ -938,12 +952,21 @@ struct AAIsDead : public AbstractAttribu
return false;
}
+ /// Return an IR position, see struct IRPosition.
+ ///
+ ///{
+ IRPosition &getIRPosition() { return *this; }
+ const IRPosition &getIRPosition() const { return *this; }
+ ///}
+
/// Unique ID (due to the unique address)
static const char ID;
};
/// An abstract interface for all dereferenceable attribute.
-struct AADereferenceable : public AbstractAttribute {
+struct AADereferenceable
+ : public IRAttribute<Attribute::Dereferenceable, AbstractAttribute> {
+ IRPositionConstructorForward(AADereferenceable, IRAttribute);
/// Return true if we assume that the underlying value is nonnull.
virtual bool isAssumedNonNull() const = 0;
@@ -965,17 +988,13 @@ struct AADereferenceable : public Abstra
/// Return known dereferenceable bytes.
virtual uint32_t getKnownDereferenceableBytes() const = 0;
- /// See AbastractState::getAttrKind().
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::Dereferenceable;
- }
-
/// Unique ID (due to the unique address)
static const char ID;
};
/// An abstract interface for all align attributes.
-struct AAAlign : public AbstractAttribute {
+struct AAAlign : public IRAttribute<Attribute::Alignment, AbstractAttribute> {
+ IRPositionConstructorForward(AAAlign, IRAttribute);
/// Return assumed alignment.
virtual unsigned getAssumedAlign() const = 0;
@@ -983,11 +1002,6 @@ struct AAAlign : public AbstractAttribut
/// Return known alignemnt.
virtual unsigned getKnownAlign() const = 0;
- /// See AbastractState::getAttrKind().
- Attribute::AttrKind getAttrKind() const override {
- return Attribute::Alignment;
- }
-
/// Unique ID (due to the unique address)
static const char ID;
};
Modified: llvm/trunk/lib/Transforms/IPO/Attributor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Attributor.cpp?rev=367953&r1=367952&r2=367953&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Attributor.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Attributor.cpp Mon Aug 5 16:35:12 2019
@@ -332,21 +332,21 @@ ChangeStatus AbstractAttribute::update(A
return HasChanged;
}
-ChangeStatus AbstractAttribute::manifest(Attributor &A) {
- assert(getState().isValidState() &&
+template <Attribute::AttrKind AK, typename Base>
+ChangeStatus IRAttribute<AK, Base>::manifest(Attributor &A) {
+ assert(this->getState().isValidState() &&
"Attempted to manifest an invalid state!");
assert(getIRPosition().getAssociatedValue() &&
"Attempted to manifest an attribute without associated value!");
ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
- IRPosition &Pos = getIRPosition();
- Function &ScopeFn = Pos.getAnchorScope();
+ Function &ScopeFn = getAnchorScope();
LLVMContext &Ctx = ScopeFn.getContext();
- IRPosition::Kind PK = Pos.getPositionKind();
+ IRPosition::Kind PK = getPositionKind();
SmallVector<Attribute, 4> DeducedAttrs;
- getDeducedAttributes(DeducedAttrs);
+ getDeducedAttributes(Ctx, DeducedAttrs);
// In the following some generic code that will manifest attributes in
// DeducedAttrs if they improve the current IR. Due to the different
@@ -360,12 +360,12 @@ ChangeStatus AbstractAttribute::manifest
Attrs = ScopeFn.getAttributes();
break;
case IRPosition::IRP_CALL_SITE_ARGUMENT:
- Attrs = ImmutableCallSite(&Pos.getAnchorValue()).getAttributes();
+ Attrs = ImmutableCallSite(&getAnchorValue()).getAttributes();
break;
}
for (const Attribute &Attr : DeducedAttrs) {
- if (!addIfNotExistent(Ctx, Attr, Attrs, Pos.getAttrIdx()))
+ if (!addIfNotExistent(Ctx, Attr, Attrs, getAttrIdx()))
continue;
HasChanged = ChangeStatus::CHANGED;
@@ -382,7 +382,7 @@ ChangeStatus AbstractAttribute::manifest
ScopeFn.setAttributes(Attrs);
break;
case IRPosition::IRP_CALL_SITE_ARGUMENT:
- CallSite(&Pos.getAnchorValue()).setAttributes(Attrs);
+ CallSite(&getAnchorValue()).setAttributes(Attrs);
}
return HasChanged;
@@ -390,18 +390,8 @@ ChangeStatus AbstractAttribute::manifest
/// -----------------------NoUnwind Function Attribute--------------------------
-#define IRPositionConstructorForward(NAME) \
- NAME(Argument &Arg) : IRPosition(Arg) {} \
- NAME(Function &Fn, IRPosition::Kind PK) : IRPosition(Fn, PK) {} \
- NAME(Value *AssociatedVal, Value &AnchorVal, unsigned ArgumentNo) \
- : IRPosition(AssociatedVal, AnchorVal, ArgumentNo) {}
-#define IRPositionGetter(IRP) \
- IRPosition &getIRPosition() override { return IRP; } \
- const IRPosition &getIRPosition() const override { return IRP; }
-
-struct AANoUnwindImpl : AANoUnwind, BooleanState, IRPosition {
- IRPositionConstructorForward(AANoUnwindImpl);
- IRPositionGetter(*this);
+struct AANoUnwindImpl : AANoUnwind, BooleanState {
+ IRPositionConstructorForward(AANoUnwindImpl, AANoUnwind);
/// See AbstractAttribute::getState()
/// {
@@ -465,9 +455,7 @@ ChangeStatus AANoUnwindImpl::updateImpl(
///
/// If there is a unique returned value R, the manifest method will:
/// - mark R with the "returned" attribute, if R is an argument.
-class AAReturnedValuesImpl : public AAReturnedValues,
- public AbstractState,
- public IRPosition {
+class AAReturnedValuesImpl : public AAReturnedValues, public AbstractState {
/// Mapping of values potentially returned by the associated function to the
/// return instructions that might return them.
@@ -504,8 +492,7 @@ class AAReturnedValuesImpl : public AARe
}
public:
- IRPositionConstructorForward(AAReturnedValuesImpl);
- IRPositionGetter(*this);
+ IRPositionConstructorForward(AAReturnedValuesImpl, AAReturnedValues);
/// See AbstractAttribute::initialize(...).
void initialize(Attributor &A, InformationCache &InfoCache) override {
@@ -621,7 +608,7 @@ ChangeStatus AAReturnedValuesImpl::manif
if (auto *UniqueRVArg = dyn_cast<Argument>(UniqueRV.getValue())) {
setAssociatedValue(UniqueRVArg);
setAttributeIdx(UniqueRVArg->getArgNo() + AttributeList::FirstArgIndex);
- Changed = AbstractAttribute::manifest(A) | Changed;
+ Changed = IRAttribute::manifest(A) | Changed;
}
return Changed;
@@ -821,9 +808,8 @@ ChangeStatus AAReturnedValuesImpl::updat
/// ------------------------ NoSync Function Attribute -------------------------
-struct AANoSyncImpl : AANoSync, BooleanState, IRPosition {
- IRPositionConstructorForward(AANoSyncImpl);
- IRPositionGetter(*this);
+struct AANoSyncImpl : AANoSync, BooleanState {
+ IRPositionConstructorForward(AANoSyncImpl, AANoSync);
/// See AbstractAttribute::getState()
/// {
@@ -1011,9 +997,8 @@ ChangeStatus AANoSyncImpl::updateImpl(At
/// ------------------------ No-Free Attributes ----------------------------
-struct AANoFreeImpl : AbstractAttribute, BooleanState, IRPosition {
- IRPositionConstructorForward(AANoFreeImpl);
- IRPositionGetter(*this);
+struct AANoFreeImpl : public AANoFree, BooleanState {
+ IRPositionConstructorForward(AANoFreeImpl, AANoFree);
/// See AbstractAttribute::getState()
///{
@@ -1029,17 +1014,11 @@ struct AANoFreeImpl : AbstractAttribute,
/// See AbstractAttribute::updateImpl(...).
ChangeStatus updateImpl(Attributor &A, InformationCache &InfoCache) override;
- /// See AbstractAttribute::getAttrKind().
- Attribute::AttrKind getAttrKind() const override { return Attribute::NoFree; }
-
/// Return true if "nofree" is assumed.
- bool isAssumedNoFree() const { return getAssumed(); }
+ bool isAssumedNoFree() const override { return getAssumed(); }
/// Return true if "nofree" is known.
- bool isKnownNoFree() const { return getKnown(); }
-
- /// Unique ID (due to the unique address)
- static const char ID;
+ bool isKnownNoFree() const override { return getKnown(); }
};
struct AANoFreeFunction final : public AANoFreeImpl {
@@ -1074,9 +1053,8 @@ ChangeStatus AANoFreeImpl::updateImpl(At
}
/// ------------------------ NonNull Argument Attribute ------------------------
-struct AANonNullImpl : AANonNull, BooleanState, IRPosition {
- IRPositionConstructorForward(AANonNullImpl);
- IRPositionGetter(*this);
+struct AANonNullImpl : AANonNull, BooleanState {
+ IRPositionConstructorForward(AANonNullImpl, AANonNull);
/// See AbstractAttribute::getState()
/// {
@@ -1260,9 +1238,8 @@ AANonNullCallSiteArgument::updateImpl(At
/// ------------------------ Will-Return Attributes ----------------------------
-struct AAWillReturnImpl : public AAWillReturn, BooleanState, IRPosition {
- IRPositionConstructorForward(AAWillReturnImpl);
- IRPositionGetter(*this);
+struct AAWillReturnImpl : public AAWillReturn, BooleanState {
+ IRPositionConstructorForward(AAWillReturnImpl, AAWillReturn);
/// See AAWillReturn::isKnownWillReturn().
bool isKnownWillReturn() const override { return getKnown(); }
@@ -1367,9 +1344,8 @@ ChangeStatus AAWillReturnFunction::updat
/// ------------------------ NoAlias Argument Attribute ------------------------
-struct AANoAliasImpl : AANoAlias, BooleanState, IRPosition {
- IRPositionConstructorForward(AANoAliasImpl);
- IRPositionGetter(*this);
+struct AANoAliasImpl : AANoAlias, BooleanState {
+ IRPositionConstructorForward(AANoAliasImpl, AANoAlias);
/// See AbstractAttribute::getState()
/// {
@@ -1453,9 +1429,8 @@ ChangeStatus AANoAliasReturned::updateIm
/// -------------------AAIsDead Function Attribute-----------------------
-struct AAIsDeadImpl : public AAIsDead, BooleanState, IRPosition {
- IRPositionConstructorForward(AAIsDeadImpl);
- IRPositionGetter(*this);
+struct AAIsDeadImpl : public AAIsDead, BooleanState {
+ IRPositionConstructorForward(AAIsDeadImpl, AAIsDead);
void initialize(Attributor &A, InformationCache &InfoCache) override {
Function &F = getAnchorScope();
@@ -1775,9 +1750,8 @@ struct DerefState : AbstractState {
}
};
-struct AADereferenceableImpl : AADereferenceable, DerefState, IRPosition {
- IRPositionConstructorForward(AADereferenceableImpl);
- IRPositionGetter(*this);
+struct AADereferenceableImpl : AADereferenceable, DerefState {
+ IRPositionConstructorForward(AADereferenceableImpl, AADereferenceable);
/// See AbstractAttribute::getState()
/// {
@@ -1829,9 +1803,8 @@ struct AADereferenceableImpl : AADerefer
return NonNullGlobalState.isKnown(DEREF_NONNULL);
}
- void getDeducedAttributes(SmallVectorImpl<Attribute> &Attrs) const override {
- LLVMContext &Ctx = AnchorVal.getContext();
-
+ void getDeducedAttributes(LLVMContext &Ctx,
+ SmallVectorImpl<Attribute> &Attrs) const override {
// TODO: Add *_globally support
if (isAssumedNonNull())
Attrs.emplace_back(Attribute::getWithDereferenceableBytes(
@@ -2052,9 +2025,8 @@ AADereferenceableCallSiteArgument::updat
// ------------------------ Align Argument Attribute ------------------------
-struct AAAlignImpl : AAAlign, IntegerState, IRPosition {
- IRPositionConstructorForward(AAAlignImpl);
- IRPositionGetter(*this);
+struct AAAlignImpl : AAAlign, IntegerState {
+ IRPositionConstructorForward(AAAlignImpl, AAAlign);
// Max alignemnt value allowed in IR
static const unsigned MAX_ALIGN = 1U << 29;
@@ -2093,9 +2065,8 @@ struct AAAlignImpl : AAAlign, IntegerSta
/// See AbstractAttribute::getDeducedAttributes
virtual void
- getDeducedAttributes(SmallVectorImpl<Attribute> &Attrs) const override {
- LLVMContext &Ctx = AnchorVal.getContext();
-
+ getDeducedAttributes(LLVMContext &Ctx,
+ SmallVectorImpl<Attribute> &Attrs) const override {
Attrs.emplace_back(Attribute::getWithAlignment(Ctx, getAssumedAlign()));
}
};
@@ -2229,9 +2200,8 @@ ChangeStatus AAAlignCallSiteArgument::up
}
/// ------------------ Function No-Return Attribute ----------------------------
-struct AANoReturnImpl : public AANoReturn, BooleanState, IRPosition {
- IRPositionConstructorForward(AANoReturnImpl);
- IRPositionGetter(*this);
+struct AANoReturnImpl : public AANoReturn, BooleanState {
+ IRPositionConstructorForward(AANoReturnImpl, AANoReturn);
/// See AbstractAttribute::getState()
/// {
@@ -2716,7 +2686,7 @@ char AttributorLegacyPass::ID = 0;
const char AAReturnedValues::ID = 0;
const char AANoUnwind::ID = 0;
const char AANoSync::ID = 0;
-const char AANoFreeImpl::ID = 0;
+const char AANoFree::ID = 0;
const char AANonNull::ID = 0;
const char AANoRecurse::ID = 0;
const char AAWillReturn::ID = 0;
More information about the llvm-commits
mailing list