From 7ed5856a3226f19f47d39a16ff17a5a0a4448020 Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Fri, 15 Sep 2017 00:04:16 +0000 Subject: Refactor collectChildrenInLoop to LoopUtils [NFC] Summary: Move to LoopUtils method that collects all children of a node inside a loop. Reviewers: majnemer, sanjoy Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37870 llvm-svn: 313322 --- llvm/lib/Transforms/Scalar/LICM.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/LICM.cpp') diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 0241ec8c70c..f45d362e077 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -345,29 +345,6 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA, return Changed; } -// Does a BFS from a given node to all of its children inside a given loop. -// The returned vector of nodes includes the starting point. -static SmallVector -collectChildrenInLoop(DomTreeNode *N, const Loop *CurLoop) { - SmallVector Worklist; - auto add_region_to_worklist = [&](DomTreeNode *DTN) { - // Only include subregions in the top level loop. - BasicBlock *BB = DTN->getBlock(); - if (CurLoop->contains(BB)) - Worklist.push_back(DTN); - }; - - add_region_to_worklist(N); - - for (size_t I = 0; I < Worklist.size(); I++) { - DomTreeNode *DTN = Worklist[I]; - for (DomTreeNode *Child : DTN->getChildren()) - add_region_to_worklist(Child); - } - - return Worklist; -} - /// Walk the specified region of the CFG (defined by all blocks dominated by /// the specified block, and that are in the current loop) in reverse depth /// first order w.r.t the DominatorTree. This allows us to visit uses before -- cgit v1.2.3