forked from OSchip/llvm-project
PR4317: Handle splits where the new block is unreachable correctly in
DominatorTreeBase::Split. llvm-svn: 72810
This commit is contained in:
parent
6c5d61ca09
commit
ee06b752f0
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue