Yang Bai
393a75ebb7
[mlir][Vector] Add constant folding for vector.from_elements operation (#145849)
### Summary
This PR adds a new folding pattern for **vector.from_elements** that
canonicalizes it to **arith.constant** when all input operands are
constants.
### Implementation Details
**Leverages FoldAdaptor capabilities**: Uses adaptor.getElements() to
access **pre-computed** constant attributes, avoiding redundant pattern
matching on operands.
### Example Transformation
```
Before:
%c0_i32 = arith.constant 0 : i32
%c1_i32 = arith.constant 1 : i32
%c2_i32 = arith.constant 2 : i32
%c3_i32 = arith.constant 3 : i32
%v = vector.from_elements %c0_i32, %c1_i32, %c2_i32, %c3_i32 : vector<2x2xi32>
After:
%v = arith.constant dense<[[0, 1], [2, 3]]> : vector<2x2xi32>
```
---------
Co-authored-by: Yang Bai <yangb@nvidia.com>
2025-06-30 20:39:53 -07:00
..
2025-06-25 16:40:14 +01:00
2025-06-06 10:54:14 +01:00
2025-05-14 11:17:09 +02:00
2025-06-30 20:39:53 -07:00
2025-06-18 09:26:04 -07:00
2025-06-26 09:47:06 +01:00
2025-05-01 15:50:06 -07:00
2025-05-15 07:52:53 -07:00
2025-06-26 09:47:06 +01:00
2025-06-16 12:05:20 -07:00
2025-06-11 12:37:34 +01:00
2025-06-18 09:26:04 -07:00
2025-02-07 10:51:24 -08:00
2025-01-24 17:15:06 +00:00
2025-02-07 10:51:24 -08:00
2025-03-12 17:16:49 +00:00
2025-02-07 10:42:55 -08:00
2025-02-15 20:16:25 +00:00
2025-04-24 18:05:41 +01:00
2025-05-08 13:14:32 -04:00
2025-02-26 10:58:24 +05:30
2025-03-06 18:24:38 +00:00
2025-02-14 11:08:24 -08:00
2025-05-27 13:34:16 +01:00
2025-02-26 07:48:01 +00:00
2025-02-26 07:48:01 +00:00
2025-02-07 10:42:55 -08:00
2025-06-05 10:18:38 -07:00
2025-04-22 17:18:54 +03:00
2025-04-22 17:18:54 +03:00
2025-06-30 15:20:42 -04:00
2025-02-25 10:40:55 +00:00
2025-04-11 20:08:08 +01:00
2025-05-14 14:56:35 -07:00
2025-06-20 13:50:25 -07:00
2025-06-30 15:20:42 -04:00