Index: llvm/include/llvm/Analysis/LoopPass.h =================================================================== --- llvm/include/llvm/Analysis/LoopPass.h +++ llvm/include/llvm/Analysis/LoopPass.h @@ -66,26 +66,6 @@ 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 @@ // 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 LQ; LoopInfo *LI; Index: llvm/lib/Analysis/LoopPass.cpp =================================================================== --- llvm/lib/Analysis/LoopPass.cpp +++ llvm/lib/Analysis/LoopPass.cpp @@ -93,38 +93,6 @@ } } -/// 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(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 &LQ) { LQ.push_back(L); @@ -246,10 +214,7 @@ : 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 Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp =================================================================== --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -1032,7 +1032,6 @@ auto *OldBranch = dyn_cast(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 @@ 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 @@ // 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 @@ // Add users to the worklist which may be simplified now. for (User *U : I->users()) Worklist.push_back(cast(U)); - LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); I->replaceAllUsesWith(V); if (!I->mayHaveSideEffects()) { @@ -1593,7 +1589,6 @@ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) if (Instruction *Use = dyn_cast(I->getOperand(i))) Worklist.push_back(Use); - LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); if (MSSAU) MSSAU->removeMemoryAccess(I); @@ -1624,9 +1619,7 @@ 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(SuccIt++)) { for (unsigned It = 0, E = PN->getNumOperands(); It != E; ++It) @@ -1634,7 +1627,6 @@ Worklist.push_back(Use); for (User *U : PN->users()) Worklist.push_back(cast(U)); - LPM->deleteSimpleAnalysisValue(PN, L); RemoveFromWorklist(PN, Worklist); ++NumSimplify; } Index: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp =================================================================== --- llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -2983,10 +2983,6 @@ 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));