Index: llvm/include/llvm/Transforms/IPO/Attributor.h =================================================================== --- llvm/include/llvm/Transforms/IPO/Attributor.h +++ llvm/include/llvm/Transforms/IPO/Attributor.h @@ -975,11 +975,18 @@ bool TrackDependence = false, DepClassTy DepClass = DepClassTy::OPTIONAL, bool ForceUpdate = false) { +#define DEBUG_TYPE "attributor" if (AAType *AAPtr = lookupAAFor(IRP, QueryingAA, TrackDependence)) { - if (ForceUpdate) - updateAA(*AAPtr); + if (ForceUpdate) { + if (Phase != AttributorPhase::UPDATE) + LLVM_DEBUG(dbgs() << "[Attributor] An update is forced outside of " + "the update stage. Ignore this enforcement.\n"); + else + updateAA(*AAPtr); + } return *AAPtr; } +#undef DEBUG_TYPE // No matching attribute found, create one. // Use the static create method. @@ -1020,6 +1027,13 @@ return AA; } + // If this is queried in the manifest stage, we force the AA to indicate + // pessimistic fixpoint immediately. + if (Phase == AttributorPhase::MANIFEST) { + AA.getState().indicatePessimisticFixpoint(); + return AA; + } + // Allow seeded attributes to declare dependencies. // Remember the seeding state. AttributorPhase OldPhase = Phase; Index: llvm/lib/Transforms/IPO/Attributor.cpp =================================================================== --- llvm/lib/Transforms/IPO/Attributor.cpp +++ llvm/lib/Transforms/IPO/Attributor.cpp @@ -1347,6 +1347,8 @@ ChangeStatus Attributor::updateAA(AbstractAttribute &AA) { TimeTraceScope TimeScope(AA.getName() + "::updateAA"); + assert(Phase == AttributorPhase::UPDATE && + "We can update AA only in the update stage!"); // Use a new dependence vector for this update. DependenceVector DV;