[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>(
+ castOp, outerOutputType, innerCastInput,
+ innerCastOp.getInputUnsignedAttr());
----------------
lhutton1 wrote:
We should also update the CastOp::fold functionality below. For this patch, I'd be happy with either:
- Prevent folding cast when input_unsigned=true
- Fix the folding to handle input_unsigned=true correctly (might be easier since we already have support for folding an unsigned type)
https://github.com/llvm/llvm-project/pull/215838
More information about the Mlir-commits
mailing list