[all-commits] [llvm/llvm-project] 543446: [mli][vector] canonicalize vector.from_elements fr...

James Newling via All-commits all-commits at lists.llvm.org
Mon Jun 2 11:15:46 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 543446a35309d82919dc1b021125e978a7451b12
      https://github.com/llvm/llvm-project/commit/543446a35309d82919dc1b021125e978a7451b12
  Author: James Newling <james.newling at gmail.com>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Dialect/Vector/canonicalize.mlir
    A mlir/test/Dialect/Vector/canonicalize/vector-from-elements.mlir

  Log Message:
  -----------
  [mli][vector] canonicalize vector.from_elements from ascending extracts (#139819)

Example:
```mlir
%0 = vector.extract %source[0, 0] : i8 from vector<1x2xi8>
%1 = vector.extract %source[0, 1] : i8 from vector<1x2xi8>
%2 = vector.from_elements %0, %1 : vector<2xi8>
```

becomes
```mlir
%2 = vector.shape_cast %source : vector<1x2xi8> to vector<2xi8>
```

It was decided that we should spill canonicalization tests into new
files (see
[discussion](https://github.com/llvm/llvm-project/pull/135096#pullrequestreview-2760245596))
In view of this I added the new tests to a new file specifically for
canonicalization of from_elements. To be consistent in the location of
the tests, I moved existing tests `extract_scalar_from_from_element`,
`extract_1d_from_from_elements`, `extract_2d_from_from_elements` and
`from_elements_to_splat` from `canonicalize.mlir` to
`canonicalze/vector-from-elements.mlir`. In addition to moving I changed
the LIT variables to all be upper-case for consistency.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list