llvm.org GIT mirror llvm / 333403a
RegionInfo: Do not crash if unreachable block is found git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181025 91177308-0d34-0410-b5e6-96231b3b80d8 Tobias Grosser 6 years ago
2 changed file(s) with 31 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
113113 bool Region::contains(const BasicBlock *B) const {
114114 BasicBlock *BB = const_cast(B);
115115
116 assert(DT->getNode(BB) && "BB not part of the dominance tree");
116 if (!DT->getNode(BB))
117 return false;
117118
118119 BasicBlock *entry = getEntry(), *exit = getExit();
119120
0 ; RUN: opt -regions -analyze < %s | FileCheck %s
1
2 ; We should not crash if there are some bbs that are not reachable.
3 define void @f() {
4 entry:
5 br label %for.pre
6
7 notintree: ; No predecessors!
8 br label %ret
9
10 for.pre: ; preds = %entry
11 br label %for
12
13 for: ; preds = %for.inc, %for.pre
14 %indvar = phi i64 [ 0, %for.pre ], [ %indvar.next, %for.inc ]
15 %exitcond = icmp ne i64 %indvar, 200
16 br i1 %exitcond, label %for.inc, label %ret
17
18 for.inc: ; preds = %for
19 %indvar.next = add i64 %indvar, 1
20 br label %for
21
22 ret: ; preds = %for, %notintree
23 ret void
24 }
25
26 ; CHECK: [0] entry =>
27 ; CHECK: [1] for => ret
28