@@ -244,12 +244,14 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
244
244
// adding new rules in the property map's concrete type unification procedure.
245
245
Complete = 1 ;
246
246
247
- bool again = false ;
247
+ unsigned ruleCount ;
248
248
249
249
std::vector<CriticalPair> resolvedCriticalPairs;
250
250
std::vector<RewriteLoop> resolvedLoops;
251
251
252
252
do {
253
+ ruleCount = Rules.size ();
254
+
253
255
// For every rule, looking for other rules that overlap with this rule.
254
256
for (unsigned i = 0 , e = Rules.size (); i < e; ++i) {
255
257
const auto &lhs = getRule (i);
@@ -335,9 +337,10 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
335
337
}
336
338
}
337
339
340
+ assert (ruleCount == Rules.size ());
341
+
338
342
simplifyLeftHandSides ();
339
343
340
- again = false ;
341
344
for (const auto &pair : resolvedCriticalPairs) {
342
345
// Check if we've already done too much work.
343
346
if (Rules.size () > maxRuleCount)
@@ -349,8 +352,6 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
349
352
// Check if the new rule is too long.
350
353
if (Rules.back ().getDepth () > maxRuleLength)
351
354
return std::make_pair (CompletionResult::MaxRuleLength, Rules.size () - 1 );
352
-
353
- again = true ;
354
355
}
355
356
356
357
for (const auto &loop : resolvedLoops) {
@@ -362,7 +363,7 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
362
363
363
364
simplifyRightHandSides ();
364
365
simplifyLeftHandSideSubstitutions (/* map=*/ nullptr );
365
- } while (again );
366
+ } while (Rules. size () > ruleCount );
366
367
367
368
return std::make_pair (CompletionResult::Success, 0 );
368
369
}
0 commit comments