@@ -558,7 +558,7 @@ ChangeStatus AbstractAttribute::update(Attributor &A) {
558558ChangeStatus
559559IRAttributeManifest::manifestAttrs (Attributor &A, const IRPosition &IRP,
560560 const ArrayRef<Attribute> &DeducedAttrs) {
561- Function *ScopeFn = IRP.getAssociatedFunction ();
561+ Function *ScopeFn = IRP.getAnchorScope ();
562562 IRPosition::Kind PK = IRP.getPositionKind ();
563563
564564 // In the following some generic code that will manifest attributes in
@@ -627,8 +627,7 @@ SubsumingPositionIterator::SubsumingPositionIterator(const IRPosition &IRP) {
627627 return ;
628628 case IRPosition::IRP_ARGUMENT:
629629 case IRPosition::IRP_RETURNED:
630- IRPositions.emplace_back (
631- IRPosition::function (*IRP.getAssociatedFunction ()));
630+ IRPositions.emplace_back (IRPosition::function (*IRP.getAnchorScope ()));
632631 return ;
633632 case IRPosition::IRP_CALL_SITE:
634633 assert (ICS && " Expected call site!" );
@@ -2528,7 +2527,7 @@ struct AAWillReturnImpl : public AAWillReturn {
25282527 void initialize (Attributor &A) override {
25292528 AAWillReturn::initialize (A);
25302529
2531- Function *F = getAssociatedFunction ();
2530+ Function *F = getAnchorScope ();
25322531 if (!F || !A.isFunctionIPOAmendable (*F) || mayContainUnboundedCycle (*F, A))
25332532 indicatePessimisticFixpoint ();
25342533 }
@@ -3113,7 +3112,7 @@ struct AAIsDeadArgument : public AAIsDeadFloating {
31133112
31143113 // / See AbstractAttribute::initialize(...).
31153114 void initialize (Attributor &A) override {
3116- if (!A.isFunctionIPOAmendable (*getAssociatedFunction ()))
3115+ if (!A.isFunctionIPOAmendable (*getAnchorScope ()))
31173116 indicatePessimisticFixpoint ();
31183117 }
31193118
@@ -3273,7 +3272,7 @@ struct AAIsDeadFunction : public AAIsDead {
32733272
32743273 // / See AbstractAttribute::initialize(...).
32753274 void initialize (Attributor &A) override {
3276- const Function *F = getAssociatedFunction ();
3275+ const Function *F = getAnchorScope ();
32773276 if (F && !F->isDeclaration ()) {
32783277 ToBeExploredFrom.insert (&F->getEntryBlock ().front ());
32793278 assumeLive (A, F->getEntryBlock ());
@@ -3283,7 +3282,7 @@ struct AAIsDeadFunction : public AAIsDead {
32833282 // / See AbstractAttribute::getAsStr().
32843283 const std::string getAsStr () const override {
32853284 return " Live[#BB " + std::to_string (AssumedLiveBlocks.size ()) + " /" +
3286- std::to_string (getAssociatedFunction ()->size ()) + " ][#TBEP " +
3285+ std::to_string (getAnchorScope ()->size ()) + " ][#TBEP " +
32873286 std::to_string (ToBeExploredFrom.size ()) + " ][#KDE " +
32883287 std::to_string (KnownDeadEnds.size ()) + " ]" ;
32893288 }
@@ -3294,7 +3293,7 @@ struct AAIsDeadFunction : public AAIsDead {
32943293 " Attempted to manifest an invalid state!" );
32953294
32963295 ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
3297- Function &F = *getAssociatedFunction ();
3296+ Function &F = *getAnchorScope ();
32983297
32993298 if (AssumedLiveBlocks.empty ()) {
33003299 A.deleteAfterManifest (F);
@@ -3346,7 +3345,7 @@ struct AAIsDeadFunction : public AAIsDead {
33463345
33473346 // / See AAIsDead::isAssumedDead(BasicBlock *).
33483347 bool isAssumedDead (const BasicBlock *BB) const override {
3349- assert (BB->getParent () == getAssociatedFunction () &&
3348+ assert (BB->getParent () == getAnchorScope () &&
33503349 " BB must be in the same anchor scope function." );
33513350
33523351 if (!getAssumed ())
@@ -3361,7 +3360,7 @@ struct AAIsDeadFunction : public AAIsDead {
33613360
33623361 // / See AAIsDead::isAssumed(Instruction *I).
33633362 bool isAssumedDead (const Instruction *I) const override {
3364- assert (I->getParent ()->getParent () == getAssociatedFunction () &&
3363+ assert (I->getParent ()->getParent () == getAnchorScope () &&
33653364 " Instruction must be in the same anchor scope function." );
33663365
33673366 if (!getAssumed ())
@@ -3515,7 +3514,7 @@ ChangeStatus AAIsDeadFunction::updateImpl(Attributor &A) {
35153514 ChangeStatus Change = ChangeStatus::UNCHANGED;
35163515
35173516 LLVM_DEBUG (dbgs () << " [AAIsDead] Live [" << AssumedLiveBlocks.size () << " /"
3518- << getAssociatedFunction ()->size () << " ] BBs and "
3517+ << getAnchorScope ()->size () << " ] BBs and "
35193518 << ToBeExploredFrom.size () << " exploration points and "
35203519 << KnownDeadEnds.size () << " known dead ends\n " );
35213520
@@ -3595,7 +3594,7 @@ ChangeStatus AAIsDeadFunction::updateImpl(Attributor &A) {
35953594 // discovered any non-trivial dead end and (2) not ruled unreachable code
35963595 // dead.
35973596 if (ToBeExploredFrom.empty () &&
3598- getAssociatedFunction ()->size () == AssumedLiveBlocks.size () &&
3597+ getAnchorScope ()->size () == AssumedLiveBlocks.size () &&
35993598 llvm::all_of (KnownDeadEnds, [](const Instruction *DeadEndI) {
36003599 return DeadEndI->isTerminator () && DeadEndI->getNumSuccessors () == 0 ;
36013600 }))
@@ -3935,7 +3934,7 @@ struct AAAlignImpl : AAAlign {
39353934 takeKnownMaximum (Attr.getValueAsInt ());
39363935
39373936 if (getIRPosition ().isFnInterfaceKind () &&
3938- (!getAssociatedFunction () ||
3937+ (!getAnchorScope () ||
39393938 !A.isFunctionIPOAmendable (*getAssociatedFunction ())))
39403939 indicatePessimisticFixpoint ();
39413940 }
@@ -4736,7 +4735,7 @@ struct AAValueSimplifyArgument final : AAValueSimplifyImpl {
47364735
47374736 void initialize (Attributor &A) override {
47384737 AAValueSimplifyImpl::initialize (A);
4739- if (!getAssociatedFunction () || getAssociatedFunction ()->isDeclaration ())
4738+ if (!getAnchorScope () || getAnchorScope ()->isDeclaration ())
47404739 indicatePessimisticFixpoint ();
47414740 if (hasAttr ({Attribute::InAlloca, Attribute::StructRet, Attribute::Nest},
47424741 /* IgnoreSubsumingPositions */ true ))
@@ -4980,7 +4979,7 @@ struct AAHeapToStackImpl : public AAHeapToStack {
49804979 " Attempted to manifest an invalid state!" );
49814980
49824981 ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
4983- Function *F = getAssociatedFunction ();
4982+ Function *F = getAnchorScope ();
49844983 const auto *TLI = A.getInfoCache ().getTargetLibraryInfoForFunction (*F);
49854984
49864985 for (Instruction *MallocCall : MallocCalls) {
@@ -5057,7 +5056,7 @@ struct AAHeapToStackImpl : public AAHeapToStack {
50575056};
50585057
50595058ChangeStatus AAHeapToStackImpl::updateImpl (Attributor &A) {
5060- const Function *F = getAssociatedFunction ();
5059+ const Function *F = getAnchorScope ();
50615060 const auto *TLI = A.getInfoCache ().getTargetLibraryInfoForFunction (*F);
50625061
50635062 MustBeExecutedContextExplorer &Explorer =
@@ -7655,7 +7654,7 @@ ChangeStatus Attributor::run() {
76557654
76567655 unsigned IterationCounter = 1 ;
76577656
7658- SmallVector<AbstractAttribute *, 64 > ChangedAAs;
7657+ SmallVector<AbstractAttribute *, 32 > ChangedAAs;
76597658 SetVector<AbstractAttribute *> Worklist, InvalidAAs;
76607659 Worklist.insert (AllAbstractAttributes.begin (), AllAbstractAttributes.end ());
76617660
@@ -8306,7 +8305,7 @@ void Attributor::initializeInformationCache(Function &F) {
83068305 switch (I.getOpcode ()) {
83078306 default :
83088307 assert ((!ImmutableCallSite (&I)) && (!isa<CallBase>(&I)) &&
8309- " New call site/base instruction type needs to be known int the "
8308+ " New call site/base instruction type needs to be known in the "
83108309 " Attributor." );
83118310 break ;
83128311 case Instruction::Load:
@@ -8635,6 +8634,10 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
86358634 // while we identify default attribute opportunities.
86368635 Attributor A (Functions, InfoCache, CGUpdater, DepRecInterval);
86378636
8637+ // Note: _Don't_ combine/fuse this loop with the one below because
8638+ // when A.identifyDefaultAbstractAttributes() is called for one
8639+ // function, it assumes that the information cach has been
8640+ // initialized for _all_ functions.
86388641 for (Function *F : Functions)
86398642 A.initializeInformationCache (*F);
86408643
0 commit comments