diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-06-03 21:42:06 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-06-03 21:42:06 +0000 |
commit | 3b65ccd1d2bf966a9e1a828eb8cf168260bdf651 (patch) | |
tree | d9b1d22cf0d2bf1cae1b79dc87c7273a9daac35f | |
parent | 52f655adffdfaf5e6b22f9b30602e363445bba7f (diff) | |
download | external_llvm-3b65ccd1d2bf966a9e1a828eb8cf168260bdf651.zip external_llvm-3b65ccd1d2bf966a9e1a828eb8cf168260bdf651.tar.gz external_llvm-3b65ccd1d2bf966a9e1a828eb8cf168260bdf651.tar.bz2 |
PR4317: Handle splits where the new block is unreachable correctly in
DominatorTreeBase::Split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72810 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 9 | ||||
-rw-r--r-- | test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll | 15 |
2 files changed, 22 insertions, 2 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index b405f5b..347e239 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -270,12 +270,17 @@ protected: NewBBIDom = PredBlocks[i]; break; } - assert(i != PredBlocks.size() && "No reachable preds?"); + + // It's possible that none of the predecessors of NewBB are reachable; + // in that case, NewBB itself is unreachable, so nothing needs to be + // changed. + if (!NewBBIDom) + return; + for (i = i + 1; i < PredBlocks.size(); ++i) { if (DT.isReachableFromEntry(PredBlocks[i])) NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]); } - assert(NewBBIDom && "No immediate dominator found??"); // Create the new dominator tree node... and set the idom of NewBB. DomTreeNodeBase<NodeT> *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); diff --git a/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll b/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll new file mode 100644 index 0000000..59e7d0c --- /dev/null +++ b/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc +; PR4317 + +declare i32 @b() + +define void @a() { +entry: + ret void + +dummy: + invoke i32 @b() to label %reg unwind label %reg + +reg: + ret void +} |