[Mlir-commits] [mlir] [MLIR][LLVM] Implement LLVM dialect support for global aliases (PR #125295)

Bruno Cardoso Lopes llvmlistbot at llvm.org
Tue Feb 4 11:11:32 PST 2025


================
@@ -1443,6 +1455,85 @@ def LLVM_GlobalDtorsOp : LLVM_Op<"mlir.global_dtors", [
   let hasVerifier = 1;
 }
 
+def LLVM_AliasOp : LLVM_Op<"mlir.alias",
+    [IsolatedFromAbove, SingleBlockImplicitTerminator<"ReturnOp">, Symbol]> {
+  let arguments = (ins
+    TypeAttr:$alias_type,
+    StrAttr:$sym_name,
+    Linkage:$linkage,
+    UnitAttr:$dso_local,
+    UnitAttr:$thread_local_,
+    DefaultValuedAttr<ConfinedAttr<I32Attr, [IntNonNegative]>, "0">:$addr_space,
----------------
bcardosolopes wrote:

They are not specified in the IR level, but the ctor for llvm::GlobalAlias takes one. Because the constant address might contain some addr space casts, seems more reasonable to me to maintain the top level one and use verification to make sure whatever ends up in the region finishes with the appropriate address space (see added verifier checks for that)

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


More information about the Mlir-commits mailing list