[Mlir-commits] [mlir] [mlir][tosa] Add input_unsigned attribute to CAST (PR #215838)

Luke Hutton llvmlistbot at llvm.org
Thu Aug 13 02:03:16 PDT 2026


================
@@ -1170,8 +1170,9 @@ struct NonNarrowingCastsOptimization : public OpRewritePattern<tosa::CastOp> {
       return rewriter.notifyMatchFailure(castOp,
                                          "inner cast operation is narrowing");
 
-    rewriter.replaceOpWithNewOp<tosa::CastOp>(castOp, outerOutputType,
-                                              innerCastInput);
+    rewriter.replaceOpWithNewOp<tosa::CastOp>(
----------------
lhutton1 wrote:

I think we didn't handle this correctly after all (apologies, I missed this!). I think we should bail out of the canonicalization in the following case:
- cast(input_unsigned=false) -> cast(input_unsigned=true)

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


More information about the Mlir-commits mailing list