Skip to content

Commit 57374e4

Browse files
committed
SILVerifier: allow trivial extend_liveness
1 parent 027684a commit 57374e4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/SIL/Verifier/SILOwnershipVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ bool SILValueOwnershipChecker::checkYieldWithoutLifetimeEndingUses(
607607

608608
bool SILValueOwnershipChecker::checkValueWithoutLifetimeEndingUses(
609609
ArrayRef<Operand *> regularUses, ArrayRef<Operand *> extendLifetimeUses) {
610-
if (extendLifetimeUses.size()) {
611-
}
610+
if (value->getOwnershipKind() == OwnershipKind::None)
611+
return true;
612612

613613
LLVM_DEBUG(llvm::dbgs() << "No lifetime ending users?! Bailing early.\n");
614614
if (auto *arg = dyn_cast<SILFunctionArgument>(value)) {

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,14 +2702,18 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
27022702
}
27032703

27042704
void checkExtendLifetimeInst(ExtendLifetimeInst *I) {
2705-
require(!I->getOperand()->getType().isTrivial(*I->getFunction())
2706-
|| F.getModule().getStage() == SILStage::Raw,
2707-
"Source value should be non-trivial after diagnostics");
27082705
require(F.hasOwnership(),
27092706
"extend_lifetime is only valid in functions with qualified "
27102707
"ownership");
2708+
// In Raw SIL, extend_lifetime marks the end of variable scopes.
2709+
if (F.getModule().getStage() == SILStage::Raw)
2710+
return;
2711+
2712+
require(!I->getOperand()->getType().isTrivial(*I->getFunction()),
2713+
"Source value should be non-trivial after diagnostics");
27112714
require(getDeadEndBlocks().isDeadEnd(I->getParent()),
2712-
"extend_lifetime in non-dead-end!?");
2715+
"extend_lifetime in non-dead-end after diagnostics");
2716+
27132717
auto value = I->getOperand();
27142718
LinearLiveness linearLiveness(value,
27152719
LinearLiveness::DoNotIncludeExtensions);

0 commit comments

Comments
 (0)