Skip to content

Commit

Permalink
[Attributor] Port AAMustProgress to the checkAndQueryIRAttr interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jdoerfert committed Jul 9, 2023
1 parent 0348652 commit 6e7eb72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3278,8 +3278,7 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
checkAndQueryIRAttr<Attribute::WillReturn, AAWillReturn>(FPos, FnAttrs);

// Every function might be "must-progress".
if (!Attrs.hasFnAttr(Attribute::MustProgress))
getOrCreateAAFor<AAMustProgress>(FPos);
checkAndQueryIRAttr<Attribute::MustProgress, AAMustProgress>(FPos, FnAttrs);

// Every function can be nounwind.
if (!Attrs.hasFnAttr(Attribute::NoUnwind))
Expand Down
7 changes: 7 additions & 0 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,13 @@ struct AAMustProgressImpl : public AAMustProgress {
AAMustProgressImpl(const IRPosition &IRP, Attributor &A)
: AAMustProgress(IRP, A) {}

/// See AbstractAttribute::initialize(...).
void initialize(Attributor &A) override {
bool IsKnown;
assert(!AA::hasAssumedIRAttr<Attribute::MustProgress>(
A, nullptr, getIRPosition(), DepClassTy::NONE, IsKnown));
}

/// See AbstractAttribute::getAsStr()
const std::string getAsStr(Attributor *A) const override {
return getAssumed() ? "mustprogress" : "may-not-progress";
Expand Down

0 comments on commit 6e7eb72

Please sign in to comment.