Invalidate analyses after running Attributor in OpenMPOpt (#74908)

Using the LoopInfo from OMPInfoCache after the Attributor ran resulted
in a crash due to it being in an invalid state.

---------

Co-authored-by: Ivan Radanov Ivanov <ivanov2@llnl.gov>
This commit is contained in:
Ivan R. Ivanov
2023-12-21 08:01:21 +09:00
committed by GitHub
parent 3c10e5b2f6
commit 39f09ec245
2 changed files with 13 additions and 0 deletions

View File

@@ -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>
typename AP::Result *getAnalysisResultForFunction(const Function &F,

View File

@@ -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;
}