https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70018
--- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Author: hubicka Date: Sat Apr 16 18:54:49 2016 New Revision: 235065 URL: https://gcc.gnu.org/viewcvs?rev=235065&root=gcc&view=rev Log: PR ipa/70018 * cgraph.c (cgraph_set_const_flag_1): Only set as pure if function does not bind to current def. * ipa-pure-const.c (worse_state): Add FROM and TO parameters; handle conservatively calls to functions that does not need to bind to current def. (check_call): Update call of worse_state. (ignore_edge_for_nothrow): Update. (ignore_edge_for_pure_const): Likewise. (propagate_pure_const): Update calls to worse_state. (skip_function_for_local_pure_const): Reformat comments. * g++.dg/ipa/pure-const-1.C: New testcase. * g++.dg/ipa/pure-const-2.C: New testcase. * g++.dg/ipa/pure-const-3.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/ipa/pure-const-1.C trunk/gcc/testsuite/g++.dg/ipa/pure-const-2.C trunk/gcc/testsuite/g++.dg/ipa/pure-const-3.C Modified: trunk/gcc/ChangeLog trunk/gcc/cgraph.c trunk/gcc/ipa-pure-const.c trunk/gcc/testsuite/ChangeLog