[Mlir-commits] [mlir] [mlir][LLVM] Add nsw and nuw flags (PR #74508)

Tobias Gysi llvmlistbot at llvm.org
Tue Dec 5 12:57:50 PST 2023


================
@@ -48,6 +48,63 @@ def FastmathFlagsInterface : OpInterface<"FastmathFlagsInterface"> {
   ];
 }
 
+def IntegerArithFlagsInterface : OpInterface<"IntegerArithFlagsInterface"> {
+  let description = [{
+    Access to op integer overflow flags.
+  }];
+
+  let cppNamespace = "::mlir::LLVM";
+
+  let methods = [
+    InterfaceMethod<
+      /*desc=*/        "Returns a IntegerArithFlagsAttr attribute for the operation",
+      /*returnType=*/  "IntegerArithFlagsAttr",
+      /*methodName=*/  "getArithAttr",
+      /*args=*/        (ins),
+      /*methodBody=*/  [{}],
+      /*defaultImpl=*/ [{
+        auto op = cast<ConcreteOp>(this->getOperation());
+        return op.getArithFlagsAttr();
+      }]
+      >,
+    InterfaceMethod<
+      /*desc=*/        "Returns whether the operation has the No Unsigned Wrap keyword",
+      /*returnType=*/  "bool",
+      /*methodName=*/  "hasNuw",
----------------
gysit wrote:

What about naming these functions `hasNoUnsignedWrap()` and `hasNoSignedWrap()` similar to LLVM?

https://github.com/llvm/llvm-project/pull/74508


More information about the Mlir-commits mailing list