[PATCH] D72834: [mlir] LLVM import: handle constant data and array/vector aggregates

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 04:27:22 PST 2020


ftynse created this revision.
ftynse added reviewers: nicolasvasilache, jpienaar.
Herald added subscribers: llvm-commits, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, rriddle, mehdi_amini.
Herald added a project: LLVM.

Implement the handling of llvm::ConstantDataSequential and
llvm::ConstantAggregate for (nested) array and vector types when imporitng LLVM
IR to MLIR. In all cases, the result is a DenseElementsAttr that can be used in
either a `llvm.mlir.global` or a `llvm.mlir.constant`. Nested aggregates are
unpacked recursively until an element or a constant data is found. Nested
arrays with innermost scalar type are represented as DenseElementsAttr of
tensor type. Nested arrays with innermost vector type are represented as
DenseElementsAttr with (multidimensional) vector type.

Constant aggregates of struct type are not yet supported as the LLVM dialect
does not have a well-defined way of modeling struct-type constants.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72834

Files:
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
  mlir/test/Target/import.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72834.238458.patch
Type: text/x-patch
Size: 6923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200116/ba016176/attachment.bin>


More information about the llvm-commits mailing list