diff options
author | Martin Jambor <mjambor@suse.cz> | 2025-04-14 14:21:15 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2025-04-14 14:39:28 +0200 |
commit | 044d0d1ee1a61c21670068485d4a250edfbb695a (patch) | |
tree | a04035b4e15a0a8d1de8d34af997e2af28f3f5c7 | |
parent | de1c734a8ae034c92f485e7f58b7fcb1c921ecd2 (diff) | |
download | gcc-044d0d1ee1a61c21670068485d4a250edfbb695a.zip gcc-044d0d1ee1a61c21670068485d4a250edfbb695a.tar.gz gcc-044d0d1ee1a61c21670068485d4a250edfbb695a.tar.bz2 |
ipa-cp: Make dumping of widest_ints even more sane
This patch just introduces a form of dumping of widest ints that only
have zeros in the lowest 128 bits so that instead of printing
thousands of f's the output looks like:
Bits: value = 0xffff, mask = all ones folled by 0xffffffffffffffffffffffffffff0000
and then makes sure we use the function not only to print bits but
also to print masks where values like these can also occur.
gcc/ChangeLog:
2025-03-21 Martin Jambor <mjambor@suse.cz>
* ipa-cp.cc (ipcp_print_widest_int): Also add a truncated form of
dumping of widest ints which only have zeros in the lowest 128 bits.
Update the comment.
(ipcp_bits_lattice::print): Also dump the mask using
ipcp_print_widest_int.
(ipcp_store_vr_results): Likewise.
-rw-r--r-- | gcc/ipa-cp.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index fd2c4cc..637bc49 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -307,14 +307,21 @@ 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. */ +/* Print VALUE to F in a form which in usual cases does not take thousands of + characters. */ 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 if (wi::eq_p (wi::bit_not (wi::bit_or (value, + wi::sub (wi::lshift (1, 128), + 1))), 0)) + { + fprintf (f, "all ones folled by "); + print_hex (wi::bit_and (value, wi::sub (wi::lshift (1, 128), 1)), f); + } else print_hex (value, f); } @@ -331,7 +338,7 @@ ipcp_bits_lattice::print (FILE *f) fprintf (f, " Bits: value = "); ipcp_print_widest_int (f, get_value ()); fprintf (f, ", mask = "); - print_hex (get_mask (), f); + ipcp_print_widest_int (f, get_mask ()); fprintf (f, "\n"); } } @@ -6437,7 +6444,7 @@ ipcp_store_vr_results (void) fprintf (dump_file, " param %i: value = ", i); ipcp_print_widest_int (dump_file, bits->get_value ()); fprintf (dump_file, ", mask = "); - print_hex (bits->get_mask (), dump_file); + ipcp_print_widest_int (dump_file, bits->get_mask ()); fprintf (dump_file, "\n"); } } |