Fix bug in ipa-pure-const and add debug counters
gcc/ChangeLog: PR lto/103211 * dbgcnt.def (ipa_attr): New counters. * ipa-pure-const.c: Include dbgcnt.c (ipa_make_function_const): Use debug counter. (ipa_make_function_pure): Likewise. (propagate_pure_const): Fix bug in my previous change.
This commit is contained in:
parent
e30bf33044
commit
6471396dec
|
@ -175,6 +175,7 @@ DEBUG_COUNTER (if_after_reload)
|
||||||
DEBUG_COUNTER (if_conversion)
|
DEBUG_COUNTER (if_conversion)
|
||||||
DEBUG_COUNTER (if_conversion_tree)
|
DEBUG_COUNTER (if_conversion_tree)
|
||||||
DEBUG_COUNTER (if_to_switch)
|
DEBUG_COUNTER (if_to_switch)
|
||||||
|
DEBUG_COUNTER (ipa_attr)
|
||||||
DEBUG_COUNTER (ipa_cp_bits)
|
DEBUG_COUNTER (ipa_cp_bits)
|
||||||
DEBUG_COUNTER (ipa_cp_values)
|
DEBUG_COUNTER (ipa_cp_values)
|
||||||
DEBUG_COUNTER (ipa_cp_vr)
|
DEBUG_COUNTER (ipa_cp_vr)
|
||||||
|
|
|
@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#include "ipa-prop.h"
|
#include "ipa-prop.h"
|
||||||
#include "ipa-fnsummary.h"
|
#include "ipa-fnsummary.h"
|
||||||
#include "symtab-thunks.h"
|
#include "symtab-thunks.h"
|
||||||
|
#include "dbgcnt.h"
|
||||||
|
|
||||||
/* Lattice values for const and pure functions. Everything starts out
|
/* Lattice values for const and pure functions. Everything starts out
|
||||||
being const, then may drop to pure and then neither depending on
|
being const, then may drop to pure and then neither depending on
|
||||||
|
@ -1476,8 +1477,10 @@ ipa_make_function_const (struct cgraph_node *node, bool looping, bool local)
|
||||||
fprintf (dump_file, "Function found to be %sconst: %s\n",
|
fprintf (dump_file, "Function found to be %sconst: %s\n",
|
||||||
looping ? "looping " : "",
|
looping ? "looping " : "",
|
||||||
node->dump_name ());
|
node->dump_name ());
|
||||||
if (!local)
|
if (!local && !looping)
|
||||||
cdtor = node->call_for_symbol_and_aliases (cdtor_p, NULL, true);
|
cdtor = node->call_for_symbol_and_aliases (cdtor_p, NULL, true);
|
||||||
|
if (!dbg_cnt (ipa_attr))
|
||||||
|
return false;
|
||||||
if (node->set_const_flag (true, looping))
|
if (node->set_const_flag (true, looping))
|
||||||
{
|
{
|
||||||
if (dump_file)
|
if (dump_file)
|
||||||
|
@ -1511,8 +1514,10 @@ ipa_make_function_pure (struct cgraph_node *node, bool looping, bool local)
|
||||||
fprintf (dump_file, "Function found to be %spure: %s\n",
|
fprintf (dump_file, "Function found to be %spure: %s\n",
|
||||||
looping ? "looping " : "",
|
looping ? "looping " : "",
|
||||||
node->dump_name ());
|
node->dump_name ());
|
||||||
if (!local)
|
if (!local && !looping)
|
||||||
cdtor = node->call_for_symbol_and_aliases (cdtor_p, NULL, true);
|
cdtor = node->call_for_symbol_and_aliases (cdtor_p, NULL, true);
|
||||||
|
if (!dbg_cnt (ipa_attr))
|
||||||
|
return false;
|
||||||
if (node->set_pure_flag (true, looping))
|
if (node->set_pure_flag (true, looping))
|
||||||
{
|
{
|
||||||
if (dump_file)
|
if (dump_file)
|
||||||
|
@ -1797,11 +1802,11 @@ propagate_pure_const (void)
|
||||||
switch (this_state)
|
switch (this_state)
|
||||||
{
|
{
|
||||||
case IPA_CONST:
|
case IPA_CONST:
|
||||||
remove_p |= ipa_make_function_const (node, this_looping, false);
|
remove_p |= ipa_make_function_const (w, this_looping, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IPA_PURE:
|
case IPA_PURE:
|
||||||
remove_p |= ipa_make_function_pure (node, this_looping, false);
|
remove_p |= ipa_make_function_pure (w, this_looping, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue