[Mlir-commits] [mlir] [MLIR][LLVM] Support dso_local_equivalent constants (PR #132131)
Christian Ulmann
llvmlistbot at llvm.org
Wed Mar 19 23:53:38 PDT 2025
================
@@ -1575,6 +1575,44 @@ def LLVM_AliasOp : LLVM_Op<"mlir.alias",
let hasRegionVerifier = 1;
}
+def LLVM_DSOLocalEquivalentOp : LLVM_Op<"dso_local_equivalent",
+ [Pure, ConstantLike, DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
+ let arguments = (ins FlatSymbolRefAttr:$function_name);
+ let results = (outs LLVM_AnyPointer:$res);
+
+ let summary = "Creates a LLVM dso_local_equivalent ptr";
+
+ let description = [{
+ Creates an SSA value containing a pointer to a global value (function or
+ alias to function). It represents a function which is functionally
+ equivalent to a given function, but is always defined in the current
+ linkage unit. The target function may not have `extern_weak` linkage.
+
+ Examples:
+
+ ```mlir
+ llvm.mlir.global external constant @const() : i64 {
+ %0 = llvm.mlir.addressof @const : !llvm.ptr
+ %1 = llvm.ptrtoint %0 : !llvm.ptr to i64
+ %2 = llvm.dso_local_equivalent @extern_func : !llvm.ptr
----------------
Dinistro wrote:
```suggestion
%2 = llvm.dso_local_equivalent @func : !llvm.ptr
```
Nit: `extern_func` might be a bit misleading here.
https://github.com/llvm/llvm-project/pull/132131
More information about the Mlir-commits
mailing list