Adjust #includes to match movement of constant folding code from transformutils to...
[oota-llvm.git] / lib / Transforms / Scalar / LoopUnroll.cpp
index 2fa3fcd7f3c27e7c72527c16aed118de926559d2..655ddc4179244d6e5cfc52b2cb3f5c61e211774c 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
+#include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <cstdio>
 #include <set>
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
-namespace {
-  Statistic<> NumUnrolled("loop-unroll", "Number of loops completely unrolled");
+STATISTIC(NumUnrolled, "Number of loops completely unrolled");
 
+namespace {
   cl::opt<unsigned>
   UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
                   cl::desc("The cut-off point for loop unrolling"));
@@ -134,7 +134,7 @@ BasicBlock* LoopUnroll::FoldBlockIntoPredecessor(BasicBlock* BB) {
   if (OnlyPred->getTerminator()->getNumSuccessors() != 1)
     return 0;
 
-  DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred);
+  DOUT << "Merging: " << *BB << "into: " << *OnlyPred;
 
   // Resolve any PHI nodes at the start of the block.  They are all
   // guaranteed to have exactly one entry if they exist, unless there are
@@ -194,15 +194,15 @@ bool LoopUnroll::visitLoop(Loop *L) {
     return Changed; // More than 2^32 iterations???
 
   unsigned LoopSize = ApproximateLoopSize(L);
-  DEBUG(std::cerr << "Loop Unroll: F[" << Header->getParent()->getName()
-        << "] Loop %" << Header->getName() << " Loop Size = "
-        << LoopSize << " Trip Count = " << TripCountFull << " - ");
+  DOUT << "Loop Unroll: F[" << Header->getParent()->getName()
+       << "] Loop %" << Header->getName() << " Loop Size = "
+       << LoopSize << " Trip Count = " << TripCountFull << " - ";
   uint64_t Size = (uint64_t)LoopSize*TripCountFull;
   if (Size > UnrollThreshold) {
-    DEBUG(std::cerr << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n");
+    DOUT << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n";
     return Changed;
   }
-  DEBUG(std::cerr << "UNROLLING!\n");
+  DOUT << "UNROLLING!\n";
 
   std::vector<BasicBlock*> LoopBlocks = L->getBlocks();