forked from OSchip/llvm-project
Fix PR45442: Bail out when MemorySSA information is not available
This commit is contained in:
parent
d54f5979bb
commit
44716856db
|
@ -521,6 +521,10 @@ private:
|
|||
if (NewPt == OldPt)
|
||||
return true;
|
||||
|
||||
// MemoryUseDef information is not available, bail out.
|
||||
if (!U)
|
||||
return false;
|
||||
|
||||
const BasicBlock *NewBB = NewPt->getParent();
|
||||
const BasicBlock *OldBB = OldPt->getParent();
|
||||
const BasicBlock *UBB = U->getBlock();
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
; RUN: opt < %s -gvn-hoist -S | FileCheck %s
|
||||
|
||||
; gvn-hoist shouldn't crash in this case.
|
||||
; CHECK-LABEL: @func()
|
||||
; CHECK: entry:
|
||||
; CHECK-NEXT: br i1
|
||||
; CHECK: bb1:
|
||||
; CHECK-NEXT: unreachable
|
||||
; CHECK: bb2:
|
||||
; CHECK-NEXT: call
|
||||
; CHECK-NEXT: call
|
||||
; CHECK-NEXT: unreachable
|
||||
|
||||
define void @v_1_0() #0 {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @func() {
|
||||
entry:
|
||||
br i1 undef, label %bb1, label %bb2
|
||||
|
||||
bb1:
|
||||
unreachable
|
||||
|
||||
bb2:
|
||||
call void @v_1_0()
|
||||
call void @v_1_0()
|
||||
unreachable
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind readonly }
|
Loading…
Reference in New Issue