This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add a new memory allocation rewrite pass.
ClosedPublic

Authored by schweitz on Dec 14 2021, 3:42 PM.

Details

Summary

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.

Diff Detail

Event Timeline

schweitz created this revision.Dec 14 2021, 3:42 PM
schweitz requested review of this revision.Dec 14 2021, 3:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2021, 3:42 PM
PeteSteinfeld accepted this revision.Dec 15 2021, 11:27 AM

All builds, tests, and looks good.

This revision is now accepted and ready to land.Dec 15 2021, 11:27 AM
vdonaldson accepted this revision.Dec 15 2021, 11:37 AM
This revision was automatically updated to reflect the committed changes.