- Fix bug: cee/2002-10-07-NoImmediateDominator.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4081 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/BreakCriticalEdges.cpp b/lib/Transforms/Scalar/BreakCriticalEdges.cpp
index b73ed55..0c4974d 100644
--- a/lib/Transforms/Scalar/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Scalar/BreakCriticalEdges.cpp
@@ -118,7 +118,8 @@
// The new block is not the immediate dominator for any other nodes, but
// TINode is the immediate dominator for the new node.
//
- DT->createNewNode(NewBB, TINode);
+ if (TINode) // Don't break unreachable code!
+ DT->createNewNode(NewBB, TINode);
}
}
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index b73ed55..0c4974d 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -118,7 +118,8 @@
// The new block is not the immediate dominator for any other nodes, but
// TINode is the immediate dominator for the new node.
//
- DT->createNewNode(NewBB, TINode);
+ if (TINode) // Don't break unreachable code!
+ DT->createNewNode(NewBB, TINode);
}
}