[Mlir-commits] [mlir] [mlir][ArithToSPIRV] Fix crash converting arith.addi/subi/muli on i1 types (PR #189239)
Jakub Kuderski
llvmlistbot at llvm.org
Sun Mar 29 11:22:49 PDT 2026
================
@@ -572,6 +577,75 @@ struct XOrIOpBooleanPattern final : public OpConversionPattern<arith::XOrIOp> {
}
};
+/// Converts arith.addi to spirv.LogicalNotEqual if the type is i1 or vector of
+/// i1. For booleans, addition mod 2 is equivalent to XOR / not-equal.
+struct AddIOpBooleanPattern final : public OpConversionPattern<arith::AddIOp> {
+ using Base::Base;
+
+ LogicalResult
+ matchAndRewrite(arith::AddIOp op, OpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+ assert(adaptor.getOperands().size() == 2);
+
----------------
kuhar wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/189239
More information about the Mlir-commits
mailing list