[llvm] 8d7bace - [Attributor][NFC] AAReachability is currently stateless, don't invalidate it
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 23:10:41 PDT 2021
Author: Johannes Doerfert
Date: 2021-06-18T01:07:51-05:00
New Revision: 8d7bace3b517e4f1ef43375e65f6c4da115ffef8
URL: https://github.com/llvm/llvm-project/commit/8d7bace3b517e4f1ef43375e65f6c4da115ffef8
DIFF: https://github.com/llvm/llvm-project/commit/8d7bace3b517e4f1ef43375e65f6c4da115ffef8.diff
LOG: [Attributor][NFC] AAReachability is currently stateless, don't invalidate it
We invalidated AAReachabilityImpl directly which is not helpful and
confusing as we still used it regardless. We now avoid invalidating it
(not needed anyway) and add checks for the state. This has by itself no
actual effect but prepares for later extensions.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 439c0a4f079f..4a0c921f6fbf 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -2704,6 +2704,8 @@ struct AAReachability : public StateWrapper<BooleanState, AbstractAttribute> {
/// determines (and caches) reachability.
bool isAssumedReachable(Attributor &A, const Instruction &From,
const Instruction &To) const {
+ if (!getState().isValidState())
+ return true;
return A.getInfoCache().getPotentiallyReachable(From, To);
}
@@ -2712,6 +2714,8 @@ struct AAReachability : public StateWrapper<BooleanState, AbstractAttribute> {
/// determines (and caches) reachability.
bool isKnownReachable(Attributor &A, const Instruction &From,
const Instruction &To) const {
+ if (!getState().isValidState())
+ return false;
return A.getInfoCache().getPotentiallyReachable(From, To);
}
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 9fbbb980f021..9832b2d6da34 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -2388,12 +2388,9 @@ struct AAReachabilityImpl : AAReachability {
return "reachable";
}
- /// See AbstractAttribute::initialize(...).
- void initialize(Attributor &A) override { indicatePessimisticFixpoint(); }
-
/// See AbstractAttribute::updateImpl(...).
ChangeStatus updateImpl(Attributor &A) override {
- return indicatePessimisticFixpoint();
+ return ChangeStatus::UNCHANGED;
}
};
More information about the llvm-commits
mailing list