diff options
author | Martin Jambor <mjambor@suse.cz> | 2025-01-06 11:58:29 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2025-01-06 11:58:51 +0100 |
commit | 72b273152f75a8622ea13d0fe95d6d2461615ba4 (patch) | |
tree | da516689db41a7c5f656a3e75a953cc745e08c81 | |
parent | 668cad04b16fc044142474232ac072fcc5f94433 (diff) | |
download | gcc-72b273152f75a8622ea13d0fe95d6d2461615ba4.zip gcc-72b273152f75a8622ea13d0fe95d6d2461615ba4.tar.gz gcc-72b273152f75a8622ea13d0fe95d6d2461615ba4.tar.bz2 |
ipa-cp: Make dumping of bit masks representing -1 nicer
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.
gcc/ChangeLog:
2025-01-03 Martin Jambor <mjambor@suse.cz>
* ipa-cp.cc (ipcp_print_widest_int): New function.
(ipcp_store_vr_results): Use it.
(ipcp_bits_lattice::print): Likewise. Fix formatting.
-rw-r--r-- | gcc/ipa-cp.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 7423731d..294389f 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"); |