[Mlir-commits] [mlir] [mlir][tosa] Fix integer-to-boolean cast folder (PR #150370)

Luke Hutton llvmlistbot at llvm.org
Thu Jul 24 05:06:44 PDT 2025


================
@@ -1302,9 +1302,13 @@ OpFoldResult CastOp::fold(FoldAdaptor adaptor) {
       auto intVal = operand.getSplatValue<APInt>();
       auto bitwidth = outETy.getIntOrFloatBitWidth();
 
+      // i1 types are boolean in TOSA
       if (trunc) {
-        intVal = intVal.trunc(bitwidth);
-        // i1 types are boolean in TOSA
+        if (outETy.isInteger(1)) {
----------------
lhutton1 wrote:

Sounds good to me, thanks!

https://github.com/llvm/llvm-project/pull/150370


More information about the Mlir-commits mailing list