Convert fir.allocmem and fir.freemem operations to calls to malloc and free, respectively
authorAlexisPerry <aperry@lanl.gov>
Tue, 2 Nov 2021 21:46:21 +0000 (15:46 -0600)
committerAlexisPerry <aperry@lanl.gov>
Tue, 7 Dec 2021 22:59:10 +0000 (15:59 -0700)
commitc2acd4539396af2beb8f37e38e8da9e4a04565f5
tree106e925b85c966248f1eb77fec329225fb1f7c2a
parent8421fa5d536aadf42c0e54c566bc439a40ebdb8e
Convert fir.allocmem and fir.freemem operations to calls to malloc and free, respectively

This patch is part of the upstreaming effort from the fir-dev branch.

Address review comments
- move CHECK blocks to after the mlir code in the test file
- fix style with respect to anonymous namespaces: only include class definitions in the namespace and make functions static and outside the namespace
- fix a few nits
- remove TODO in favor of notifyMatchFailure
- removed unnecessary CHECK line from convert-to-llvm.fir
- rebase on main - add TODO back in
- get successfull test of TODO in AllocMemOp converion of derived type with LEN params
- clearer comments and reduced use of auto
- move defintion of computeDerivedTypeSize to fix build error

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Reviewed By: awarzynski, clementval, kiranchandramohan, schweitz

Differential Revision: https://reviews.llvm.org/D114104
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/Todo/allocmem.fir [new file with mode: 0644]
flang/test/Fir/convert-to-llvm.fir