35 struct ReplaceSumWithCount :
public NodeMapper {
36 ReplaceSumWithCount() =
default;
41 if (
auto* agg =
dynamic_cast<Aggregator*
>(node.get())) {
43 if (
const auto* constant =
50 for (
const auto& lit : agg->getBodyLiterals()) {
53 count->setBody(std::move(newBody));
56 auto result = mk<IntrinsicFunctor>(
"*", std::move(number), std::move(
count));
67 mutable bool changed =
false;
70 ReplaceSumWithCount update;
71 Program& program = translationUnit.getProgram();
72 program.
apply(update);
73 return update.changed;