Add two statistics to help track how we are computing the inline cost.
[oota-llvm.git] / lib / Analysis / MemoryDependenceAnalysis.cpp
index cfaf2da6ce5b29212761267fabf836e927d0441b..3a544f35d502cdb83d9441690e7d033c92cbffa8 100644 (file)
@@ -350,14 +350,18 @@ namespace {
 
     bool shouldExplore(Use *U) {
       Instruction *I = cast<Instruction>(U->getUser());
-      if (BeforeHere != I && DT->dominates(BeforeHere, I))
+      BasicBlock *BB = I->getParent();
+      if (BeforeHere != I &&
+          (!DT->isReachableFromEntry(BB) || DT->dominates(BeforeHere, I)))
         return false;
       return true;
     }
 
     bool captured(Use *U) {
       Instruction *I = cast<Instruction>(U->getUser());
-      if (BeforeHere != I && DT->dominates(BeforeHere, I))
+      BasicBlock *BB = I->getParent();
+      if (BeforeHere != I &&
+          (!DT->isReachableFromEntry(BB) || DT->dominates(BeforeHere, I)))
         return false;
       Captured = true;
       return true;