[llvm-commits] [llvm] r72810 - in /llvm/trunk: include/llvm/Analysis/Dominators.h test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll
Eli Friedman
eli.friedman at gmail.com
Wed Jun 3 14:42:06 PDT 2009
Author: efriedma
Date: Wed Jun 3 16:42:06 2009
New Revision: 72810
URL: http://llvm.org/viewvc/llvm-project?rev=72810&view=rev
Log:
PR4317: Handle splits where the new block is unreachable correctly in
DominatorTreeBase::Split.
Added:
llvm/trunk/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll
Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=72810&r1=72809&r2=72810&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Wed Jun 3 16:42:06 2009
@@ -270,12 +270,17 @@
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);
Added: llvm/trunk/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll?rev=72810&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/2009-06-03-UnreachableSplitPad.ll Wed Jun 3 16:42:06 2009
@@ -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
+}
More information about the llvm-commits
mailing list