diff options
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index bfc9a99ff86..9aa969ae5f0 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1380,6 +1380,13 @@ void ScopDetection::emitMissedRemarks(const Function &F) { } } +/// @brief Enum for coloring BBs in Region. +/// +/// WHITE - Unvisited BB in DFS walk. +/// GREY - BBs which are currently on the DFS stack for processing. +/// BLACK - Visited and completely processed BB. +enum Color { WHITE, GREY, BLACK }; + bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const { BasicBlock *REntry = R.getEntry(); BasicBlock *RExit = R.getExit(); @@ -1394,10 +1401,10 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const { // Initialize the map for all BB with WHITE color. for (auto *BB : R.blocks()) - BBColorMap[BB] = ScopDetection::WHITE; + BBColorMap[BB] = WHITE; // Process the entry block of the Region. - BBColorMap[CurrBB] = ScopDetection::GREY; + BBColorMap[CurrBB] = GREY; DFSStack.push(std::make_pair(CurrBB, 0)); while (!DFSStack.empty()) { @@ -1418,15 +1425,15 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const { continue; // WHITE indicates an unvisited BB in DFS walk. - if (BBColorMap[SuccBB] == ScopDetection::WHITE) { + if (BBColorMap[SuccBB] == WHITE) { // Push the current BB and the index of the next child to be visited. DFSStack.push(std::make_pair(CurrBB, I + 1)); // Push the next BB to be processed. DFSStack.push(std::make_pair(SuccBB, 0)); // First time the BB is being processed. - BBColorMap[SuccBB] = ScopDetection::GREY; + BBColorMap[SuccBB] = GREY; break; - } else if (BBColorMap[SuccBB] == ScopDetection::GREY) { + } else if (BBColorMap[SuccBB] == GREY) { // GREY indicates a loop in the control flow. // If the destination dominates the source, it is a natural loop // else, an irreducible control flow in the region is detected. @@ -1441,7 +1448,7 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const { // If all children of current BB have been processed, // then mark that BB as fully processed. if (AdjacentBlockIndex == NSucc) - BBColorMap[CurrBB] = ScopDetection::BLACK; + BBColorMap[CurrBB] = BLACK; } return true; |

