Const fold splat vectors/tensors in standard add, sub, and mul ops

The const folding logic is structurally similar, so use a template
to abstract the common part.

Moved mul(x, 0) to a legalization pattern to be consistent with
mul(x, 1).

Also promoted getZeroAttr() to be a method on Builder since it is
expected to be frequently used.

PiperOrigin-RevId: 228891989
6 files changed
tree: cc62fa977d0e878c06d025e2af711ff964fe11e6
  1. g3doc/
  2. include/
  3. lib/
  4. test/
  5. tools/
  6. utils/
  7. .clang-format
  8. LICENSE.TXT