Switch obvious clients to Twine instead of utostr (when they were already using
[oota-llvm.git] / lib / Transforms / Scalar / LoopUnroll.cpp
index 2025fb6828852b8e1bce77b938fb702652ab1bab..7d551f1001ee27f3a29a4d30c9820a459fc4910c 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/UnrollLoop.h"
 #include <climits>
 
@@ -89,6 +90,8 @@ static unsigned ApproximateLoopSize(const Loop *L) {
         // Ignore instructions only used by the loop terminator.
       } else if (isa<DbgInfoIntrinsic>(I)) {
         // Ignore debug instructions
+      } else if (isa<GetElementPtrInst>(I) && I->hasOneUse()) {
+        // Ignore GEP as they generally are subsumed into a load or store.
       } else if (isa<CallInst>(I)) {
         // Estimate size overhead introduced by call instructions which
         // is higher than other instructions. Here 3 and 10 are magic
@@ -116,8 +119,9 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
   LoopInfo *LI = &getAnalysis<LoopInfo>();
 
   BasicBlock *Header = L->getHeader();
-  DOUT << "Loop Unroll: F[" << Header->getParent()->getName()
-       << "] Loop %" << Header->getName() << "\n";
+  DEBUG(errs() << "Loop Unroll: F[" << Header->getParent()->getName()
+        << "] Loop %" << Header->getName() << "\n");
+  (void)Header;
 
   // Find trip count
   unsigned TripCount = L->getSmallConstantTripCount();