Skip to content

Commit 948a698

Browse files
committed
RequirementMachine: More debugging messages and a new assert
1 parent 7ac42b4 commit 948a698

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

lib/AST/RequirementMachine/SimplifySubstitutions.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,29 @@ void RewriteSystem::processTypeDifference(const TypeDifference &difference,
193193
unsigned differenceID,
194194
unsigned lhsRuleID,
195195
const RewritePath &rhsPath) {
196-
if (!CheckedDifferences.insert(differenceID).second)
197-
return;
198-
199196
bool debug = Debug.contains(DebugFlags::ConcreteUnification);
200197

198+
if (!CheckedDifferences.insert(differenceID).second) {
199+
if (debug) {
200+
llvm::dbgs() << "%% Already processed difference ID "
201+
<< differenceID << "\n";
202+
}
203+
204+
auto &lhsRule = getRule(lhsRuleID);
205+
if (lhsRule.getRHS() == difference.BaseTerm &&
206+
!lhsRule.isSubstitutionSimplified()) {
207+
llvm::errs() << "Rule should already be subst-simplified: "
208+
<< lhsRule << "\n";
209+
llvm::errs() << "Difference ID: " << differenceID << "\n\n";
210+
dump(llvm::errs());
211+
abort();
212+
}
213+
214+
return;
215+
}
216+
201217
if (debug) {
218+
llvm::dbgs() << "%% Processing difference ID " << differenceID << "\n";
202219
difference.dump(llvm::dbgs());
203220
}
204221

@@ -263,7 +280,8 @@ void RewriteSystem::processTypeDifference(const TypeDifference &difference,
263280
!lhsRule.isSubstitutionSimplified()) {
264281
if (lhsRule.isFrozen()) {
265282
llvm::errs() << "Frozen rule should already be subst-simplified: "
266-
<< lhsRule << "\n\n";
283+
<< lhsRule << "\n";
284+
llvm::errs() << "Difference ID: " << differenceID << "\n\n";
267285
dump(llvm::errs());
268286
abort();
269287
}

0 commit comments

Comments
 (0)