[llvm] 72fd35b - [Attributor] Report change when updating ReachesReturn (#108965)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 09:10:22 PDT 2024
Author: macurtis-amd
Date: 2024-09-19T11:10:18-05:00
New Revision: 72fd35b85ba6fbdf316b3d3e21f845b022ac7b64
URL: https://github.com/llvm/llvm-project/commit/72fd35b85ba6fbdf316b3d3e21f845b022ac7b64
DIFF: https://github.com/llvm/llvm-project/commit/72fd35b85ba6fbdf316b3d3e21f845b022ac7b64.diff
LOG: [Attributor] Report change when updating ReachesReturn (#108965)
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 217c7cccb5775a..038a374e19f793 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1093,6 +1093,13 @@ struct AAPointerInfoImpl
return State::numOffsetBins();
}
virtual bool reachesReturn() const override { return ReachesReturn; }
+ ChangeStatus setReachesReturn(bool Val) {
+ if (ReachesReturn == Val)
+ return ChangeStatus::UNCHANGED;
+
+ ReachesReturn = Val;
+ return ChangeStatus::CHANGED;
+ }
bool forallInterferingAccesses(
AA::RangeTy Range,
@@ -1380,12 +1387,12 @@ struct AAPointerInfoImpl
if (!OtherAA.getState().isValidState() || !isValidState())
return indicatePessimisticFixpoint();
+ ChangeStatus Changed = ChangeStatus::UNCHANGED;
const auto &OtherAAImpl = static_cast<const AAPointerInfoImpl &>(OtherAA);
bool IsByval = OtherAAImpl.getAssociatedArgument()->hasByValAttr();
- ReachesReturn = OtherAAImpl.ReachesReturn;
+ Changed |= setReachesReturn(OtherAAImpl.ReachesReturn);
// Combine the accesses bin by bin.
- ChangeStatus Changed = ChangeStatus::UNCHANGED;
const auto &State = OtherAAImpl.getState();
for (const auto &It : State) {
for (auto Index : It.getSecond()) {
@@ -1681,8 +1688,10 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
// Returns are allowed if they are in the associated functions. Users can
// then check the call site return. Returns from other functions can't be
// tracked and are cause for invalidation.
- if (auto *RI = dyn_cast<ReturnInst>(Usr))
- return ReachesReturn = RI->getFunction() == getAssociatedFunction();
+ if (auto *RI = dyn_cast<ReturnInst>(Usr)) {
+ Changed |= setReachesReturn(RI->getFunction() == getAssociatedFunction());
+ return ReachesReturn;
+ }
// For PHIs we need to take care of the recurrence explicitly as the value
// might change while we iterate through a loop. For now, we give up if
More information about the llvm-commits
mailing list