Skip to content

Commit ba957d7

Browse files
committed
[TSAR, Analysis, Server] Update utils.
If P is a module pass, an alias tree cannot be requested. So, it should be specified explicitly.
1 parent 9374376 commit ba957d7

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

include/tsar/Analysis/Memory/DIClientServerInfo.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ struct DIClientServerInfo {
8989
/// it returns information from client.
9090
struct DIMemoryClientServerInfo : public DIClientServerInfo {
9191
/// Obtain analysis from client and server.
92-
///
93-
/// \post if alias tree is not available on client this class becomes invalid.
94-
DIMemoryClientServerInfo(llvm::Pass &P, llvm::Function &F);
92+
DIMemoryClientServerInfo(DIAliasTree &ClientDIAT, llvm::Pass &P,
93+
llvm::Function &F);
9594

9695
/// Return client-to-server memory pair for a specified estimate memory on
9796
/// client.
@@ -116,11 +115,6 @@ struct DIMemoryClientServerInfo : public DIClientServerInfo {
116115
/// client, this function returns analysis results from client.
117116
DIDependenceSet *findFromClient(const llvm::Loop &L);
118117

119-
/// Return true if data is available.
120-
bool isValid() const noexcept {
121-
return DIAT && DIDepInfo && ClientDIAT;
122-
}
123-
124118
/// Return true if data is available.
125119
operator bool () const noexcept { return isValid(); }
126120

lib/Analysis/Clang/CanonicalLoop.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ bool CanonicalLoopPass::runOnFunction(Function &F) {
694694
auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
695695
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
696696
DeclarationMatcher LoopMatcher = makeLoopMatcher();
697-
DIMemoryClientServerInfo DIMInfo(*this, F);
697+
DIMemoryClientServerInfo DIMInfo(
698+
getAnalysis<DIEstimateMemoryPass>().getAliasTree(), *this, F);
698699
CanonicalLoopLabeler Labeler(RgnInfo, LoopInfo, MemInfo, ATree,
699700
TLI, SE, DT, DIMInfo, &mCanonicalLoopInfo);
700701
auto &Context = FuncDecl->getASTContext();

lib/Analysis/Memory/DIClientServerInfo.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,9 @@ DIClientServerInfo::DIClientServerInfo(llvm::Pass &P, llvm::Function &F) {
8989
}
9090
}
9191

92-
DIMemoryClientServerInfo::DIMemoryClientServerInfo(
93-
llvm::Pass &P, llvm::Function &F) : DIClientServerInfo(P, F) {
94-
if (auto *DIATP = P.getAnalysisIfAvailable<DIEstimateMemoryPass>())
95-
if (DIATP->isConstructed())
96-
ClientDIAT = &DIATP->getAliasTree();
97-
else
98-
return;
99-
else
100-
return;
101-
}
92+
DIMemoryClientServerInfo::DIMemoryClientServerInfo(DIAliasTree &ClientDIAT,
93+
llvm::Pass &P, llvm::Function &F)
94+
: DIClientServerInfo(P, F), ClientDIAT(&ClientDIAT) {}
10295

10396
bcl::tagged_pair<
10497
bcl::tagged<DIMemory *, Origin>, bcl::tagged<DIMemory *, Clone>>

0 commit comments

Comments
 (0)