Hi, dumps of the lattices representing bit-values and of propagation results of bit-values can print a really long hexadecimal value when the bit-value represents -1 (all bits set). This patch simply detect that situation and prints the string "-1" in that case, making the dumps somewhat nicer.
I am not sure if it is worth to put this kind of dumping to wide-int-print.cc but I can do that if people would like me to (in that case I'm opened to suggestions for a suitable name of the function). Bootstrapped and tested on x86_64-linux. It only affects IPA dumps, OK for master now? Thanks, Martin gcc/ChangeLog: 2025-01-03 Martin Jambor <mjam...@suse.cz> * ipa-cp.cc (ipcp_print_widest_int): New function. (ipcp_store_vr_results): Use it. (ipcp_bits_lattice::print): Likewise. Fix formatting. --- gcc/ipa-cp.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 5d7b3d25df5..08924ae16f1 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -307,6 +307,18 @@ ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, bool dump_benefits) fprintf (f, "\n"); } +/* If VALUE has all bits set to one, print "-1" to F, otherwise simply print it + hexadecimally to F. */ + +static void +ipcp_print_widest_int (FILE *f, const widest_int &value) +{ + if (wi::eq_p (wi::bit_not (value), 0)) + fprintf (f, "-1"); + else + print_hex (value, f); +} + void ipcp_bits_lattice::print (FILE *f) { @@ -316,8 +328,10 @@ ipcp_bits_lattice::print (FILE *f) fprintf (f, " Bits unusable (BOTTOM)\n"); else { - fprintf (f, " Bits: value = "); print_hex (get_value (), f); - fprintf (f, ", mask = "); print_hex (get_mask (), f); + fprintf (f, " Bits: value = "); + ipcp_print_widest_int (f, get_value ()); + fprintf (f, ", mask = "); + print_hex (get_mask (), f); fprintf (f, "\n"); } } @@ -6375,7 +6389,7 @@ ipcp_store_vr_results (void) dumped_sth = true; } fprintf (dump_file, " param %i: value = ", i); - print_hex (bits->get_value (), dump_file); + ipcp_print_widest_int (dump_file, bits->get_value ()); fprintf (dump_file, ", mask = "); print_hex (bits->get_mask (), dump_file); fprintf (dump_file, "\n"); -- 2.47.1