[flang-commits] [PATCH] D144102: [flang][hlfir] Array constructor lowering [part 1/4]

Tom Eccles via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Feb 15 09:38:51 PST 2023


tblah added inline comments.


================
Comment at: flang/lib/Lower/ConvertArrayConstructor.cpp:87
+    llvm::SmallVector<mlir::Value, 1> extents{extent};
+    mlir::Value tempStorage = builder.createHeapTemporary(
+        loc, declaredType, tempName, extents, lengths);
----------------
I thought the plan was to centralize all array temporary generation in the hlfir bufferization pass? I guess there is not a way to write "give me an uninitialised hlfir.expr which will be given a buffer later"?

It would be nice if expression buffer allocation could be done in one place so that, eventually, the stack arrays pass (and all its messy data flow analysis) can go away.

Another option would be to always allocate temporaries on the stack (no matter if `-fstack-arrays` or `-Ofast` were specified) and rely on the memory-allocation-opt pass to move large allocations to the heap, if that's desired. As I understand it, non-temporary array variables will already always be allocated on the stack (no matter their size).

Feel free to ignore this comment if this was a deliberate design decision.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144102



More information about the flang-commits mailing list