forked from OSchip/llvm-project
[Verifier] Avoid asserting on invalid cleanuppad chain
The invalid undef value already triggers a verifier failure, but then the upwards scan from the cleanuppad ends up asserting. Make sure this is handled gacefully instead.
This commit is contained in:
parent
cc79d603c9
commit
ed30a968b5
|
@ -3999,6 +3999,11 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
|
|||
"A single unwind edge may only enter one EH pad", TI);
|
||||
Assert(Seen.insert(FromPad).second,
|
||||
"EH pad jumps through a cycle of pads", FromPad);
|
||||
|
||||
// This will be diagnosed on the corresponding instruction already. We
|
||||
// need the extra check here to make sure getParentPad() works.
|
||||
Assert(isa<FuncletPadInst>(FromPad) || isa<CatchSwitchInst>(FromPad),
|
||||
"Parent pad must be catchpad/cleanuppad/catchswitch", TI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: CleanupReturnInst needs to be provided a CleanupPad
|
||||
; CHECK-NEXT: cleanupret from undef unwind label %bb2
|
||||
; CHECK-NEXT: token undef
|
||||
; CHECK: Parent pad must be catchpad/cleanuppad/catchswitch
|
||||
; CHECK-NEXT: cleanupret from undef unwind label %bb2
|
||||
|
||||
define void @test() personality i32 (...)* undef {
|
||||
br label %bb1
|
||||
|
||||
bb1:
|
||||
cleanupret from undef unwind label %bb2
|
||||
|
||||
bb2:
|
||||
%pad = cleanuppad within none []
|
||||
cleanupret from %pad unwind to caller
|
||||
}
|
Loading…
Reference in New Issue