]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/112653 - PTA and return
authorRichard Biener <rguenther@suse.de>
Mon, 27 Nov 2023 09:20:02 +0000 (10:20 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Mon, 18 Mar 2024 12:08:56 +0000 (13:08 +0100)
commitebc1fc6853b7673b7301d88f4075bc2db3468643
treee1895326a4502187f833838294efbdf9a1480de0
parent70a5ad7506e60407a2f118f53ab979dec5baf1fc
tree-optimization/112653 - PTA and return

The following separates the escape solution for return stmts not
only during points-to solving but also for later querying.  This
requires adjusting the points-to-global tests to include escapes
through returns.  Technically the patch replaces the existing
post-processing which computes the transitive closure of the
returned value solution by a proper artificial variable with
transitive closure constraints.  Instead of adding the solution
to escaped we track it separately.

PR tree-optimization/112653
* gimple-ssa.h (gimple_df): Add escaped_return solution.
* tree-ssa.cc (init_tree_ssa): Reset it.
(delete_tree_ssa): Likewise.
* tree-ssa-structalias.cc (escaped_return_id): New.
(find_func_aliases): Handle non-IPA return stmts by
adding to ESCAPED_RETURN.
(set_uids_in_ptset): Adjust HEAP escaping to also cover
escapes through return.
(init_base_vars): Initialize ESCAPED_RETURN.
(compute_points_to_sets): Replace ESCAPED post-processing
with recording the ESCAPED_RETURN solution.
* tree-ssa-alias.cc (ref_may_alias_global_p_1): Check
the ESCAPED_RETUNR solution.
(dump_alias_info): Dump it.
* cfgexpand.cc (update_alias_info_with_stack_vars): Update it.
* ipa-icf.cc (sem_item_optimizer::fixup_points_to_sets):
Likewise.
* tree-inline.cc (expand_call_inline): Reset it.
* tree-parloops.cc (parallelize_loops): Likewise.
* tree-sra.cc (maybe_add_sra_candidate): Check it.

* gcc.dg/tree-ssa/pta-return-1.c: New testcase.

(cherry picked from commit f7884f7673444b8a2c10ea0981d480f2e82dd16a)
gcc/cfgexpand.cc
gcc/gimple-ssa.h
gcc/ipa-icf.cc
gcc/testsuite/gcc.dg/tree-ssa/pta-return-1.c [new file with mode: 0644]
gcc/tree-inline.cc
gcc/tree-parloops.cc
gcc/tree-sra.cc
gcc/tree-ssa-alias.cc
gcc/tree-ssa-structalias.cc
gcc/tree-ssa.cc