Get rid of useless temporary for call to pure function
commitb81e2d5e76a6bcc71f45b122e8b5538ddb7ebf4c
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 28 Apr 2021 07:58:21 +0000 (28 09:58 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 28 Apr 2021 07:58:21 +0000 (28 09:58 +0200)
tree9b04e5b2651d3616fb939816ba80474e456e94de
parent852dd866e2faba95cb407c98d31a48b6aae66677
Get rid of useless temporary for call to pure function

This avoids creating a useless temporary for a call to a pure function with
good properties by using the RSO.

gcc/ada/
* gcc-interface/trans.c (is_array_of_scalar_type): New predicate.
(find_decls_r): New function.
(return_slot_opt_for_pure_call_p): New predicate.
(Call_to_gnu): Do not create a temporary for the return value if the
parent node is an aggregate.  If there is a target, try to apply the
return slot optimization to regular calls to pure functions returning
an array of scalar type.
gcc/ada/gcc-interface/trans.c