Skip to content

Commit a32f2dd

Browse files
committed
[ConsumeValueChecker] Visit lexical moves.
Now that SILGen almost always represents a lexical lifetime with move_value [lexical] the fact that the checker doesn't consider such lifetimes is exposed. Fix it to look for such lifetimes.
1 parent 78e71e9 commit a32f2dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SILOptimizer/Mandatory/ConsumeOperatorCopyableValuesChecker.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@ bool ConsumeOperatorCopyableValuesChecker::check() {
409409

410410
for (auto &block : *fn) {
411411
for (auto &ii : block) {
412+
if (auto *mvi = dyn_cast<MoveValueInst>(&ii)) {
413+
if (mvi->isLexical() && !mvi->getType().isMoveOnly()) {
414+
LLVM_DEBUG(llvm::dbgs()
415+
<< "Found lexical lifetime to check: " << *mvi);
416+
valuesToCheck.insert(mvi);
417+
}
418+
}
412419
if (auto *bbi = dyn_cast<BeginBorrowInst>(&ii)) {
413420
if (bbi->isLexical() && !bbi->getType().isMoveOnly()) {
414421
LLVM_DEBUG(llvm::dbgs()

0 commit comments

Comments
 (0)