diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td @@ -53,7 +53,7 @@ class Shape_Op traits = []> : Op; -def Shape_AddOp : Shape_Op<"add", [SameOperandsAndResultType]> { +def Shape_AddOp : Shape_Op<"add", [Commutative, SameOperandsAndResultType]> { let summary = "Addition of sizes"; let description = [{ Adds two valid sizes as follows: @@ -67,7 +67,7 @@ let assemblyFormat = "$lhs `,` $rhs attr-dict"; } -def Shape_BroadcastOp : Shape_Op<"broadcast", []> { +def Shape_BroadcastOp : Shape_Op<"broadcast", [Commutative]> { let summary = "Returns the broadcasted output shape of two inputs"; let description = [{ Computes the broadcasted output shape following: @@ -252,7 +252,7 @@ let hasCanonicalizer = 1; } -def Shape_JoinOp : Shape_Op<"join", []> { +def Shape_JoinOp : Shape_Op<"join", [Commutative]> { let summary = "Returns the least general shape.size of its operands"; let description = [{ An operation that computes the least general shape of input operands. @@ -285,7 +285,7 @@ let results = (outs Shape_ShapeOrSizeType:$result); } -def Shape_MulOp : Shape_Op<"mul", [SameOperandsAndResultType]> { +def Shape_MulOp : Shape_Op<"mul", [Commutative, SameOperandsAndResultType]> { let summary = "Multiplication of sizes"; let description = [{ Multiplies two valid sizes as follows: @@ -536,7 +536,8 @@ } def Shape_AssumingOp : Shape_Op<"assuming", - [SingleBlockImplicitTerminator<"AssumingYieldOp">, + [Commutative, + SingleBlockImplicitTerminator<"AssumingYieldOp">, RecursiveSideEffects]> { let summary = "Execute the region"; let description = [{