Files
clang-p2996/mlir/test/Target/LLVMIR/Import/zeroinitializer.ll
Min-Yih Hsu 00fcf9e95a [mlir][LLVMIR] Add support for importing struct-type ConstantAggregate(Zero)
And move importer test files from `test/Target/LLVMIR` into
`test/Target/LLVMIR/Import`.

We simply translate struct-type ConstantAggregate(Zero) into a
serious of `llvm.insertvalue` operations against a `llvm.undef` root.
Note that this doesn't affect the original logics on translating
vector/array-type ConstantAggregate values.

Differential Revision: https://reviews.llvm.org/D124399
2022-04-27 09:42:26 -07:00

15 lines
805 B
LLVM

; RUN: mlir-translate --import-llvm %s | FileCheck %s
%Domain = type { %Domain**, %Domain* }
; CHECK: llvm.mlir.global external @D() :
; CHECK-SAME: !llvm.struct<"Domain", (ptr<ptr<struct<"Domain">>>, ptr<struct<"Domain">>)>
; CHECK-DAG: %[[E0:.+]] = llvm.mlir.null : !llvm.ptr<struct<"Domain", (ptr<ptr<struct<"Domain">>>, ptr<struct<"Domain">>)>>
; CHECK-DAG: %[[E1:.+]] = llvm.mlir.null : !llvm.ptr<ptr<struct<"Domain", (ptr<ptr<struct<"Domain">>>, ptr<struct<"Domain">>)>>>
; CHECK: %[[ROOT:.+]] = llvm.mlir.undef : !llvm.struct<"Domain", (ptr<ptr<struct<"Domain">>>, ptr<struct<"Domain">>)>
; CHECK: %[[CHAIN:.+]] = llvm.insertvalue %[[E1]], %[[ROOT]][0 : i32]
; CHECK: %[[RES:.+]] = llvm.insertvalue %[[E0]], %[[CHAIN]][1 : i32]
; CHECK: llvm.return %[[RES]]
@D = global %Domain zeroinitializer