Replace isTrapping with a new, similar method called
[oota-llvm.git] / lib / Transforms / Scalar / LoopUnroll.cpp
index 6d685d58f96b47079ee05e128925419ff58fbd86..23757cdb2d29c3326bbe02fa3ebbdb7c6a34bbb3 100644 (file)
@@ -89,6 +89,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
@@ -170,10 +172,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
     return false;
 
   // FIXME: Reconstruct dom info, because it is not preserved properly.
-  DominatorTree *DT = getAnalysisToUpdate<DominatorTree>();
+  DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
   if (DT) {
     DT->runOnFunction(*F);
-    DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>();
+    DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>();
     if (DF)
       DF->runOnFunction(*F);
   }