diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 50167708163e..30c51250af61 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1157,6 +1157,12 @@ struct AnalysisGetter { return nullptr; } + /// Invalidates the analyses. Valid only when using the new pass manager. + void invalidateAnalyses() { + assert(FAM && "Can only be used from the new PM!"); + FAM->clear(); + } + AnalysisGetter(FunctionAnalysisManager &FAM, bool CachedOnly = false) : FAM(&FAM), CachedOnly(CachedOnly) {} AnalysisGetter(Pass *P, bool CachedOnly = false) @@ -1286,6 +1292,10 @@ struct InformationCache { return AssumeOnlyValues.contains(&I); } + /// Invalidates the cached analyses. Valid only when using the new pass + /// manager. + void invalidateAnalyses() { AG.invalidateAnalyses(); } + /// Return the analysis result from a pass \p AP for function \p F. template typename AP::Result *getAnalysisResultForFunction(const Function &F, diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp index 2c880316e0a1..4176d561363f 100644 --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -2053,6 +2053,9 @@ private: LLVM_DEBUG(dbgs() << "[Attributor] Done with " << SCC.size() << " functions, result: " << Changed << ".\n"); + if (Changed == ChangeStatus::CHANGED) + OMPInfoCache.invalidateAnalyses(); + return Changed == ChangeStatus::CHANGED; }