ipa-sra: Fix treatment of internal functions (PR 94434)
IPA-SRA can segfault when processing a call to an internal function
because such calls do not have corresponding call graphs and should be
treated like memory accesses anyway, which what the patch below does.
The patch makes an attempt to differentiate between reads and writes,
although for things passed by value it does not make any difference.
It treats all arguments of functions denoted with internal_store_fn_p
as written to, even though in practice only some are, but for IPA-SRA
purposes, actions needed to be taken when processing a read are also
always performed when analyzing a write, so the code is just slightly
pessimistic. But not as pessimistic as bailing out on any internal
call immediately.
I have LTO bootstrapped and tested the patch on x86_64-linux and
normally bootstrapped and tested it on aarch64-linux, although one
which is not SVE capable. I would appreciate testing on such machine
too - as well as a small testcase that would follow all relevant
conventions in gcc.target/aarch64/sve.
2020-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/94434
* ipa-sra.c: Include internal-fn.h.
(enum isra_scan_context): Update comment.
(scan_function): Treat calls to internal_functions like loads or stores.