A change extracted from https://github.com/llvm/llvm-project/pull/91655, where I'm still trying to get the attributes working for elementwise constant folding of polynomial ops. This piece is self-contained. - use CRTP for base classes - Add unit test --------- Co-authored-by: Jeremy Kun <j2kun@users.noreply.github.com>