Commit c0e8eb9
authored
[MLIR][Vector] Fix RewriteAlignedSubByteIntExt/Trunc producing invalid IR when source is already i8 (#188941)
When the conversion destination type is i8 (e.g., extsi i4->i8),
RewriteAlignedSubByteIntExt was unconditionally creating a new
ConversionOp with identical source and result types (vector<8xi8> ->
vector<8xi8>), which is invalid IR. Similarly,
RewriteAlignedSubByteIntTrunc was creating arith.trunci from
vector<Nxi8> to vector<Nxi8> when the source was already i8.
Fix by:
- In RewriteAlignedSubByteIntExt: replace the op directly with
subByteExt when it already has the destination type, instead of wrapping
in a new conversion op.
- In RewriteAlignedSubByteIntTrunc: skip the intermediate truncation to
i8 when the source is already i8, passing srcValue directly to the
i8->i4 rewrite logic.
This matches the existing test expectations in
vector-rewrite-subbyte-ext-and-trunci.mlir.
Assisted-by: Claude Code
Fix a failure present with MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON.1 parent 329432b commit c0e8eb9
File tree
1 file changed
+12
-5
lines changed- mlir/lib/Dialect/Vector/Transforms
1 file changed
+12
-5
lines changedLines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2163 | 2163 | | |
2164 | 2164 | | |
2165 | 2165 | | |
2166 | | - | |
2167 | | - | |
2168 | | - | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
2169 | 2174 | | |
2170 | 2175 | | |
2171 | 2176 | | |
| |||
2213 | 2218 | | |
2214 | 2219 | | |
2215 | 2220 | | |
2216 | | - | |
| 2221 | + | |
2217 | 2222 | | |
2218 | 2223 | | |
2219 | 2224 | | |
2220 | | - | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
2221 | 2228 | | |
2222 | 2229 | | |
2223 | 2230 | | |
| |||
0 commit comments