Skip to content

Invalidate analyses after running Attributor in OpenMPOpt #74908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions llvm/include/llvm/Transforms/IPO/Attributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,9 @@ struct OpenMPOpt {
LLVM_DEBUG(dbgs() << "[Attributor] Done with " << SCC.size()
<< " functions, result: " << Changed << ".\n");

if (Changed == ChangeStatus::CHANGED)
OMPInfoCache.invalidateAnalyses();

return Changed == ChangeStatus::CHANGED;
}

Expand Down