@@ -367,7 +367,6 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
367
367
const RewriteSystem &system) {
368
368
assert (step.Kind == RewriteStep::Decompose);
369
369
370
- auto &ctx = system.getRewriteContext ();
371
370
unsigned numSubstitutions = step.Arg ;
372
371
373
372
if (!step.Inverse ) {
@@ -405,15 +404,8 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
405
404
406
405
// The term immediately underneath the substitutions is the one we're
407
406
// updating with new substitutions.
408
- auto &term = *(Primary.end () - numSubstitutions - 1 );
409
-
410
- auto &symbol = *(term.end () - step.EndOffset - 1 );
411
- if (!symbol.hasSubstitutions ()) {
412
- llvm::errs () << " Expected term with superclass or concrete type symbol"
413
- << " on primary stack\n " ;
414
- dump (llvm::errs ());
415
- abort ();
416
- }
407
+ const auto &term = *(Primary.end () - numSubstitutions - 1 );
408
+ auto symbol = *(term.end () - step.EndOffset - 1 );
417
409
418
410
// The symbol at the end of this term must have the expected number of
419
411
// substitutions.
@@ -423,17 +415,16 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
423
415
abort ();
424
416
}
425
417
426
- // Collect the substitutions from the primary stack.
427
- SmallVector<Term, 2 > substitutions;
428
- substitutions.reserve (numSubstitutions);
429
418
for (unsigned i = 0 ; i < numSubstitutions; ++i) {
430
419
const auto &substitution = *(Primary.end () - numSubstitutions + i);
431
- substitutions.push_back (Term::get (substitution, ctx));
420
+ if (MutableTerm (symbol.getSubstitutions ()[i]) != substitution) {
421
+ llvm::errs () << " Expected " << symbol.getSubstitutions ()[i] << " \n " ;
422
+ llvm::errs () << " Got " << substitution << " \n " ;
423
+ dump (llvm::errs ());
424
+ abort ();
425
+ }
432
426
}
433
427
434
- // Build the new symbol with the new substitutions.
435
- symbol = symbol.withConcreteSubstitutions (substitutions, ctx);
436
-
437
428
// Pop the substitutions from the primary stack.
438
429
Primary.resize (Primary.size () - numSubstitutions);
439
430
}
0 commit comments