[PATCH] D76602: [MLIR] Introduce std.alloca op

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 07:02:33 PDT 2020


bondhugula marked 5 inline comments as done.
bondhugula added inline comments.


================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:329
+    The "alloca" operation allocates memory on the stack, to be automatically
+    released when the stack frame is discarded. The amount of memory allocated
+    is specified by its memref and additional operands. For example:
----------------
ftynse wrote:
> Could you please elaborate what is a stack frame in MLIR? We don't seem to have this concept defined anywhere. In particular, is it only related to `std.func`, or can one register other ops that create stack frames?
A stack frame here refers to the standard stack frame concept in CS that we know of! It's up to the conversion out of MLIR to realize this correctly. 


================
Comment at: mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp:1349
+                SmallVectorImpl<Value> &sizes, Value &cumulativeSize,
+                Value &one) const {
+    sizes.reserve(memRefType.getRank());
----------------
ftynse wrote:
> Nit: can we rather define `one` at the call site and pass it here (and to another call) ?
The reason I didn't do that is that the order of the instructions in that case wouldn't be natural - there would be other stuff (the size constant definitions) between the def of 'one' and its first use here. So I left it this way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76602/new/

https://reviews.llvm.org/D76602





More information about the llvm-commits mailing list