https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103168
--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:6180f5c8d6d1dc7b6634c41a46f0f8f5ca2e5b9d commit r12-5499-g6180f5c8d6d1dc7b6634c41a46f0f8f5ca2e5b9d Author: Richard Biener <rguent...@suse.de> Date: Wed Nov 24 09:08:44 2021 +0100 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 <rguent...@suse.de> Jan Hubicka <j...@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.