]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/103168 - Improve VN of pure function calls
authorRichard Biener <rguenther@suse.de>
Wed, 24 Nov 2021 08:08:44 +0000 (09:08 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 24 Nov 2021 11:40:36 +0000 (12:40 +0100)
commit6180f5c8d6d1dc7b6634c41a46f0f8f5ca2e5b9d
tree81b714a9f498a39897ac2e4119f1d4b281116fc2
parentfdd34569e7a9fc2b6c638a7ef62b965ed7e832ce
tree-optimization/103168 - Improve VN of pure function calls

This improves value-numbering of calls that read memory, calls
to const functions with aggregate arguments and calls to
pure functions where the latter include const functions we
demoted to pure for the fear of interposing with a less
optimized version.  Note that for pure functions we do not
handle functions that access global memory.

2021-11-24  Richard Biener  <rguenther@suse.de>
    Jan Hubicka  <jh@suse.cz>

PR tree-optimization/103168
* ipa-modref.h (struct modref_summary): Add load_accesses.
* ipa-modref.c (modref_summary::finalize): Initialize load_accesses.
* tree-ssa-sccvn.c (visit_reference_op_call): Use modref
info to walk the virtual use->def chain to CSE const/pure
function calls possibly reading from memory.

* g++.dg/tree-ssa/pr103168.C: New testcase.
gcc/ipa-modref.c
gcc/ipa-modref.h
gcc/testsuite/g++.dg/tree-ssa/pr103168.C [new file with mode: 0644]
gcc/tree-ssa-sccvn.c