diff --git a/mlir/docs/Tutorials/Toy/Ch-3.md b/mlir/docs/Tutorials/Toy/Ch-3.md index c32818242503..9d5911761263 100644 --- a/mlir/docs/Tutorials/Toy/Ch-3.md +++ b/mlir/docs/Tutorials/Toy/Ch-3.md @@ -93,11 +93,12 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { mlir::Value transposeInput = op.getOperand(); TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}, {transposeInputOp}); return matchSuccess(); } diff --git a/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp index e42a20cd88fc..da1c36311765 100644 --- a/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp @@ -43,11 +43,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement. + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return matchSuccess(); } diff --git a/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp index 5b153973b9ef..82a1ee0b7e40 100644 --- a/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement. + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return matchSuccess(); } diff --git a/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp index 5b153973b9ef..82a1ee0b7e40 100644 --- a/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement. + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return matchSuccess(); } diff --git a/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp index 5b153973b9ef..82a1ee0b7e40 100644 --- a/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement. + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return matchSuccess(); } diff --git a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp index 2817778dc90e..9f0795f936cd 100644 --- a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp @@ -66,11 +66,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern { TransposeOp transposeInputOp = llvm::dyn_cast_or_null(transposeInput.getDefiningOp()); - // If the input is defined by another Transpose, bingo! + // Input defined by another transpose? If not, no match. if (!transposeInputOp) return matchFailure(); - // Use the rewriter to perform the replacement. + // Otherwise, we have a redundant transpose. Use the rewriter. rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return matchSuccess(); }