[Mlir-commits] [mlir] [mlir][tosa] Fix unranked tosa canonicalizations crashes (PR #188188)

Sayan Saha llvmlistbot at llvm.org
Tue Mar 24 05:39:12 PDT 2026


================
@@ -299,6 +301,8 @@ struct TosaFoldConstantReciprocal : public OpRewritePattern<ReciprocalOp> {
     auto newTensor = applyElementWise<APFloat, APFloat, FloatType>(
         inputValues, &ReciprocalOp::calcOneElement,
         cast<FloatType>(inputValues.getElementType()));
+    if (newTensor.getType() != recip.getType())
----------------
sahas3 wrote:

nit: I think this check can be moved before line 301 by checking `inputTensor.getType() != recip.getType()` to avoid the computation on line 301

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


More information about the Mlir-commits mailing list