diff --git a/mlir/docs/Tutorials/Toy/Ch-3.md b/mlir/docs/Tutorials/Toy/Ch-3.md --- a/mlir/docs/Tutorials/Toy/Ch-3.md +++ b/mlir/docs/Tutorials/Toy/Ch-3.md @@ -93,11 +93,12 @@ 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 --- a/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp @@ -43,11 +43,11 @@ 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 --- a/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ 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 --- a/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ 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 --- a/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp @@ -48,11 +48,11 @@ 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 --- a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp +++ b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp @@ -66,11 +66,11 @@ 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(); }