Template Function sequant::opt::eliminate_common_subexpressions¶
Defined in File common_subexpression_elimination.hpp
Function Documentation¶
-
template<std::ranges::range VectorLike, std::regular_invocable<ExprPtr> Transformer, bool force_hash_collisions = false>
std::vector<std::size_t> sequant::opt::eliminate_common_subexpressions(VectorLike &expr_trees, const Transformer &expr_to_tree, const CSEOptions<std::ranges::range_value_t<VectorLike>> opts = {})¶ Takes the range of expression trees and performs common subexpression elimination on them. Evaluation trees for intermediates are inserted into the given container as needed.
- Parameters:
expr_trees – Container (vector-like) of evaluation trees
expr_to_tree – Functor that can convert ExprPtr and ResultExpr objects into suitable evaluation trees
filter_predicate – A predicate to filter out subexpressions that shall not be eliminated