Skip to content

[ownership] Fix no-asserts build. #27527

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
12 changes: 11 additions & 1 deletion lib/SIL/SILOwnershipVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,20 @@ void SILValue::verifyOwnership(DeadEndBlocks *deadEndBlocks) const {
if (DisableOwnershipVerification)
return;

// Do not validate SILUndef values.
if (isa<SILUndef>(Value))
return;

#ifdef NDEBUG
// When compiling without asserts enabled, only verify ownership if
// -sil-verify-all is set.
if (!getModule().getOptions().VerifyAll)
//
// NOTE: We purposely return if we do can not look up a module here to ensure
// that if we run into something that we do not understand, we do not assert
// in user code even tohugh we aren't going to actually verify (the default
// behavior when -sil-verify-all is disabled).
auto *Mod = Value->getModule();
if (!Mod || !Mod->getOptions().VerifyAll)
return;
#endif

Expand Down