const auto &KindToAbstractAttributeMap = AAMap.lookup({&V, ArgNo});
if (AAType *AA = static_cast<AAType *>(
KindToAbstractAttributeMap.lookup(AAType::ID))) {
- QueryMap[AA].insert(&QueryingAA);
- return AA;
+ // Do not return an attribute with an invalid state. This minimizes checks
+ // at the calls sites and allows the fallback below to kick in.
+ if (AA->getState().isValidState()) {
+ QueryMap[AA].insert(&QueryingAA);
+ return AA;
+ }
}
// If no abstract attribute was found and we look for a call site argument,
// Try to find a assumed unique return value for the called function.
auto *RetCSAA = A.getAAFor<AAReturnedValuesImpl>(*this, *RV);
- if (!RetCSAA || !RetCSAA->isValidState()) {
+ if (!RetCSAA) {
HasOverdefinedReturnedCalls = true;
LLVM_DEBUG(dbgs() << "[AAReturnedValues] Returned call site (" << *RV
<< ") with " << (RetCSAA ? "invalid" : "no")
auto ICS = ImmutableCallSite(I);
auto *NoFreeAA = A.getAAFor<AANoFreeFunction>(*this, *I);
- if ((!NoFreeAA || !NoFreeAA->isValidState() ||
- !NoFreeAA->isAssumedNoFree()) &&
+ if ((!NoFreeAA || !NoFreeAA->isAssumedNoFree()) &&
!ICS.hasFnAttr(Attribute::NoFree)) {
indicatePessimisticFixpoint();
return ChangeStatus::CHANGED;