Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Utils/LoopUtils.cpp
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | for (auto &Inst : *Block) { | ||||
return !L->contains(Use->getParent()); | return !L->contains(Use->getParent()); | ||||
})) | })) | ||||
UsedOutside.push_back(&Inst); | UsedOutside.push_back(&Inst); | ||||
} | } | ||||
return UsedOutside; | return UsedOutside; | ||||
} | } | ||||
void llvm::getLoopAnalysisUsage(AnalysisUsage &AU) { | void llvm::getLoopAnalysisUsage(AnalysisUsage &AU, bool Preserve) { | ||||
// By definition, all loop passes need the LoopInfo analysis and the | // By definition, all loop passes need the LoopInfo analysis and the | ||||
// Dominator tree it depends on. Because they all participate in the loop | // Dominator tree it depends on. Because they all participate in the loop | ||||
// pass manager, they must also preserve these. | // pass manager, they must also preserve these. | ||||
AU.addRequired<DominatorTreeWrapperPass>(); | AU.addRequired<DominatorTreeWrapperPass>(); | ||||
if (Preserve) | |||||
AU.addPreserved<DominatorTreeWrapperPass>(); | AU.addPreserved<DominatorTreeWrapperPass>(); | ||||
AU.addRequired<LoopInfoWrapperPass>(); | AU.addRequired<LoopInfoWrapperPass>(); | ||||
if (Preserve) | |||||
AU.addPreserved<LoopInfoWrapperPass>(); | AU.addPreserved<LoopInfoWrapperPass>(); | ||||
// We must also preserve LoopSimplify and LCSSA. We locally access their IDs | // We must also preserve LoopSimplify and LCSSA. We locally access their IDs | ||||
// here because users shouldn't directly get them from this header. | // here because users shouldn't directly get them from this header. | ||||
extern char &LoopSimplifyID; | extern char &LoopSimplifyID; | ||||
extern char &LCSSAID; | extern char &LCSSAID; | ||||
AU.addRequiredID(LoopSimplifyID); | AU.addRequiredID(LoopSimplifyID); | ||||
if (Preserve) | |||||
AU.addPreservedID(LoopSimplifyID); | AU.addPreservedID(LoopSimplifyID); | ||||
AU.addRequiredID(LCSSAID); | AU.addRequiredID(LCSSAID); | ||||
if (Preserve) | |||||
AU.addPreservedID(LCSSAID); | AU.addPreservedID(LCSSAID); | ||||
// This is used in the LPPassManager to perform LCSSA verification on passes | // This is used in the LPPassManager to perform LCSSA verification on passes | ||||
// which preserve lcssa form | // which preserve lcssa form | ||||
AU.addRequired<LCSSAVerificationPass>(); | AU.addRequired<LCSSAVerificationPass>(); | ||||
if (Preserve) | |||||
AU.addPreserved<LCSSAVerificationPass>(); | AU.addPreserved<LCSSAVerificationPass>(); | ||||
// Loop passes are designed to run inside of a loop pass manager which means | // Loop passes are designed to run inside of a loop pass manager which means | ||||
// that any function analyses they require must be required by the first loop | // that any function analyses they require must be required by the first loop | ||||
// pass in the manager (so that it is computed before the loop pass manager | // pass in the manager (so that it is computed before the loop pass manager | ||||
// runs) and preserved by all loop pasess in the manager. To make this | // runs) and preserved by all loop pasess in the manager. To make this | ||||
// reasonably robust, the set needed for most loop passes is maintained here. | // reasonably robust, the set needed for most loop passes is maintained here. | ||||
// If your loop pass requires an analysis not listed here, you will need to | // If your loop pass requires an analysis not listed here, you will need to | ||||
// carefully audit the loop pass manager nesting structure that results. | // carefully audit the loop pass manager nesting structure that results. | ||||
AU.addRequired<AAResultsWrapperPass>(); | AU.addRequired<AAResultsWrapperPass>(); | ||||
AU.addPreserved<AAResultsWrapperPass>(); | AU.addPreserved<AAResultsWrapperPass>(); | ||||
AU.addPreserved<BasicAAWrapperPass>(); | AU.addPreserved<BasicAAWrapperPass>(); | ||||
AU.addPreserved<GlobalsAAWrapperPass>(); | AU.addPreserved<GlobalsAAWrapperPass>(); | ||||
if (Preserve) | |||||
AU.addPreserved<SCEVAAWrapperPass>(); | AU.addPreserved<SCEVAAWrapperPass>(); | ||||
AU.addRequired<ScalarEvolutionWrapperPass>(); | AU.addRequired<ScalarEvolutionWrapperPass>(); | ||||
if (Preserve) | |||||
AU.addPreserved<ScalarEvolutionWrapperPass>(); | AU.addPreserved<ScalarEvolutionWrapperPass>(); | ||||
// FIXME: When all loop passes preserve MemorySSA, it can be required and | // FIXME: When all loop passes preserve MemorySSA, it can be required and | ||||
// preserved here instead of the individual handling in each pass. | // preserved here instead of the individual handling in each pass. | ||||
} | } | ||||
/// Manually defined generic "LoopPass" dependency initialization. This is used | /// Manually defined generic "LoopPass" dependency initialization. This is used | ||||
/// to initialize the exact set of passes from above in \c | /// to initialize the exact set of passes from above in \c | ||||
/// getLoopAnalysisUsage. It can be used within a loop pass's initialization | /// getLoopAnalysisUsage. It can be used within a loop pass's initialization | ||||
/// with: | /// with: | ||||
▲ Show 20 Lines • Show All 1,526 Lines • Show Last 20 Lines |