@@ -367,7 +367,6 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
367367 const RewriteSystem &system) {
368368 assert (step.Kind == RewriteStep::Decompose);
369369
370- auto &ctx = system.getRewriteContext ();
371370 unsigned numSubstitutions = step.Arg ;
372371
373372 if (!step.Inverse ) {
@@ -405,15 +404,8 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
405404
406405 // The term immediately underneath the substitutions is the one we're
407406 // 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 );
417409
418410 // The symbol at the end of this term must have the expected number of
419411 // substitutions.
@@ -423,17 +415,16 @@ void RewritePathEvaluator::applyDecompose(const RewriteStep &step,
423415 abort ();
424416 }
425417
426- // Collect the substitutions from the primary stack.
427- SmallVector<Term, 2 > substitutions;
428- substitutions.reserve (numSubstitutions);
429418 for (unsigned i = 0 ; i < numSubstitutions; ++i) {
430419 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+ }
432426 }
433427
434- // Build the new symbol with the new substitutions.
435- symbol = symbol.withConcreteSubstitutions (substitutions, ctx);
436-
437428 // Pop the substitutions from the primary stack.
438429 Primary.resize (Primary.size () - numSubstitutions);
439430 }
0 commit comments