]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-cp: Make dumping of widest_ints even more sane
authorMartin Jambor <mjambor@suse.cz>
Mon, 14 Apr 2025 12:21:15 +0000 (14:21 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 14 Apr 2025 12:39:28 +0000 (14:39 +0200)
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.

gcc/ipa-cp.cc

index fd2c4cca1365ecfd2224842f6bc65c89fc5974a7..637bc49f048273f253db35f7f4728aca65699137 100644 (file)
@@ -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");
        }
     }