Skip to content

Commit 6fc9e60

Browse files
committed
NFC. Remove obsolete SimpleAnalysis infrastructure
Apparently cache of AliasSetTrackers held by LICM was the only user of SimpleAnalysis infrastructure. Now, given that we no longer have that cache, this infrastructure is obsolete and, taking into account its nature, we don't want any new solutions to be based on it. Reviewers: asbirlea, fhahn, efriedma, reames Reviewed-By: asbirlea Differential Revision: https://reviews.llvm.org/D73085
1 parent 15ac727 commit 6fc9e60

File tree

4 files changed

+1
-87
lines changed

4 files changed

+1
-87
lines changed

llvm/include/llvm/Analysis/LoopPass.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,6 @@ class LoopPass : public Pass {
6666
return PMT_LoopPassManager;
6767
}
6868

69-
//===--------------------------------------------------------------------===//
70-
/// SimpleAnalysis - Provides simple interface to update analysis info
71-
/// maintained by various passes. Note, if required this interface can
72-
/// be extracted into a separate abstract class but it would require
73-
/// additional use of multiple inheritance in Pass class hierarchy, something
74-
/// we are trying to avoid.
75-
76-
/// Each loop pass can override these simple analysis hooks to update
77-
/// desired analysis information.
78-
/// cloneBasicBlockAnalysis - Clone analysis info associated with basic block.
79-
virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L) {}
80-
81-
/// deleteAnalysisValue - Delete analysis info associated with value V.
82-
virtual void deleteAnalysisValue(Value *V, Loop *L) {}
83-
84-
/// Delete analysis info associated with Loop L.
85-
/// Called to notify a Pass that a loop has been deleted and any
86-
/// associated analysis values can be deleted.
87-
virtual void deleteAnalysisLoop(Loop *L) {}
88-
8969
protected:
9070
/// Optional passes call this function to check whether the pass should be
9171
/// skipped. This is the case when Attribute::OptimizeNone is set or when
@@ -131,25 +111,6 @@ class LPPassManager : public FunctionPass, public PMDataManager {
131111
// Mark \p L as deleted.
132112
void markLoopAsDeleted(Loop &L);
133113

134-
//===--------------------------------------------------------------------===//
135-
/// SimpleAnalysis - Provides simple interface to update analysis info
136-
/// maintained by various passes. Note, if required this interface can
137-
/// be extracted into a separate abstract class but it would require
138-
/// additional use of multiple inheritance in Pass class hierarchy, something
139-
/// we are trying to avoid.
140-
141-
/// cloneBasicBlockSimpleAnalysis - Invoke cloneBasicBlockAnalysis hook for
142-
/// all passes that implement simple analysis interface.
143-
void cloneBasicBlockSimpleAnalysis(BasicBlock *From, BasicBlock *To, Loop *L);
144-
145-
/// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes
146-
/// that implement simple analysis interface.
147-
void deleteSimpleAnalysisValue(Value *V, Loop *L);
148-
149-
/// Invoke deleteAnalysisLoop hook for all passes that implement simple
150-
/// analysis interface.
151-
void deleteSimpleAnalysisLoop(Loop *L);
152-
153114
private:
154115
std::deque<Loop *> LQ;
155116
LoopInfo *LI;

llvm/lib/Analysis/LoopPass.cpp

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -93,38 +93,6 @@ void LPPassManager::addLoop(Loop &L) {
9393
}
9494
}
9595

