[OpaquePtr] Support invoke instruction

With call support in place, this is only a matter of relaxing a
bitcode reader assertion.
This commit is contained in:
Nikita Popov 2021-06-22 22:10:51 +02:00
parent 56709b8695
commit e5f2b035dd
2 changed files with 18 additions and 1 deletions

View File

@ -4638,7 +4638,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
cast<PointerType>(Callee->getType())->getElementType()); cast<PointerType>(Callee->getType())->getElementType());
if (!FTy) if (!FTy)
return error("Callee is not of pointer to function type"); return error("Callee is not of pointer to function type");
} else if (cast<PointerType>(Callee->getType())->getElementType() != FTy) } else if (!CalleeTy->isOpaqueOrPointeeTypeMatches(FTy))
return error("Explicit invoke type does not match pointee type of " return error("Explicit invoke type does not match pointee type of "
"callee operand"); "callee operand");
if (Record.size() < FTy->getNumParams() + OpNum) if (Record.size() < FTy->getNumParams() + OpNum)

View File

@ -114,3 +114,20 @@ define void @call_arg(ptr %p, i32 %a) {
call void %p(i32 %a) call void %p(i32 %a)
ret void ret void
} }
; CHECK: define void @invoke(ptr %p) personality void ()* @personality {
; CHECK: invoke void %p()
; CHECK: to label %continue unwind label %cleanup
declare void @personality()
define void @invoke(ptr %p) personality void ()* @personality {
invoke void %p()
to label %continue unwind label %cleanup
continue:
ret void
cleanup:
landingpad {}
cleanup
ret void
}