llvm.org GIT mirror llvm / a8ba2c2
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 Eli Friedman 11 years ago
2 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
269269 NewBBIDom = PredBlocks[i];
270270 break;
271271 }
272 assert(i != PredBlocks.size() && "No reachable preds?");
272
273 // It's possible that none of the predecessors of NewBB are reachable;
274 // in that case, NewBB itself is unreachable, so nothing needs to be
275 // changed.
276 if (!NewBBIDom)
277 return;
278
273279 for (i = i + 1; i < PredBlocks.size(); ++i) {
274280 if (DT.isReachableFromEntry(PredBlocks[i]))
275281 NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]);
276282 }
277 assert(NewBBIDom && "No immediate dominator found??");
278283
279284 // Create the new dominator tree node... and set the idom of NewBB.
280285 DomTreeNodeBase *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom);
0 ; RUN: llvm-as < %s | llc
1 ; PR4317
2
3 declare i32 @b()
4
5 define void @a() {
6 entry:
7 ret void
8
9 dummy:
10 invoke i32 @b() to label %reg unwind label %reg
11
12 reg:
13 ret void
14 }