Fix some incorrect logic in DominanceFrontier::splitBlock. Part of
[oota-llvm.git] / lib / VMCore / Dominators.cpp
index 6f1de466043df8937445f2bd03d5ab537a970b7d..735a70c509275cb33ae8a4b6b1494919d9852bec 100644 (file)
@@ -160,10 +160,7 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) {
         break;
       }
     }
-    
-    if (!BlockDominatesAny)
-      continue;
-    
+
     // If NewBBSucc should not stay in our dominator frontier, remove it.
     // We remove it unless there is a predecessor of NewBBSucc that we
     // dominate, but we don't strictly dominate NewBBSucc.
@@ -181,7 +178,8 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) {
     
     if (ShouldRemove)
       removeFromFrontier(DFI, NewBBSucc);
-    addToFrontier(DFI, NewBB);
+    if (BlockDominatesAny && (&*FI == NewBB || !DT.dominates(FI, NewBB)))
+      addToFrontier(DFI, NewBB);
   }
 }