mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
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:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user