Instead of importing constant expressions recursively, the revision walks all dependencies of an LLVM constant iteratively. The actual conversion then iterates over a list of constants and all intermediate constant values are added to the value mapping. As a result, an LLVM IR constant maps to exactly one MLIR operation per function. The revision adapts the existing tests since the constant ordering changed for aggregate types. Additionally, it adds extra tests that mix aggregate constants and constant expressions. Depends on D137416 Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D137559
14 lines
781 B
LLVM
14 lines
781 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: %[[E0:.+]] = llvm.mlir.null : !llvm.ptr<ptr<struct<"Domain", (ptr<ptr<struct<"Domain">>>, ptr<struct<"Domain">>)>>>
|
|
; CHECK: %[[E1:.+]] = llvm.mlir.null : !llvm.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 %[[E0]], %[[ROOT]][0]
|
|
; CHECK: %[[RES:.+]] = llvm.insertvalue %[[E1]], %[[CHAIN]][1]
|
|
; CHECK: llvm.return %[[RES]]
|
|
@D = global %Domain zeroinitializer
|