[Mlir-commits] [mlir] [mlir][llvm] Add zeroinitializer constant (PR #65508)
Vinicius Couto Espindola
llvmlistbot at llvm.org
Thu Sep 7 04:15:43 PDT 2023
================
@@ -2292,3 +2292,29 @@ llvm.func @locally_streaming_func() attributes {arm_locally_streaming} {
}
// CHECK: attributes #[[ATTR]] = { "aarch64_pstate_sm_body" }
+
+// -----
+
+//
+// Zero-initialize operation.
+//
+
+// CHECK: @partially_zeroinit_aggregate = linkonce global { i32, i64, [3 x i8] } { i32 0, i64 1, [3 x i8] zeroinitializer }
+llvm.mlir.global linkonce @partially_zeroinit_aggregate() : !llvm.struct<(i32, i64, !llvm.array<3 x i8>)> {
+ %0 = llvm.mlir.zero : !llvm.struct<(i32, i64, !llvm.array<3 x i8>)>
+ %1 = llvm.mlir.constant(1 : i64) : i64
+ %2 = llvm.insertvalue %1, %0[1] : !llvm.struct<(i32, i64, !llvm.array<3 x i8>)>
+ llvm.return %2 : !llvm.struct<(i32, i64, !llvm.array<3 x i8>)>
+}
+
+llvm.func @zeroinit_complex_local_aggregate() {
+ // CHECK: %[[#VAR:]] = alloca [1000 x { i32, [3 x { double, <4 x ptr>, [2 x ptr] }], [6 x ptr] }], i64 1, align 32
----------------
sitio-couto wrote:
It's called [FileCheck Numeric Substitution Blocks](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks)! The `#` prefix enables it. It can be used to check more complex numeric relations, but it can also check basic numeric equalities.
https://github.com/llvm/llvm-project/pull/65508
More information about the Mlir-commits
mailing list