forked from OSchip/llvm-project
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
This commit is contained in:
parent
15ac727714
commit
6fc9e60149
|
@ -66,26 +66,6 @@ public:
|
|||
return PMT_LoopPassManager;
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// SimpleAnalysis - Provides simple interface to update analysis info
|
||||
/// maintained by various passes. Note, if required this interface can
|
||||
/// be extracted into a separate abstract class but it would require
|
||||
/// additional use of multiple inheritance in Pass class hierarchy, something
|
||||
/// we are trying to avoid.
|
||||
|
||||
/// Each loop pass can override these simple analysis hooks to update
|
||||
/// desired analysis information.
|
||||
/// cloneBasicBlockAnalysis - Clone analysis info associated with basic block.
|
||||
virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L) {}
|
||||
|
||||
/// deleteAnalysisValue - Delete analysis info associated with value V.
|
||||
virtual void deleteAnalysisValue(Value *V, Loop *L) {}
|
||||
|
||||
/// Delete analysis info associated with Loop L.
|
||||
/// Called to notify a Pass that a loop has been deleted and any
|
||||
/// associated analysis values can be deleted.
|
||||
virtual void deleteAnalysisLoop(Loop *L) {}
|
||||
|
||||
protected:
|
||||
/// Optional passes call this function to check whether the pass should be
|
||||
/// skipped. This is the case when Attribute::OptimizeNone is set or when
|
||||
|
@ -131,25 +111,6 @@ public:
|
|||
// Mark \p L as deleted.
|
||||
void markLoopAsDeleted(Loop &L);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// SimpleAnalysis - Provides simple interface to update analysis info
|
||||
/// maintained by various passes. Note, if required this interface can
|
||||
/// be extracted into a separate abstract class but it would require
|
||||
/// additional use of multiple inheritance in Pass class hierarchy, something
|
||||
/// we are trying to avoid.
|
||||
|
||||
/// cloneBasicBlockSimpleAnalysis - Invoke cloneBasicBlockAnalysis hook for
|
||||
/// all passes that implement simple analysis interface.
|
||||
void cloneBasicBlockSimpleAnalysis(BasicBlock *From, BasicBlock *To, Loop *L);
|
||||
|
||||
/// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes
|
||||
/// that implement simple analysis interface.
|
||||
void deleteSimpleAnalysisValue(Value *V, Loop *L);
|
||||
|
||||
/// Invoke deleteAnalysisLoop hook for all passes that implement simple
|
||||
/// analysis interface.
|
||||
void deleteSimpleAnalysisLoop(Loop *L);
|
||||
|
||||
private:
|
||||
std::deque<Loop *> LQ;
|
||||
LoopInfo *LI;
|
||||
|
|
|
@ -93,38 +93,6 @@ void LPPassManager::addLoop(Loop &L) {
|
|||
}
|
||||
}
|
||||
|
||||
/// cloneBasicBlockSimpleAnalysis - Invoke cloneBasicBlockAnalysis hook for
|
||||
/// all loop passes.
|
||||
void LPPassManager::cloneBasicBlockSimpleAnalysis(BasicBlock *From,
|
||||
BasicBlock *To, Loop *L) {
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
LoopPass *LP = getContainedPass(Index);
|
||||
LP->cloneBasicBlockAnalysis(From, To, L);
|
||||
}
|
||||
}
|
||||
|
||||
/// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes.
|
||||
void LPPassManager::deleteSimpleAnalysisValue(Value *V, Loop *L) {
|
||||
if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
|
||||
for (Instruction &I : *BB) {
|
||||
deleteSimpleAnalysisValue(&I, L);
|
||||
}
|
||||
}
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
LoopPass *LP = getContainedPass(Index);
|
||||
LP->deleteAnalysisValue(V, L);
|
||||
}
|
||||
}
|
||||
|
||||
/// Invoke deleteAnalysisLoop hook for all passes.
|
||||
void LPPassManager::deleteSimpleAnalysisLoop(Loop *L) {
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
LoopPass *LP = getContainedPass(Index);
|
||||
LP->deleteAnalysisLoop(L);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Recurse through all subloops and all loops into LQ.
|
||||
static void addLoopIntoQueue(Loop *L, std::deque<Loop *> &LQ) {
|
||||
LQ.push_back(L);
|
||||
|
@ -246,10 +214,7 @@ bool LPPassManager::runOnFunction(Function &F) {
|
|||
: CurrentLoop->getName());
|
||||
dumpPreservedSet(P);
|
||||
|
||||
if (CurrentLoopDeleted) {
|
||||
// Notify passes that the loop is being deleted.
|
||||
deleteSimpleAnalysisLoop(CurrentLoop);
|
||||
} else {
|
||||
if (!CurrentLoopDeleted) {
|
||||
// Manually check that this loop is still healthy. This is done
|
||||
// instead of relying on LoopInfo::verifyLoop since LoopInfo
|
||||
// is a function pass and it's really expensive to verify every
|
||||
|
|
|
@ -1032,7 +1032,6 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
|
|||
auto *OldBranch = dyn_cast<BranchInst>(loopPreheader->getTerminator());
|
||||
assert(OldBranch && "Failed to split the preheader");
|
||||
EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, OldBranch, TI);
|
||||
LPM->deleteSimpleAnalysisValue(OldBranch, L);
|
||||
|
||||
// EmitPreheaderBranchOnCondition removed the OldBranch from the function.
|
||||
// Delete it, as it is no longer needed.
|
||||
|
@ -1283,7 +1282,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
|
|||
|
||||
NewBlocks.push_back(NewBB);
|
||||
VMap[LoopBlocks[i]] = NewBB; // Keep the BB mapping.
|
||||
LPM->cloneBasicBlockSimpleAnalysis(LoopBlocks[i], NewBB, L);
|
||||
}
|
||||
|
||||
// Splice the newly inserted blocks into the function right before the
|
||||
|
@ -1366,7 +1364,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
|
|||
// Emit the new branch that selects between the two versions of this loop.
|
||||
EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR,
|
||||
TI);
|
||||
LPM->deleteSimpleAnalysisValue(OldBR, L);
|
||||
if (MSSAU) {
|
||||
// Update MemoryPhis in Exit blocks.
|
||||
MSSAU->updateExitBlocksForClonedLoop(ExitBlocks, VMap, *DT);
|
||||
|
@ -1426,7 +1423,6 @@ static void ReplaceUsesOfWith(Instruction *I, Value *V,
|
|||
// Add users to the worklist which may be simplified now.
|
||||
for (User *U : I->users())
|
||||
Worklist.push_back(cast<Instruction>(U));
|
||||
LPM->deleteSimpleAnalysisValue(I, L);
|
||||
RemoveFromWorklist(I, Worklist);
|
||||
I->replaceAllUsesWith(V);
|
||||
if (!I->mayHaveSideEffects()) {
|
||||
|
@ -1593,7 +1589,6 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
|
|||
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
|
||||
if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
|
||||
Worklist.push_back(Use);
|
||||
LPM->deleteSimpleAnalysisValue(I, L);
|
||||
RemoveFromWorklist(I, Worklist);
|
||||
if (MSSAU)
|
||||
MSSAU->removeMemoryAccess(I);
|
||||
|
@ -1624,9 +1619,7 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
|
|||
assert(SinglePred == Pred && "CFG broken");
|
||||
|
||||
// Make the LPM and Worklist updates specific to LoopUnswitch.
|
||||
LPM->deleteSimpleAnalysisValue(BI, L);
|
||||
RemoveFromWorklist(BI, Worklist);
|
||||
LPM->deleteSimpleAnalysisValue(Succ, L);
|
||||
auto SuccIt = Succ->begin();
|
||||
while (PHINode *PN = dyn_cast<PHINode>(SuccIt++)) {
|
||||
for (unsigned It = 0, E = PN->getNumOperands(); It != E; ++It)
|
||||
|
@ -1634,7 +1627,6 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
|
|||
Worklist.push_back(Use);
|
||||
for (User *U : PN->users())
|
||||
Worklist.push_back(cast<Instruction>(U));
|
||||
LPM->deleteSimpleAnalysisValue(PN, L);
|
||||
RemoveFromWorklist(PN, Worklist);
|
||||
++NumSimplify;
|
||||
}
|
||||
|
|
|
@ -2983,10 +2983,6 @@ bool SimpleLoopUnswitchLegacyPass::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||
if (MSSA && VerifyMemorySSA)
|
||||
MSSA->verifyMemorySSA();
|
||||
|
||||
// If anything was unswitched, also clear any cached information about this
|
||||
// loop.
|
||||
LPM.deleteSimpleAnalysisLoop(L);
|
||||
|
||||
// Historically this pass has had issues with the dominator tree so verify it
|
||||
// in asserts builds.
|
||||
assert(DT.verify(DominatorTree::VerificationLevel::Fast));
|
||||
|
|
Loading…
Reference in New Issue