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

Christian Ulmann llvmlistbot at llvm.org
Mon Feb 3 23:55:05 PST 2025


================
@@ -1703,3 +1703,47 @@ llvm.func @wrong_number_of_bundle_tags() {
   } : (i32, i32) -> ()
   llvm.return
 }
+
+// -----
+
+llvm.mlir.global external @x(42 : i32) {addr_space = 0 : i32} : i32
+
+// expected-error at +1 {{expects type to be a valid element type for an LLVM global alias}}
+llvm.mlir.alias external @y {addr_space = 0 : i32} : !llvm.label {
+  %0 = llvm.mlir.addressof @x : !llvm.ptr
+  llvm.return %0 : !llvm.ptr
+}
+
+// -----
+
+// expected-error at +1 {{linkage must be private, internal, linkonce, weak}}
+llvm.mlir.alias appending @y2 {addr_space = 0 : i32} : i32 {
+  %0 = llvm.mlir.addressof @x : !llvm.ptr
----------------
Dinistro wrote:

this refers to an unknown symbol, which might cause issues when the verifier order would change

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


More information about the Mlir-commits mailing list