Skip to content

Commit 6b1af59

Browse files
authored
Merge pull request swiftlang#30104 from gottesmm/pr-cc29e3d175061f19a6d6a201fa78c513d626a498
2 parents a5241ed + a45c51e commit 6b1af59

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/SILOptimizer/Transforms/SemanticARCOpts.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "llvm/ADT/SmallPtrSet.h"
3131
#include "llvm/ADT/SmallVector.h"
3232
#include "llvm/ADT/Statistic.h"
33+
#include "llvm/Support/CommandLine.h"
3334

3435
using namespace swift;
3536

@@ -457,6 +458,10 @@ struct SemanticARCOptVisitor
457458

458459
} // end anonymous namespace
459460

461+
static llvm::cl::opt<bool>
462+
VerifyAfterTransform("sil-semantic-arc-opts-verify-after-transform",
463+
llvm::cl::init(false), llvm::cl::Hidden);
464+
460465
bool SemanticARCOptVisitor::processWorklist() {
461466
// NOTE: The madeChange here is not strictly necessary since we only have
462467
// items added to the worklist today if we have already made /some/ sort of
@@ -492,14 +497,21 @@ bool SemanticARCOptVisitor::processWorklist() {
492497
deleteAllDebugUses(defInst);
493498
eraseInstruction(defInst);
494499
madeChange = true;
500+
if (VerifyAfterTransform) {
501+
F.verify();
502+
}
495503
continue;
496504
}
497505
}
498506

499507
// Otherwise, if we have a single value instruction (to be expanded later
500508
// perhaps), try to visit that value recursively.
501509
if (auto *svi = dyn_cast<SingleValueInstruction>(next)) {
502-
madeChange |= visit(svi);
510+
bool madeSingleChange = visit(svi);
511+
madeChange |= madeSingleChange;
512+
if (VerifyAfterTransform && madeSingleChange) {
513+
F.verify();
514+
}
503515
continue;
504516
}
505517
}

0 commit comments

Comments
 (0)