Skip to content

Commit 98be00b

Browse files
authored
Merge pull request #41171 from gottesmm/pr-07c6420d9eb5735b0c1a83ae98c687330d85ea12
[value-move-function] Eliminate unnecessary book keeping.
2 parents 63b98d5 + c28ad2d commit 98be00b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/SILOptimizer/Mandatory/MoveKillsCopyableValuesChecker.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ bool CheckerLivenessInfo::compute() {
8484
while (SILValue value = defUseWorklist.pop()) {
8585
LLVM_DEBUG(llvm::dbgs() << "New Value: " << value);
8686
SWIFT_DEFER { LLVM_DEBUG(llvm::dbgs() << "Finished Value: " << value); };
87+
8788
for (Operand *use : value->getUses()) {
8889
auto *user = use->getUser();
8990
LLVM_DEBUG(llvm::dbgs() << " User: " << *user);
@@ -190,7 +191,6 @@ namespace {
190191
struct MoveKillsCopyableValuesChecker {
191192
SILFunction *fn;
192193
CheckerLivenessInfo livenessInfo;
193-
SmallSetVector<MoveValueInst *, 1> movesWithinLivenessBoundary;
194194

195195
MoveKillsCopyableValuesChecker(SILFunction *fn) : fn(fn) {}
196196
bool check();
@@ -377,7 +377,6 @@ bool MoveKillsCopyableValuesChecker::check() {
377377

378378
// Then look at all of our found consuming uses. See if any of these are
379379
// _move that are within the boundary.
380-
SWIFT_DEFER { movesWithinLivenessBoundary.clear(); };
381380
for (auto *use : livenessInfo.consumingUse) {
382381
if (auto *mvi = dyn_cast<MoveValueInst>(use->getUser())) {
383382
// Only emit diagnostics if our move value allows us to.
@@ -392,18 +391,12 @@ bool MoveKillsCopyableValuesChecker::check() {
392391
LLVM_DEBUG(llvm::dbgs() << "Move Value: " << *mvi);
393392
if (livenessInfo.liveness.isWithinBoundary(mvi)) {
394393
LLVM_DEBUG(llvm::dbgs() << " WithinBoundary: Yes!\n");
395-
movesWithinLivenessBoundary.insert(mvi);
394+
emitDiagnosticForMove(lexicalValue, varName, mvi);
396395
} else {
397396
LLVM_DEBUG(llvm::dbgs() << " WithinBoundary: No!\n");
398397
}
399398
}
400399
}
401-
402-
// Ok, we found all of our moves that violate the boundary condition, lets
403-
// emit diagnostics for each of them.
404-
for (auto *mvi : movesWithinLivenessBoundary) {
405-
emitDiagnosticForMove(lexicalValue, varName, mvi);
406-
}
407400
}
408401

409402
return false;

0 commit comments

Comments
 (0)