RequirementMachine: Fix crash in simplifyRewriteSystem() with -debug-requirement-machine=completion

If we're not recording homotopy generators, we can't access
HomotopyGenerators.back() in the debug output.
This commit is contained in:
Slava Pestov
2021-10-25 15:04:01 -04:00
parent bcf5e9794b
commit 84f02eae49

View File

@@ -398,12 +398,13 @@ void RewriteSystem::simplifyRewriteSystem() {
loop.add(RewriteStep::forRewriteRule(/*startOffset=*/0, /*endOffset=*/0,
newRuleID, /*inverse=*/true));
recordHomotopyGenerator(MutableTerm(lhs), loop);
if (Debug.contains(DebugFlags::Completion)) {
llvm::dbgs() << "$ Right hand side simplification recorded a loop: ";
HomotopyGenerators.back().dump(llvm::dbgs(), *this);
llvm::dbgs() << "$ Right hand side simplification recorded a loop at ";
llvm::dbgs() << lhs << ": ";
loop.dump(llvm::dbgs(), MutableTerm(lhs), *this);
}
recordHomotopyGenerator(MutableTerm(lhs), loop);
}
}