llvm-project
9b708b00 - [mlir][arith-to-spirv] Fix null dereference when converting trunci/extui with tensor types (#183654)

Commit
2 days ago
[mlir][arith-to-spirv] Fix null dereference when converting trunci/extui with tensor types (#183654) `getScalarOrVectorConstInt` only handles `VectorType` and `IntegerType`, returning `nullptr` for any other type (e.g., a `RankedTensorType` that slips through after type emulation maps `tensor<Nxi16>` to `tensor<Nxi32>` with the same destination type). The callers in `TruncIPattern` and `ExtUIPattern` passed this null value directly to `spirv::BitwiseAndOp::create`, causing a null-pointer dereference in `OperandStorage`. Similarly, the signed-extension pattern passes the result of `getScalarOrVectorConstInt` as a shift amount to `ShiftLeftLogicalOp::create` without a null check. Add `if (\!mask)` / `if (\!shiftSize)` guards that return a match failure in all three cases, converting the crash into a proper legalization failure. Fixes #178214
Author
Parents
Loading