[Mlir-commits] [mlir] [mlir][llvm] Add zeroinitializer constant (PR #65508)
Vinicius Couto Espindola
llvmlistbot at llvm.org
Wed Sep 6 15:06:34 PDT 2023
================
@@ -2292,3 +2292,132 @@ llvm.func @locally_streaming_func() attributes {arm_locally_streaming} {
}
// CHECK: attributes #[[ATTR]] = { "aarch64_pstate_sm_body" }
+
+// -----
+
+//
+// Zero-initialize operation.
+//
+
+llvm.mlir.global linkonce @zero_integer() : i32 {
+ %0 = llvm.mlir.zero : i32
+ llvm.return %0 : i32
+}
+// CHECK: @zero_integer = linkonce global i32 0
+
+llvm.mlir.global linkonce @zero_float() : f32 {
+ %0 = llvm.mlir.zero : f32
+ llvm.return %0 : f32
+}
+// CHECK: @zero_float = linkonce global float 0.000000e+00
+
+llvm.mlir.global linkonce @zero_array() : !llvm.array<5 x i32> {
+ %0 = llvm.mlir.zero : !llvm.array<5 x i32>
+ llvm.return %0 : !llvm.array<5 x i32>
+}
+// CHECK: @zero_array = linkonce global [5 x i32] zeroinitializer
+
+llvm.mlir.global linkonce @zero_struct() : !llvm.struct<(i32, f64, i8)> {
+ %0 = llvm.mlir.zero : !llvm.struct<(i32, f64, i8)>
+ llvm.return %0 : !llvm.struct<(i32, f64, i8)>
+}
+// CHECK: @zero_struct = linkonce global { i32, double, i8 } zeroinitializer
+
+llvm.mlir.global linkonce @zero_ptr() : !llvm.ptr<i32> {
----------------
sitio-couto wrote:
Oh, nice. Wasn't aware of that. Typed pointers removed!
https://github.com/llvm/llvm-project/pull/65508
More information about the Mlir-commits
mailing list