| OLD | NEW |
| 1 //===- subzero/src/IceLoopAnalyzer.cpp - Loop Analysis --------------------===// | 1 //===- subzero/src/IceLoopAnalyzer.cpp - Loop Analysis --------------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // Single node means no loop in the CFG | 115 // Single node means no loop in the CFG |
| 116 if (LoopStack.back() == &Node) { | 116 if (LoopStack.back() == &Node) { |
| 117 LoopStack.back()->setOnStack(false); | 117 LoopStack.back()->setOnStack(false); |
| 118 LoopStack.back()->setDeleted(); | 118 LoopStack.back()->setDeleted(); |
| 119 ++NumDeletedNodes; | 119 ++NumDeletedNodes; |
| 120 LoopStack.pop_back(); | 120 LoopStack.pop_back(); |
| 121 return nullptr; | 121 return nullptr; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Reaching here means a loop has been found! It consists of the nodes on | 124 // Reaching here means a loop has been found! It consists of the nodes on the |
| 125 // the top of the stack, down until the current node being processed, Node, | 125 // top of the stack, down until the current node being processed, Node, is |
| 126 // is found. | 126 // found. |
| 127 for (auto It = LoopStack.rbegin(); It != LoopStack.rend(); ++It) { | 127 for (auto It = LoopStack.rbegin(); It != LoopStack.rend(); ++It) { |
| 128 (*It)->setOnStack(false); | 128 (*It)->setOnStack(false); |
| 129 (*It)->incrementLoopNestDepth(); | 129 (*It)->incrementLoopNestDepth(); |
| 130 // Remove the loop from the stack and delete the head node | 130 // Remove the loop from the stack and delete the head node |
| 131 if (*It == &Node) { | 131 if (*It == &Node) { |
| 132 (*It)->setDeleted(); | 132 (*It)->setDeleted(); |
| 133 ++NumDeletedNodes; | 133 ++NumDeletedNodes; |
| 134 LoopStack.erase(It.base() - 1, LoopStack.end()); | 134 LoopStack.erase(It.base() - 1, LoopStack.end()); |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 return nullptr; | 139 return nullptr; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // end of namespace Ice | 142 } // end of namespace Ice |
| OLD | NEW |