diff --git a/mlir/include/mlir/Dialect/Index/IR/IndexOps.td b/mlir/include/mlir/Dialect/Index/IR/IndexOps.td --- a/mlir/include/mlir/Dialect/Index/IR/IndexOps.td +++ b/mlir/include/mlir/Dialect/Index/IR/IndexOps.td @@ -25,7 +25,7 @@ /// Base class for Index dialect operations. class IndexOp traits = []> : Op] # traits>; + [DeclareOpInterfaceMethods] # traits>; //===----------------------------------------------------------------------===// // IndexBinaryOp @@ -44,7 +44,7 @@ // AddOp //===----------------------------------------------------------------------===// -def Index_AddOp : IndexBinaryOp<"add", [Commutative]> { +def Index_AddOp : IndexBinaryOp<"add", [Commutative, Pure]> { let summary = "index addition"; let description = [{ The `index.add` operation takes two index values and computes their sum. @@ -62,7 +62,7 @@ // SubOp //===----------------------------------------------------------------------===// -def Index_SubOp : IndexBinaryOp<"sub"> { +def Index_SubOp : IndexBinaryOp<"sub", [Pure]> { let summary = "index subtraction"; let description = [{ The `index.sub` operation takes two index values and computes the difference @@ -81,7 +81,7 @@ // MulOp //===----------------------------------------------------------------------===// -def Index_MulOp : IndexBinaryOp<"mul", [Commutative]> { +def Index_MulOp : IndexBinaryOp<"mul", [Commutative, Pure]> { let summary = "index multiplication"; let description = [{ The `index.mul` operation takes two index values and computes their product. @@ -99,7 +99,7 @@ // DivSOp //===----------------------------------------------------------------------===// -def Index_DivSOp : IndexBinaryOp<"divs"> { +def Index_DivSOp : IndexBinaryOp<"divs", [NoMemoryEffect]> { let summary = "index signed division"; let description = [{ The `index.divs` operation takes two index values and computes their signed @@ -121,7 +121,7 @@ // DivUOp //===----------------------------------------------------------------------===// -def Index_DivUOp : IndexBinaryOp<"divu"> { +def Index_DivUOp : IndexBinaryOp<"divu", [NoMemoryEffect]> { let summary = "index unsigned division"; let description = [{ The `index.divu` operation takes two index values and computes their @@ -143,7 +143,7 @@ // CeilDivSOp //===----------------------------------------------------------------------===// -def Index_CeilDivSOp : IndexBinaryOp<"ceildivs"> { +def Index_CeilDivSOp : IndexBinaryOp<"ceildivs", [NoMemoryEffect]> { let summary = "index signed ceil division"; let description = [{ The `index.ceildivs` operation takes two index values and computes their @@ -165,7 +165,7 @@ // CeilDivUOp //===----------------------------------------------------------------------===// -def Index_CeilDivUOp : IndexBinaryOp<"ceildivu"> { +def Index_CeilDivUOp : IndexBinaryOp<"ceildivu", [NoMemoryEffect]> { let summary = "index unsigned ceil division"; let description = [{ The `index.ceildivu` operation takes two index values and computes their @@ -187,7 +187,7 @@ // FloorDivSOp //===----------------------------------------------------------------------===// -def Index_FloorDivSOp : IndexBinaryOp<"floordivs"> { +def Index_FloorDivSOp : IndexBinaryOp<"floordivs", [NoMemoryEffect]> { let summary = "index signed floor division"; let description = [{ The `index.floordivs` operation takes two index values and computes their @@ -209,7 +209,7 @@ // RemSOp //===----------------------------------------------------------------------===// -def Index_RemSOp : IndexBinaryOp<"rems"> { +def Index_RemSOp : IndexBinaryOp<"rems", [NoMemoryEffect]> { let summary = "index signed remainder"; let description = [{ The `index.rems` operation takes two index values and computes their signed @@ -228,7 +228,7 @@ // RemUOp //===----------------------------------------------------------------------===// -def Index_RemUOp : IndexBinaryOp<"remu"> { +def Index_RemUOp : IndexBinaryOp<"remu", [NoMemoryEffect]> { let summary = "index unsigned remainder"; let description = [{ The `index.remu` operation takes two index values and computes their @@ -248,7 +248,7 @@ // MaxSOp //===----------------------------------------------------------------------===// -def Index_MaxSOp : IndexBinaryOp<"maxs", [Commutative]> { +def Index_MaxSOp : IndexBinaryOp<"maxs", [Commutative, Pure]> { let summary = "index signed maximum"; let description = [{ The `index.maxs` operation takes two index values and computes their signed @@ -267,7 +267,7 @@ // MaxUOp //===----------------------------------------------------------------------===// -def Index_MaxUOp : IndexBinaryOp<"maxu", [Commutative]> { +def Index_MaxUOp : IndexBinaryOp<"maxu", [Commutative, Pure]> { let summary = "index unsigned maximum"; let description = [{ The `index.maxu` operation takes two index values and computes their @@ -287,7 +287,7 @@ // MinSOp //===----------------------------------------------------------------------===// -def Index_MinSOp : IndexBinaryOp<"mins", [Commutative]> { +def Index_MinSOp : IndexBinaryOp<"mins", [Commutative, Pure]> { let summary = "index signed minimum"; let description = [{ The `index.mins` operation takes two index values and computes their signed @@ -306,7 +306,7 @@ // MinUOp //===----------------------------------------------------------------------===// -def Index_MinUOp : IndexBinaryOp<"minu", [Commutative]> { +def Index_MinUOp : IndexBinaryOp<"minu", [Commutative, Pure]> { let summary = "index unsigned minimum"; let description = [{ The `index.minu` operation takes two index values and computes their @@ -326,13 +326,13 @@ // ShlOp //===----------------------------------------------------------------------===// -def Index_ShlOp : IndexBinaryOp<"shl"> { +def Index_ShlOp : IndexBinaryOp<"shl", [Pure]> { let summary = "index shift left"; let description = [{ The `index.shl` operation shifts an index value to the left by a variable amount. The low order bits are filled with zeroes. The RHS operand is always treated as unsigned. If the RHS operand is equal to or greater than the - index bitwidth, the operation is undefined. + index bitwidth, the result is a poison value. Example: @@ -347,13 +347,13 @@ // ShrSOp //===----------------------------------------------------------------------===// -def Index_ShrSOp : IndexBinaryOp<"shrs"> { +def Index_ShrSOp : IndexBinaryOp<"shrs", [Pure]> { let summary = "signed index shift right"; let description = [{ The `index.shrs` operation shifts an index value to the right by a variable amount. The LHS operand is treated as signed. The high order bits are filled with copies of the most significant bit. If the RHS operand is equal to or - greater than the index bitwidth, the operation is undefined. + greater than the index bitwidth, the result is a poison value. Example: @@ -368,13 +368,13 @@ // ShrUOp //===----------------------------------------------------------------------===// -def Index_ShrUOp : IndexBinaryOp<"shru"> { +def Index_ShrUOp : IndexBinaryOp<"shru", [Pure]> { let summary = "unsigned index shift right"; let description = [{ The `index.shru` operation shifts an index value to the right by a variable amount. The LHS operand is treated as unsigned. The high order bits are filled with zeroes. If the RHS operand is equal to or greater than the index - bitwidth, the operation is undefined. + bitwidth, the result is a poison value. Example: @@ -389,7 +389,7 @@ // AndOp //===----------------------------------------------------------------------===// -def Index_AndOp : IndexBinaryOp<"and", [Commutative]> { +def Index_AndOp : IndexBinaryOp<"and", [Commutative, Pure]> { let summary = "index bitwise and"; let description = [{ The `index.and` operation takes two index values and computes their bitwise @@ -408,7 +408,7 @@ // OrOp //===----------------------------------------------------------------------===// -def Index_OrOp : IndexBinaryOp<"or", [Commutative]> { +def Index_OrOp : IndexBinaryOp<"or", [Commutative, Pure]> { let summary = "index bitwise or"; let description = [{ The `index.or` operation takes two index values and computes their bitwise @@ -427,7 +427,7 @@ // XorOp //===----------------------------------------------------------------------===// -def Index_XOrOp : IndexBinaryOp<"xor", [Commutative]> { +def Index_XOrOp : IndexBinaryOp<"xor", [Commutative, Pure]> { let summary = "index bitwise xor"; let description = [{ The `index.xor` operation takes two index values and computes their bitwise @@ -446,8 +446,8 @@ // CastSOp //===----------------------------------------------------------------------===// -def Index_CastSOp : IndexOp<"casts", - [DeclareOpInterfaceMethods]> { +def Index_CastSOp : IndexOp<"casts", [Pure, + DeclareOpInterfaceMethods]> { let summary = "index signed cast"; let description = [{ The `index.casts` operation enables conversions between values of index type @@ -475,8 +475,8 @@ // CastUOp //===----------------------------------------------------------------------===// -def Index_CastUOp : IndexOp<"castu", - [DeclareOpInterfaceMethods]> { +def Index_CastUOp : IndexOp<"castu", [Pure, + DeclareOpInterfaceMethods]> { let summary = "index unsigned cast"; let description = [{ The `index.castu` operation enables conversions between values of index type @@ -504,7 +504,7 @@ // CmpOp //===----------------------------------------------------------------------===// -def Index_CmpOp : IndexOp<"cmp"> { +def Index_CmpOp : IndexOp<"cmp", [Pure]> { let summary = "index compare"; let description = [{ The `index.cmp` operation takes two index values and compares them according @@ -549,7 +549,7 @@ // SizeOfOp //===----------------------------------------------------------------------===// -def Index_SizeOfOp : IndexOp<"sizeof"> { +def Index_SizeOfOp : IndexOp<"sizeof", [Pure]> { let summary = "size in bits of the index type"; let description = [{ The `index.sizeof` operation produces an index-typed SSA value equal to the @@ -572,7 +572,7 @@ //===----------------------------------------------------------------------===// def Index_ConstantOp : IndexOp<"constant", [ - ConstantLike, + ConstantLike, Pure, DeclareOpInterfaceMethods ]> { let summary = "index constant"; @@ -600,7 +600,7 @@ //===----------------------------------------------------------------------===// def Index_BoolConstantOp : IndexOp<"bool.constant", [ - ConstantLike, + ConstantLike, Pure, DeclareOpInterfaceMethods ]> { let summary = "boolean constant";