[flang][hlfir] Support fir.declare in AbstractResult pass
authorJean Perier <jperier@nvidia.com>
Tue, 25 Apr 2023 07:03:55 +0000 (09:03 +0200)
committerJean Perier <jperier@nvidia.com>
Tue, 25 Apr 2023 07:04:38 +0000 (09:04 +0200)
commitc203850ad55de6e1396d5735e4d9b56b66db9220
tree1cf819319eead87f1fdaf6db5bdf393c7ff7ebc4
parent90cf1014243b2edec249cab7a0bfde1e8c0fdf1c
[flang][hlfir] Support fir.declare in AbstractResult pass

The AbstractResult pass replaces allocation of function result on the callee
side per an extra argument so that the allocation of the result can be
done on the caller stack.
It looks for the result allocation from the fir.return op, so it needs
to handle (in a transparent way) a fir.declare in the chain between the
allocation and the fir.return.

Reviewed By: vzakhari, clementval

Differential Revision: https://reviews.llvm.org/D149057
flang/lib/Optimizer/Transforms/AbstractResult.cpp
flang/test/Fir/abstract-results.fir