diff options
| author | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:04 -0800 |
|---|---|---|
| committer | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:39 -0800 |
| commit | 2bdf33cc4c733342fc83081bc7410ac5e9a24f55 (patch) | |
| tree | 3306d769c2bbabda1060928e0cea79d021ea9da2 /mlir/docs | |
| parent | 1d641daf260308815d014d1bf1b424a1ed1e7277 (diff) | |
| download | bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.tar.gz bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.zip | |
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.
Summary: These were temporary methods used to simplify the transition.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D72548
Diffstat (limited to 'mlir/docs')
| -rw-r--r-- | mlir/docs/DeclarativeRewrites.md | 3 | ||||
| -rw-r--r-- | mlir/docs/OpDefinitions.md | 2 | ||||
| -rw-r--r-- | mlir/docs/QuickstartRewrites.md | 8 | ||||
| -rw-r--r-- | mlir/docs/Tutorials/Toy/Ch-3.md | 6 | ||||
| -rw-r--r-- | mlir/docs/Tutorials/Toy/Ch-4.md | 4 |
5 files changed, 11 insertions, 12 deletions
diff --git a/mlir/docs/DeclarativeRewrites.md b/mlir/docs/DeclarativeRewrites.md index 2f212929766..5201eaafe16 100644 --- a/mlir/docs/DeclarativeRewrites.md +++ b/mlir/docs/DeclarativeRewrites.md @@ -618,8 +618,7 @@ results. The third parameter to `Pattern` (and `Pat`) is for this purpose. For example, we can write ```tablegen -def HasNoUseOf: Constraint< - CPred<"$_self->use_begin() == $_self->use_end()">, "has no use">; +def HasNoUseOf: Constraint<CPred<"$_self.use_empty()">, "has no use">; def HasSameElementType : Constraint< CPred<"$0.cast<ShapedType>().getElementType() == " diff --git a/mlir/docs/OpDefinitions.md b/mlir/docs/OpDefinitions.md index e68508f5b08..f92fa1dca01 100644 --- a/mlir/docs/OpDefinitions.md +++ b/mlir/docs/OpDefinitions.md @@ -734,7 +734,7 @@ is used. They serve as "hooks" to the enclosing environment. This includes we want the constraints on each type definition reads naturally and we want to attach type constraints directly to an operand/result, `$_self` will be replaced by the operand/result's type. E.g., for `F32` in `F32:$operand`, its - `$_self` will be expanded as `getOperand(...)->getType()`. + `$_self` will be expanded as `getOperand(...).getType()`. TODO(b/130663252): Reconsider the leading symbol for special placeholders. Eventually we want to allow referencing operand/result $-names; such $-names diff --git a/mlir/docs/QuickstartRewrites.md b/mlir/docs/QuickstartRewrites.md index 6a4a7cca8b8..e0370e48718 100644 --- a/mlir/docs/QuickstartRewrites.md +++ b/mlir/docs/QuickstartRewrites.md @@ -121,7 +121,7 @@ replacement: ```tablegen def createTFLLeakyRelu : NativeCodeCall< - "createTFLLeakyRelu($_builder, $0->getDefiningOp(), $1, $2)">; + "createTFLLeakyRelu($_builder, $0.getDefiningOp(), $1, $2)">; def : Pat<(TF_LeakyReluOp:$old_value, $arg, F32Attr:$a), (createTFLLeakyRelu $old_value, $arg, $a)>; @@ -131,7 +131,7 @@ def : Pat<(TF_LeakyReluOp:$old_value, $arg, F32Attr:$a), static Value createTFLLeakyRelu(PatternRewriter &rewriter, Operation *op, Value operand, Attribute attr) { return rewriter.create<mlir::TFL::LeakyReluOp>( - op->getLoc(), operands[0]->getType(), /*arg=*/operands[0], + op->getLoc(), operands[0].getType(), /*arg=*/operands[0], /*alpha=*/attrs[0].cast<FloatAttr>()); } ``` @@ -177,7 +177,7 @@ struct ConvertTFLeakyRelu : public RewritePattern { void rewrite(Operation *op, PatternRewriter &rewriter) const override { rewriter.replaceOpWithNewOp<TFL::LeakyReluOp>( - op, op->getResult(0)->getType(), op->getOperand(0), + op, op->getResult(0).getType(), op->getOperand(0), /*alpha=*/op->getAttrOfType<FloatAttr>("alpha")); } }; @@ -191,7 +191,7 @@ struct ConvertTFLeakyRelu : public RewritePattern { PatternMatchResult matchAndRewrite(Operation *op, PatternRewriter &rewriter) const override { rewriter.replaceOpWithNewOp<TFL::LeakyReluOp>( - op, op->getResult(0)->getType(), op->getOperand(0), + op, op->getResult(0).getType(), op->getOperand(0), /*alpha=*/op->getAttrOfType<FloatAttr>("alpha")); return matchSuccess(); } diff --git a/mlir/docs/Tutorials/Toy/Ch-3.md b/mlir/docs/Tutorials/Toy/Ch-3.md index 6ff9d3cb299..a535d1c95c6 100644 --- a/mlir/docs/Tutorials/Toy/Ch-3.md +++ b/mlir/docs/Tutorials/Toy/Ch-3.md @@ -92,7 +92,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> { // Look through the input of the current transpose. mlir::Value transposeInput = op.getOperand(); 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! if (!transposeInputOp) return matchFailure(); @@ -194,7 +194,7 @@ An example is a transformation that eliminates reshapes when they are redundant, i.e. when the input and output shapes are identical. ```tablegen -def TypesAreIdentical : Constraint<CPred<"$0->getType() == $1->getType()">>; +def TypesAreIdentical : Constraint<CPred<"$0.getType() == $1.getType()">>; def RedundantReshapeOptPattern : Pat< (ReshapeOp:$res $arg), (replaceWithValue $arg), [(TypesAreIdentical $res, $arg)]>; @@ -208,7 +208,7 @@ optimize Reshape of a constant value by reshaping the constant in place and eliminating the reshape operation. ```tablegen -def ReshapeConstant : NativeCodeCall<"$0.reshape(($1->getType()).cast<ShapedType>())">; +def ReshapeConstant : NativeCodeCall<"$0.reshape(($1.getType()).cast<ShapedType>())">; def FoldConstantReshapeOptPattern : Pat< (ReshapeOp:$res (ConstantOp $arg)), (ConstantOp (ReshapeConstant $arg, $res))>; diff --git a/mlir/docs/Tutorials/Toy/Ch-4.md b/mlir/docs/Tutorials/Toy/Ch-4.md index 2df009ddc2d..d449fe5c712 100644 --- a/mlir/docs/Tutorials/Toy/Ch-4.md +++ b/mlir/docs/Tutorials/Toy/Ch-4.md @@ -82,7 +82,7 @@ struct ToyInlinerInterface : public DialectInlinerInterface { // Replace the values directly with the return operands. assert(returnOp.getNumOperands() == valuesToRepl.size()); for (const auto &it : llvm::enumerate(returnOp.getOperands())) - valuesToRepl[it.index()]->replaceAllUsesWith(it.value()); + valuesToRepl[it.index()].replaceAllUsesWith(it.value()); } }; ``` @@ -310,7 +310,7 @@ inferred as the shape of the inputs. ```c++ /// Infer the output shape of the MulOp, this is required by the shape inference /// interface. -void MulOp::inferShapes() { getResult()->setType(getOperand(0)->getType()); } +void MulOp::inferShapes() { getResult().setType(getOperand(0).getType()); } ``` At this point, each of the necessary Toy operations provide a mechanism by which |

