[MLIR][LLVM] Support inlining of LLVM::AllocaOp.
authorJohannes de Fine Licht <johannes.definelicht@nextsilicon.com>
Thu, 26 Jan 2023 14:03:41 +0000 (15:03 +0100)
committerTobias Gysi <tobias.gysi@nextsilicon.com>
Thu, 26 Jan 2023 14:11:21 +0000 (15:11 +0100)
commitc5da2dca2c3453d12419596a1dfe349761f771fc
tree4b0c60d58732cd51372b06c63127cd1c5daa9bda
parent2e9bc1b8614c9422573cf2f4728525787b0cb0cb
[MLIR][LLVM] Support inlining of LLVM::AllocaOp.

If inlining into an LLVM function, move allocas of constant size from
the callee's entry block to the new entry block, as this will fold into
the prologue/epilogue code during code generation.

We still allow inlining allocas even if we cannot do this
post-processing (i.e., when we are not inlining into an `LLVM::FuncOp`),
since this is an optimization (and thus not necessary for correctness).

Depends on D141682

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D142436
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/test/Dialect/LLVMIR/inlining.mlir