@@ -375,6 +375,10 @@ findRuleToDelete(llvm::function_ref<bool(unsigned)> isRedundantRuleFn) {
375375
376376 Optional<std::pair<unsigned , unsigned >> found;
377377
378+ if (Debug.contains (DebugFlags::HomotopyReduction)) {
379+ llvm::dbgs () << " \n " ;
380+ }
381+
378382 for (const auto &pair : redundancyCandidates) {
379383 unsigned ruleID = pair.second ;
380384 const auto &rule = getRule (ruleID);
@@ -402,7 +406,7 @@ findRuleToDelete(llvm::function_ref<bool(unsigned)> isRedundantRuleFn) {
402406 continue ;
403407 }
404408
405- if (Debug.contains (DebugFlags::HomotopyReduction )) {
409+ if (Debug.contains (DebugFlags::HomotopyReductionDetail )) {
406410 llvm::dbgs () << " ** Candidate " << rule << " from loop #"
407411 << pair.first << " \n " ;
408412 }
@@ -474,7 +478,8 @@ void RewriteSystem::deleteRule(unsigned ruleID,
474478 const RewritePath &replacementPath) {
475479 // Replace all occurrences of the rule with the replacement path in
476480 // all remaining rewrite loops.
477- for (auto &loop : Loops) {
481+ for (unsigned loopID : indices (Loops)) {
482+ auto &loop = Loops[loopID];
478483 if (loop.isDeleted ())
479484 continue ;
480485
@@ -486,8 +491,8 @@ void RewriteSystem::deleteRule(unsigned ruleID,
486491 // result of findRulesAppearingOnceInEmptyContext().
487492 loop.markDirty ();
488493
489- if (Debug.contains (DebugFlags::HomotopyReduction )) {
490- llvm::dbgs () << " ** Updated loop: " ;
494+ if (Debug.contains (DebugFlags::HomotopyReductionDetail )) {
495+ llvm::dbgs () << " ** Updated loop # " << loopID << " : " ;
491496 loop.dump (llvm::dbgs (), *this );
492497 llvm::dbgs () << " \n " ;
493498 }
@@ -534,6 +539,12 @@ void RewriteSystem::performHomotopyReduction(
534539// /
535540// / Redundant rules are mutated to set their isRedundant() bit.
536541void 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+
537548 assert (Complete);
538549 assert (!Minimized);
539550 Minimized = 1 ;
@@ -545,7 +556,9 @@ void RewriteSystem::minimizeRewriteSystem() {
545556 // - Eliminate all RHS-simplified and substitution-simplified rules.
546557 // - Eliminate all rules with unresolved symbols.
547558 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 " ;
549562 }
550563
551564 performHomotopyReduction ([&](unsigned ruleID) -> bool {
@@ -577,7 +590,9 @@ void RewriteSystem::minimizeRewriteSystem() {
577590
578591 // Second pass: Eliminate all non-minimal conformance rules.
579592 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 " ;
581596 }
582597
583598 performHomotopyReduction ([&](unsigned ruleID) -> bool {
@@ -592,7 +607,9 @@ void RewriteSystem::minimizeRewriteSystem() {
592607
593608 // Third pass: Eliminate all other redundant non-conformance rules.
594609 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 " ;
596613 }
597614
598615 performHomotopyReduction ([&](unsigned ruleID) -> bool {
0 commit comments