Skip to content

Commit 12173e6

Browse files
committed
[Attributor][NFC] Do not record dependences on fixed attributes
Since fixed values cannot change, we do not need to wait for it to happen, we will never notify the dependent attribute anyway.
1 parent b2083c5 commit 12173e6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,7 @@ struct Attributor {
733733
/// be beneficial to avoid false dependences but it requires the users of
734734
/// `getAAFor` to explicitly record true dependences through this method.
735735
void recordDependence(const AbstractAttribute &FromAA,
736-
const AbstractAttribute &ToAA) {
737-
QueryMap[&FromAA].insert(const_cast<AbstractAttribute *>(&ToAA));
738-
}
736+
const AbstractAttribute &ToAA);
739737

740738
/// Introduce a new abstract attribute into the fixpoint analysis.
741739
///
@@ -907,7 +905,7 @@ struct Attributor {
907905
AA.update(*this);
908906

909907
if (TrackDependence && AA.getState().isValidState())
910-
QueryMap[&AA].insert(const_cast<AbstractAttribute *>(QueryingAA));
908+
recordDependence(AA, const_cast<AbstractAttribute &>(*QueryingAA));
911909
return AA;
912910
}
913911

@@ -929,7 +927,7 @@ struct Attributor {
929927
KindToAbstractAttributeMap.lookup(&AAType::ID))) {
930928
// Do not register a dependence on an attribute with an invalid state.
931929
if (TrackDependence && AA->getState().isValidState())
932-
QueryMap[AA].insert(const_cast<AbstractAttribute *>(QueryingAA));
930+
recordDependence(*AA, const_cast<AbstractAttribute &>(*QueryingAA));
933931
return AA;
934932
}
935933
return nullptr;

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4711,6 +4711,12 @@ void Attributor::initializeInformationCache(Function &F) {
47114711
}
47124712
}
47134713

4714+
void Attributor::recordDependence(const AbstractAttribute &FromAA,
4715+
const AbstractAttribute &ToAA) {
4716+
if (!FromAA.getState().isAtFixpoint())
4717+
QueryMap[&FromAA].insert(const_cast<AbstractAttribute *>(&ToAA));
4718+
}
4719+
47144720
void Attributor::identifyDefaultAbstractAttributes(Function &F) {
47154721
if (!VisitedFunctions.insert(&F).second)
47164722
return;

0 commit comments

Comments
 (0)