Skip to content

[sil] Teach the SILVerifier how to validate that a builtin insts are … #27251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/SIL/SILVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1630,8 +1630,16 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {

void checkBuiltinInst(BuiltinInst *BI) {
// Check for special constraints on llvm intrinsics.
if (BI->getIntrinsicInfo().ID != llvm::Intrinsic::not_intrinsic)
if (BI->getIntrinsicInfo().ID != llvm::Intrinsic::not_intrinsic) {
verifyLLVMIntrinsic(BI, BI->getIntrinsicInfo().ID);
return;
}

// At this point, we know that we have a Builtin that is a Swift Builtin
// rather than an llvm intrinsic. Make sure our name corresponds to an
// actual ValueDecl. Otherwise, we have an invalid builtin.
require(getBuiltinValueDecl(BI->getModule().getASTContext(), BI->getName()),
"Invalid builtin name?!");
}

void checkFunctionRefBaseInst(FunctionRefBaseInst *FRI) {
Expand Down