llvm.org GIT mirror llvm / 59dc178
Do not add unreachable code to a natural loop! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9377 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
1 changed file(s) with 4 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
150150 Loop *L = new Loop(BB);
151151 BBMap[BB] = L;
152152
153 BasicBlock *EntryBlock = &BB->getParent()->getEntryBlock();
154
153155 while (!TodoStack.empty()) { // Process all the nodes in the loop
154156 BasicBlock *X = TodoStack.back();
155157 TodoStack.pop_back();
156158
157 if (!L->contains(X)) { // As of yet unprocessed??
159 if (!L->contains(X) && // As of yet unprocessed??
160 DS.dominates(EntryBlock, X)) { // X is reachable from entry block?
158161 // Check to see if this block already belongs to a loop. If this occurs
159162 // then we have a case where a loop that is supposed to be a child of the
160163 // current loop was processed before the current loop. When this occurs,