forked from OSchip/llvm-project
[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:
parent
45d522d691
commit
da0257563f
|
@ -93,11 +93,12 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
mlir::Value transposeInput = op.getOperand();
|
mlir::Value transposeInput = op.getOperand();
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()}, {transposeInputOp});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()}, {transposeInputOp});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement.
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement.
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement.
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement.
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,11 +66,11 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||||
TransposeOp transposeInputOp =
|
TransposeOp transposeInputOp =
|
||||||
llvm::dyn_cast_or_null<TransposeOp>(transposeInput.getDefiningOp());
|
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)
|
if (!transposeInputOp)
|
||||||
return matchFailure();
|
return matchFailure();
|
||||||
|
|
||||||
// Use the rewriter to perform the replacement.
|
// Otherwise, we have a redundant transpose. Use the rewriter.
|
||||||
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
rewriter.replaceOp(op, {transposeInputOp.getOperand()});
|
||||||
return matchSuccess();
|
return matchSuccess();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue