@@ -375,6 +375,10 @@ findRuleToDelete(llvm::function_ref<bool(unsigned)> isRedundantRuleFn) {
375
375
376
376
Optional<std::pair<unsigned , unsigned >> found;
377
377
378
+ if (Debug.contains (DebugFlags::HomotopyReduction)) {
379
+ llvm::dbgs () << " \n " ;
380
+ }
381
+
378
382
for (const auto &pair : redundancyCandidates) {
379
383
unsigned ruleID = pair.second ;
380
384
const auto &rule = getRule (ruleID);
@@ -402,7 +406,7 @@ findRuleToDelete(llvm::function_ref<bool(unsigned)> isRedundantRuleFn) {
402
406
continue ;
403
407
}
404
408
405
- if (Debug.contains (DebugFlags::HomotopyReduction )) {
409
+ if (Debug.contains (DebugFlags::HomotopyReductionDetail )) {
406
410
llvm::dbgs () << " ** Candidate " << rule << " from loop #"
407
411
<< pair.first << " \n " ;
408
412
}
@@ -474,7 +478,8 @@ void RewriteSystem::deleteRule(unsigned ruleID,
474
478
const RewritePath &replacementPath) {
475
479
// Replace all occurrences of the rule with the replacement path in
476
480
// all remaining rewrite loops.
477
- for (auto &loop : Loops) {
481
+ for (unsigned loopID : indices (Loops)) {
482
+ auto &loop = Loops[loopID];
478
483
if (loop.isDeleted ())
479
484
continue ;
480
485
@@ -486,8 +491,8 @@ void RewriteSystem::deleteRule(unsigned ruleID,
486
491
// result of findRulesAppearingOnceInEmptyContext().
487
492
loop.markDirty ();
488
493
489
- if (Debug.contains (DebugFlags::HomotopyReduction )) {
490
- llvm::dbgs () << " ** Updated loop: " ;
494
+ if (Debug.contains (DebugFlags::HomotopyReductionDetail )) {
495
+ llvm::dbgs () << " ** Updated loop # " << loopID << " : " ;
491
496
loop.dump (llvm::dbgs (), *this );
492
497
llvm::dbgs () << " \n " ;
493
498
}
@@ -534,6 +539,12 @@ void RewriteSystem::performHomotopyReduction(
534
539
// /
535
540
// / Redundant rules are mutated to set their isRedundant() bit.
536
541
void RewriteSystem::minimizeRewriteSystem () {
542
+ if (Debug.contains (DebugFlags::HomotopyReduction)) {
543
+ llvm::dbgs () << " -----------------------------\n " ;
544
+ llvm::dbgs () << " - Minimizing rewrite system -\n " ;
545
+ llvm::dbgs () << " -----------------------------\n " ;
546
+ }
547
+
537
548
assert (Complete);
538
549
assert (!Minimized);
539
550
Minimized = 1 ;
@@ -545,7 +556,9 @@ void RewriteSystem::minimizeRewriteSystem() {
545
556
// - Eliminate all RHS-simplified and substitution-simplified rules.
546
557
// - Eliminate all rules with unresolved symbols.
547
558
if (Debug.contains (DebugFlags::HomotopyReduction)) {
548
- llvm::dbgs () << " \n First pass: simplified and unresolved rules\n\n " ;
559
+ llvm::dbgs () << " ---------------------------------------------\n " ;
560
+ llvm::dbgs () << " First pass: simplified and unresolved rules -\n " ;
561
+ llvm::dbgs () << " ---------------------------------------------\n " ;
549
562
}
550
563
551
564
performHomotopyReduction ([&](unsigned ruleID) -> bool {
@@ -577,7 +590,9 @@ void RewriteSystem::minimizeRewriteSystem() {
577
590
578
591
// Second pass: Eliminate all non-minimal conformance rules.
579
592
if (Debug.contains (DebugFlags::HomotopyReduction)) {
580
- llvm::dbgs () << " \n Second pass: non-minimal conformance rules\n\n " ;
593
+ llvm::dbgs () << " --------------------------------------------\n " ;
594
+ llvm::dbgs () << " Second pass: non-minimal conformance rules -\n " ;
595
+ llvm::dbgs () << " --------------------------------------------\n " ;
581
596
}
582
597
583
598
performHomotopyReduction ([&](unsigned ruleID) -> bool {
@@ -592,7 +607,9 @@ void RewriteSystem::minimizeRewriteSystem() {
592
607
593
608
// Third pass: Eliminate all other redundant non-conformance rules.
594
609
if (Debug.contains (DebugFlags::HomotopyReduction)) {
595
- llvm::dbgs () << " \n Third pass: all other redundant rules\n\n " ;
610
+ llvm::dbgs () << " ---------------------------------------\n " ;
611
+ llvm::dbgs () << " Third pass: all other redundant rules -\n " ;
612
+ llvm::dbgs () << " ---------------------------------------\n " ;
596
613
}
597
614
598
615
performHomotopyReduction ([&](unsigned ruleID) -> bool {
0 commit comments