|
30 | 30 | #include "llvm/ADT/SmallPtrSet.h"
|
31 | 31 | #include "llvm/ADT/SmallVector.h"
|
32 | 32 | #include "llvm/ADT/Statistic.h"
|
| 33 | +#include "llvm/Support/CommandLine.h" |
33 | 34 |
|
34 | 35 | using namespace swift;
|
35 | 36 |
|
@@ -457,6 +458,10 @@ struct SemanticARCOptVisitor
|
457 | 458 |
|
458 | 459 | } // end anonymous namespace
|
459 | 460 |
|
| 461 | +static llvm::cl::opt<bool> |
| 462 | +VerifyAfterTransform("sil-semantic-arc-opts-verify-after-transform", |
| 463 | + llvm::cl::init(false), llvm::cl::Hidden); |
| 464 | + |
460 | 465 | bool SemanticARCOptVisitor::processWorklist() {
|
461 | 466 | // NOTE: The madeChange here is not strictly necessary since we only have
|
462 | 467 | // items added to the worklist today if we have already made /some/ sort of
|
@@ -492,14 +497,21 @@ bool SemanticARCOptVisitor::processWorklist() {
|
492 | 497 | deleteAllDebugUses(defInst);
|
493 | 498 | eraseInstruction(defInst);
|
494 | 499 | madeChange = true;
|
| 500 | + if (VerifyAfterTransform) { |
| 501 | + F.verify(); |
| 502 | + } |
495 | 503 | continue;
|
496 | 504 | }
|
497 | 505 | }
|
498 | 506 |
|
499 | 507 | // Otherwise, if we have a single value instruction (to be expanded later
|
500 | 508 | // perhaps), try to visit that value recursively.
|
501 | 509 | 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 | + } |
503 | 515 | continue;
|
504 | 516 | }
|
505 | 517 | }
|
|
0 commit comments