[Mlir-commits] [mlir] [MLIR][Tensor] Fix Chained tensor.cast canonicalization pattern (PR #113551)
Prashant Kumar
llvmlistbot at llvm.org
Thu Oct 24 06:19:16 PDT 2024
================
@@ -433,18 +433,23 @@ struct ChainedTensorCast : public OpRewritePattern<CastOp> {
// We can remove the intermediate cast if joining all three produces the
// same result as just joining the source and result shapes.
- auto firstJoin =
- joinShapes(joinShapes(sourceType, intermediateType), resultType);
+ auto firstJoin = joinShapes(sourceType, intermediateType);
// The join might not exist if the cast sequence would fail at runtime.
if (!firstJoin)
return failure();
+ auto secondJoin = joinShapes(firstJoin, resultType);
+
+ // The join might not exist if the cast sequence would fail at runtime.
+ if (!secondJoin)
----------------
pashu123 wrote:
Makes sense. Thanks.
https://github.com/llvm/llvm-project/pull/113551
More information about the Mlir-commits
mailing list