- // The new block is not the immediate dominator for any other nodes, but
- // TINode is the immediate dominator for the new node.
- //
+ // Should we update ImmdediateDominator information?
+ if (ImmediateDominators *ID = P->getAnalysisToUpdate<ImmediateDominators>()) {
+ // TIBB is the new immediate dominator for NewBB. NewBB doesn't dominate
+ // anything.
+ ID->addNewBlock(NewBB, TIBB);
+ }
+
+ // Should we update DominatorTree information?
+ if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
+ DominatorTree::Node *TINode = DT->getNode(TIBB);
+
+ // The new block is not the immediate dominator for any other nodes, but
+ // TINode is the immediate dominator for the new node.
+ //
+ if (TINode) // Don't break unreachable code!