[llvm] [mlir] [MLIR] Add passthrough attribute to mlir.global (PR #154706)

Vadim Curcă via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 07:34:13 PDT 2025


================
@@ -3028,3 +3028,15 @@ llvm.mlir.global internal constant @test_array_attr_struct_with_struct() : !llvm
   %0 = llvm.mlir.constant([#llvm.zero, [2 : i32, 1.0 : f32], #llvm.undef]) : !llvm.array<3 x struct<(i32, f32)>>
   llvm.return %0 : !llvm.array<3 x struct<(i32, f32)>>
 }
+
+// -----
+
+// CHECK: @passthrough_only = external global double #[[ATTRS:[0-9]+]]
+// CHECK: attributes #[[ATTRS]] = { memory(none) "int-attr"="4" "no-enum-attr" "string-attr"="string" }
+ llvm.mlir.global external @passthrough_only() {passthrough = [["memory", "0"], ["int-attr", "4"], "no-enum-attr", ["string-attr", "string"]]} : f64
+
+// -----
+
+// CHECK: @passthrough_combined = global i32 2, section "mysection", align 4 #[[ATTRS:[0-9]+]]
+// CHECK: attributes #[[ATTRS]] = { norecurse "bss-section"="my_bss.1" }
+llvm.mlir.global external @passthrough_combined(2 : i32) {alignment = 4 : i64, passthrough = ["norecurse", ["bss-section", "my_bss.1"]], section = "mysection"} : i32
----------------
VadimCurca wrote:

Our intention is to import target-specific attributes on globals.

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


More information about the llvm-commits mailing list