[Mlir-commits] [mlir] [MLIR][LLVM] Import dereferenceable metadata from LLVM IR (PR #130974)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Mar 12 10:05:19 PDT 2025


================
@@ -330,6 +330,42 @@ def AliasAnalysisOpInterface : OpInterface<"AliasAnalysisOpInterface"> {
   ];
 }
 
+def DereferenceableOpInterface : OpInterface<"DereferenceableOpInterface"> {
+  let description = [{
+    An interface for memory operations that can carry dereferenceable metadata.
+    It provides setters and getters for the operation's dereferenceable
+    attributes. The default implementations of the interface methods expect
+    the operation to have an attribute of type DereferenceableAttr.
+  }];
+
+  let cppNamespace = "::mlir::LLVM";
+
+  let methods = [
+    InterfaceMethod<
+      /*desc=*/        "Returns the dereferenceable attribute or nullptr",
+      /*returnType=*/  "::mlir::LLVM::DereferenceableAttr",
+      /*methodName=*/  "getDereferenceableOrNull",
----------------
mihailo-stojanovic wrote:

Dereferenceable attribute is optional on both `load` and `inttoptr` ops, so querying the interface may return nullptr. This is in line with other "metadata interfaces".

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


More information about the Mlir-commits mailing list