[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
This commit is contained in:
Matthias Kramm 2020-02-27 17:54:22 -08:00 committed by River Riddle
parent 45d522d691
commit da0257563f
6 changed files with 13 additions and 12 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}