[Mlir-commits] [mlir] da02575 - [mlir][Tutorial] Fix comment position in SimplifyRedundantTranspose.

River Riddle llvmlistbot at llvm.org
Thu Feb 27 17:55:27 PST 2020


Author: Matthias Kramm
Date: 2020-02-27T17:55:07-08:00
New Revision: da0257563f5f5dccdab72c0d157dee596580b7a9

URL: https://github.com/llvm/llvm-project/commit/da0257563f5f5dccdab72c0d157dee596580b7a9
DIFF: https://github.com/llvm/llvm-project/commit/da0257563f5f5dccdab72c0d157dee596580b7a9.diff

LOG: [mlir][Tutorial] Fix comment position in SimplifyRedundantTranspose.

Summary:
This is a cosmetic change to make the "bingo" comment be in the
right place.

Differential Revision: https://reviews.llvm.org/D75264

Added: 
    

Modified: 
    mlir/docs/Tutorials/Toy/Ch-3.md
    mlir/examples/toy/Ch3/mlir/ToyCombine.cpp
    mlir/examples/toy/Ch4/mlir/ToyCombine.cpp
    mlir/examples/toy/Ch5/mlir/ToyCombine.cpp
    mlir/examples/toy/Ch6/mlir/ToyCombine.cpp
    mlir/examples/toy/Ch7/mlir/ToyCombine.cpp

Removed: 
    


################################################################################
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<TransposeOp> {
     mlir::Value transposeInput = op.getOperand();
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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> {
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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> {
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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> {
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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> {
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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> {
     TransposeOp transposeInputOp =
         llvm::dyn_cast_or_null<TransposeOp>(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();
   }


        


More information about the Mlir-commits mailing list