[PATCH] D115763: [flang] Add a new memory allocation rewrite pass.

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 14 15:42:04 PST 2021


schweitz created this revision.
schweitz added reviewers: clementval, jeanPerier, svedanayagam, kiranchandramohan.
schweitz added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert, mgorny.
Herald added a reviewer: sscalpone.
schweitz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This pass can reclassify memory allocations (fir.alloca, fir.allocmem) based on heuristics and settings. The intention is to allow better performance and workarounds for conditions such as environments with limited stack space.

Currently, implements two conversions from stack to heap allocation.

1. If a stack allocation is an array larger than some threshold value make it a heap allocation.
2. If a stack allocation is an array with a runtime evaluated size make it a heap allocation.

Add a lit test for both suboptions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115763

Files:
  flang/include/flang/Optimizer/Transforms/Passes.h
  flang/include/flang/Optimizer/Transforms/Passes.td
  flang/lib/Optimizer/Transforms/CMakeLists.txt
  flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
  flang/test/Fir/memory-allocation-opt.fir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115763.394398.patch
Type: text/x-patch
Size: 11002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211214/dfb01306/attachment.bin>


More information about the llvm-commits mailing list