96-
/// cloneBasicBlockSimpleAnalysis - Invoke cloneBasicBlockAnalysis hook for
97-
/// all loop passes.
98-
void LPPassManager::cloneBasicBlockSimpleAnalysis(BasicBlock *From,
99-
BasicBlock *To, Loop *L) {
100-
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
101-
LoopPass *LP = getContainedPass(Index);
102-
LP->cloneBasicBlockAnalysis(From, To, L);
103-
}
104-
}
105-
106-
/// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes.
107-
void LPPassManager::deleteSimpleAnalysisValue(Value *V, Loop *L) {
108-
if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
109-
for (Instruction &I : *BB) {
110-
deleteSimpleAnalysisValue(&I, L);
111-
}
112-
}
113-
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
114-
LoopPass *LP = getContainedPass(Index);
115-
LP->deleteAnalysisValue(V, L);
116-
}
117-
}
118-
119-
/// Invoke deleteAnalysisLoop hook for all passes.
120-
void LPPassManager::deleteSimpleAnalysisLoop(Loop *L) {
121-
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
122-
LoopPass *LP = getContainedPass(Index);
123-
LP->deleteAnalysisLoop(L);
124-
}
125-
}
126-
127-
12896
// Recurse through all subloops and all loops into LQ.
12997
static void addLoopIntoQueue(Loop *L, std::deque<Loop *> &LQ) {
13098
LQ.push_back(L);
@@ -246,10 +214,7 @@ bool LPPassManager::runOnFunction(Function &F) {
246214
: CurrentLoop->getName());
247215
dumpPreservedSet(P);
248216

249-
if (CurrentLoopDeleted) {
250-
// Notify passes that the loop is being deleted.
251-
deleteSimpleAnalysisLoop(CurrentLoop);
252-
} else {
217+
if (!CurrentLoopDeleted) {
253218
// Manually check that this loop is still healthy. This is done
254219
// instead of relying on LoopInfo::verifyLoop since LoopInfo
255220
// is a function pass and it's really expensive to verify every

llvm/lib/Transforms/Scalar/LoopUnswitch.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,6 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
10321032
auto *OldBranch = dyn_cast<BranchInst>(loopPreheader->getTerminator());
10331033
assert(OldBranch && "Failed to split the preheader");
10341034
EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, OldBranch, TI);
1035-
LPM->deleteSimpleAnalysisValue(OldBranch, L);
10361035

10371036
// EmitPreheaderBranchOnCondition removed the OldBranch from the function.
10381037
// Delete it, as it is no longer needed.
@@ -1283,7 +1282,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
12831282

12841283
NewBlocks.push_back(NewBB);
12851284
VMap[LoopBlocks[i]] = NewBB; // Keep the BB mapping.
1286-
LPM->cloneBasicBlockSimpleAnalysis(LoopBlocks[i], NewBB, L);
12871285
}
12881286

12891287
// Splice the newly inserted blocks into the function right before the
@@ -1366,7 +1364,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
13661364
// Emit the new branch that selects between the two versions of this loop.
13671365
EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR,
13681366
TI);
1369-
LPM->deleteSimpleAnalysisValue(OldBR, L);
13701367
if (MSSAU) {
13711368
// Update MemoryPhis in Exit blocks.
13721369
MSSAU->updateExitBlocksForClonedLoop(ExitBlocks, VMap, *DT);
@@ -1426,7 +1423,6 @@ static void ReplaceUsesOfWith(Instruction *I, Value *V,
14261423
// Add users to the worklist which may be simplified now.
14271424
for (User *U : I->users())
14281425
Worklist.push_back(cast<Instruction>(U));
1429-
LPM->deleteSimpleAnalysisValue(I, L);
14301426
RemoveFromWorklist(I, Worklist);
14311427
I->replaceAllUsesWith(V);
14321428
if (!I->mayHaveSideEffects()) {
@@ -1593,7 +1589,6 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
15931589
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
15941590
if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
15951591
Worklist.push_back(Use);
1596-
LPM->deleteSimpleAnalysisValue(I, L);
15971592
RemoveFromWorklist(I, Worklist);
15981593
if (MSSAU)
15991594
MSSAU->removeMemoryAccess(I);
@@ -1624,17 +1619,14 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
16241619
assert(SinglePred == Pred && "CFG broken");
16251620

16261621
// Make the LPM and Worklist updates specific to LoopUnswitch.
1627-
LPM->deleteSimpleAnalysisValue(BI, L);
16281622
RemoveFromWorklist(BI, Worklist);
1629-
LPM->deleteSimpleAnalysisValue(Succ, L);
16301623
auto SuccIt = Succ->begin();
16311624
while (PHINode *PN = dyn_cast<PHINode>(SuccIt++)) {
16321625
for (unsigned It = 0, E = PN->getNumOperands(); It != E; ++It)
16331626
if (Instruction *Use = dyn_cast<Instruction>(PN->getOperand(It)))
16341627
Worklist.push_back(Use);
16351628
for (User *U : PN->users())
16361629
Worklist.push_back(cast<Instruction>(U));
1637-
LPM->deleteSimpleAnalysisValue(PN, L);
16381630
RemoveFromWorklist(PN, Worklist);
16391631
++NumSimplify;
16401632
}

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,10 +2983,6 @@ bool SimpleLoopUnswitchLegacyPass::runOnLoop(Loop *L, LPPassManager &LPM) {
29832983
if (MSSA && VerifyMemorySSA)
29842984
MSSA->verifyMemorySSA();
29852985

2986-
// If anything was unswitched, also clear any cached information about this
2987-
// loop.
2988-
LPM.deleteSimpleAnalysisLoop(L);
2989-
29902986
// Historically this pass has had issues with the dominator tree so verify it
29912987
// in asserts builds.
29922988
assert(DT.verify(DominatorTree::VerificationLevel::Fast));

0 commit comments

Comments
 (0)