@@ -1093,6 +1093,13 @@ struct AAPointerInfoImpl
10931093 return State::numOffsetBins ();
10941094 }
10951095 virtual bool reachesReturn () const override { return ReachesReturn; }
1096+ ChangeStatus setReachesReturn (bool Val) {
1097+ if (ReachesReturn == Val)
1098+ return ChangeStatus::UNCHANGED;
1099+
1100+ ReachesReturn = Val;
1101+ return ChangeStatus::CHANGED;
1102+ }
10961103
10971104 bool forallInterferingAccesses (
10981105 AA::RangeTy Range,
@@ -1380,12 +1387,12 @@ struct AAPointerInfoImpl
13801387 if (!OtherAA.getState ().isValidState () || !isValidState ())
13811388 return indicatePessimisticFixpoint ();
13821389
1390+ ChangeStatus Changed = ChangeStatus::UNCHANGED;
13831391 const auto &OtherAAImpl = static_cast <const AAPointerInfoImpl &>(OtherAA);
13841392 bool IsByval = OtherAAImpl.getAssociatedArgument ()->hasByValAttr ();
1385- ReachesReturn = OtherAAImpl.ReachesReturn ;
1393+ Changed |= setReachesReturn ( OtherAAImpl.ReachesReturn ) ;
13861394
13871395 // Combine the accesses bin by bin.
1388- ChangeStatus Changed = ChangeStatus::UNCHANGED;
13891396 const auto &State = OtherAAImpl.getState ();
13901397 for (const auto &It : State) {
13911398 for (auto Index : It.getSecond ()) {
@@ -1681,8 +1688,10 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
16811688 // Returns are allowed if they are in the associated functions. Users can
16821689 // then check the call site return. Returns from other functions can't be
16831690 // tracked and are cause for invalidation.
1684- if (auto *RI = dyn_cast<ReturnInst>(Usr))
1685- return ReachesReturn = RI->getFunction () == getAssociatedFunction ();
1691+ if (auto *RI = dyn_cast<ReturnInst>(Usr)) {
1692+ Changed |= setReachesReturn (RI->getFunction () == getAssociatedFunction ());
1693+ return ReachesReturn;
1694+ }
16861695
16871696 // For PHIs we need to take care of the recurrence explicitly as the value
16881697 // might change while we iterate through a loop. For now, we give up if
0 commit comments