Preserve use-list orders in mlir bytecode
authorMatteo Franciolini <m_franciolini@apple.com>
Sun, 21 May 2023 23:46:59 +0000 (16:46 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 21 May 2023 23:48:12 +0000 (16:48 -0700)
commit612781918fb01a2a0985a1c4c9200f5d5d1581cc
tree8a0383af5f3512dd9e1d256eb0fa230d33b4fa9d
parentf81ccb520927247b02708873567428d6988e2a07
Preserve use-list orders in mlir bytecode

This patch implements a mechanism to read/write use-list orders from/to the mlir bytecode format. When producing bytecode, use-list orders are appended to each value of the IR. When reading bytecode, use-lists orders are loaded in memory and used at the end of parsing to sort the existing use-list chains.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D149755
14 files changed:
mlir/docs/BytecodeFormat.md
mlir/include/mlir/Bytecode/Encoding.h [moved from mlir/lib/Bytecode/Encoding.h with 76% similarity]
mlir/include/mlir/IR/UseDefLists.h
mlir/include/mlir/IR/Value.h
mlir/lib/Bytecode/Reader/BytecodeReader.cpp
mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
mlir/lib/Bytecode/Writer/IRNumbering.cpp
mlir/lib/Bytecode/Writer/IRNumbering.h
mlir/lib/IR/Value.cpp
mlir/test/Bytecode/invalid/invalid-structure.mlir
mlir/test/Bytecode/uselist_orders.mlir [new file with mode: 0644]
mlir/test/lib/IR/CMakeLists.txt
mlir/test/lib/IR/TestUseListOrders.cpp [new file with mode: 0644]
mlir/tools/mlir-opt/mlir-opt.cpp