Don't call dominates on unreachable instructions. Should fix the dragonegg
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 26 Feb 2012 05:30:08 +0000 (05:30 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 26 Feb 2012 05:30:08 +0000 (05:30 +0000)
build. Testcase is still reducing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151474 91177308-0d34-0410-b5e6-96231b3b80d8

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;