mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
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
This commit is contained in:
parent
e050e59a47
commit
333403abbd
@ -114,7 +114,8 @@ void Region::replaceExitRecursive(BasicBlock *NewExit) {
|
||||
bool Region::contains(const BasicBlock *B) const {
|
||||
BasicBlock *BB = const_cast<BasicBlock*>(B);
|
||||
|
||||
assert(DT->getNode(BB) && "BB not part of the dominance tree");
|
||||
if (!DT->getNode(BB))
|
||||
return false;
|
||||
|
||||
BasicBlock *entry = getEntry(), *exit = getExit();
|
||||
|
||||
|
29
test/Analysis/RegionInfo/unreachable_bb.ll
Normal file
29
test/Analysis/RegionInfo/unreachable_bb.ll
Normal file
@ -0,0 +1,29 @@
|
||||
; RUN: opt -regions -analyze < %s | FileCheck %s
|
||||
|
||||
; We should not crash if there are some bbs that are not reachable.
|
||||
define void @f() {
|
||||
entry:
|
||||
br label %for.pre
|
||||
|
||||
notintree: ; No predecessors!
|
||||
br label %ret
|
||||
|
||||
for.pre: ; preds = %entry
|
||||
br label %for
|
||||
|
||||
for: ; preds = %for.inc, %for.pre
|
||||
%indvar = phi i64 [ 0, %for.pre ], [ %indvar.next, %for.inc ]
|
||||
%exitcond = icmp ne i64 %indvar, 200
|
||||
br i1 %exitcond, label %for.inc, label %ret
|
||||
|
||||
for.inc: ; preds = %for
|
||||
%indvar.next = add i64 %indvar, 1
|
||||
br label %for
|
||||
|
||||
ret: ; preds = %for, %notintree
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: [0] entry => <Function Return>
|
||||
; CHECK: [1] for => ret
|
||||
|
Loading…
Reference in New Issue
Block a user