@@ -206,9 +206,7 @@ class ConstantOp : public mlir::Op<ConstantOp,
206206 /// The ConstantOp takes no inputs.
207207 mlir::OpTrait::ZeroOperands,
208208 /// The ConstantOp returns a single result.
209- mlir::OpTrait::OneResult,
210- /// The ConstantOp is pure and has no visible side-effects.
211- mlir::OpTrait::HasNoSideEffect> {
209+ mlir::OpTrait::OneResult> {
212210
213211 public:
214212 /// Inherit the constructors from the base Op class.
@@ -335,15 +333,13 @@ operation.
335333We define a toy operation by inheriting from our base ' Toy_Op' class above. Here
336334we provide the mnemonic and a list of traits for the operation. The
337335[mnemonic](../../OpDefinitions.md#operation-name) here matches the one given in
338- `ConstantOp::getOperationName` without the dialect prefix; `toy.`. The constant
339- operation here is also marked as ' NoSideEffect' . This is an ODS trait, and
340- matches one-to-one with the trait we providing when defining `ConstantOp`:
341- `mlir::OpTrait::HasNoSideEffect`. Missing here from our C++ definition are the
342- `ZeroOperands` and `OneResult` traits; these will be automatically inferred
343- based upon the `arguments` and `results` fields we define later.
336+ `ConstantOp::getOperationName` without the dialect prefix; `toy.`. Missing here
337+ from our C++ definition are the `ZeroOperands` and `OneResult` traits; these
338+ will be automatically inferred based upon the `arguments` and `results` fields
339+ we define later.
344340
345341```tablegen
346- def ConstantOp : Toy_Op<"constant", [NoSideEffect] > {
342+ def ConstantOp : Toy_Op<"constant"> {
347343}
348344```
349345
@@ -369,7 +365,7 @@ values. The results correspond to a set of types for the values produced by the
369365operation:
370366
371367```tablegen
372- def ConstantOp : Toy_Op<"constant", [NoSideEffect] > {
368+ def ConstantOp : Toy_Op<"constant"> {
373369 // The constant operation takes an attribute as the only input.
374370 // `F64ElementsAttr` corresponds to a 64-bit floating-point ElementsAttr.
375371 let arguments = (ins F64ElementsAttr:$value);
@@ -394,7 +390,7 @@ for users of the dialect and can even be used to auto-generate Markdown
394390documents.
395391
396392```tablegen
397- def ConstantOp : Toy_Op<"constant", [NoSideEffect] > {
393+ def ConstantOp : Toy_Op<"constant"> {
398394 // Provide a summary and description for this operation. This can be used to
399395 // auto-generate documentation of the operations within our dialect.
400396 let summary = "constant operation";
@@ -432,7 +428,7 @@ as part of `ConstantOp::verify`. This blob can assume that all of the other
432428invariants of the operation have already been verified:
433429
434430```tablegen
435- def ConstantOp : Toy_Op<"constant", [NoSideEffect] > {
431+ def ConstantOp : Toy_Op<"constant"> {
436432 // Provide a summary and description for this operation. This can be used to
437433 // auto-generate documentation of the operations within our dialect.
438434 let summary = "constant operation";
@@ -472,7 +468,7 @@ of C++ parameters, as well as an optional code block that can be used to specify
472468the implementation inline.
473469
474470```tablegen
475- def ConstantOp : Toy_Op<"constant", [NoSideEffect] > {
471+ def ConstantOp : Toy_Op<"constant"> {
476472 ...
477473
478474 // Add custom build methods for the constant operation. These methods populate
0 commit comments