public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9024] ipa-fnsummary: Remove inconsistent bp_pack_value
@ 2021-09-22  2:09 Kewen Lin
  0 siblings, 0 replies; only message in thread
From: Kewen Lin @ 2021-09-22  2:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:cc11a171eee059b645870f2e208c530f301239c9

commit r11-9024-gcc11a171eee059b645870f2e208c530f301239c9
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Sep 21 19:13:57 2021 -0500

    ipa-fnsummary: Remove inconsistent bp_pack_value
    
    There is one inconsistent bit-field streaming out and in.
    On the side of streaming in:
    
        bp_pack_value (&bp, info->inlinable, 1);
        bp_pack_value (&bp, false, 1);
        bp_pack_value (&bp, info->fp_expressions, 1);
    
    while on the side of the streaming out:
    
        info->inlinable = bp_unpack_value (&bp, 1);
        info->fp_expressions = bp_unpack_value (&bp, 1)
    
    The removal of Cilk Plus support r8-4956 missed to remove
    the streaming out of the bit, instead just change the value
    for streaming out to be always false.
    
    By hacking fp_expression_p to always return true, I can see
    it reads the wrong fp_expressions value (false) out in wpa.
    
    GCC12 adopts commit 63c6446f77b9001d26f973114450d790749f282b
    which removes the inconsistent streaming out instead.
    
    gcc/ChangeLog:
    
            * ipa-fnsummary.c (inline_read_section): Unpack a dummy bit
            to keep consistent with the side of streaming out.

Diff:
---
 gcc/ipa-fnsummary.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 18bbae145b9..bf635c1f78a 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -4403,13 +4403,20 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
       bp = streamer_read_bitpack (&ib);
       if (info)
 	{
-          info->inlinable = bp_unpack_value (&bp, 1);
-          info->fp_expressions = bp_unpack_value (&bp, 1);
+	  info->inlinable = bp_unpack_value (&bp, 1);
+	  /* On the side of streaming out, there is still one bit
+	     streamed out between inlinable and fp_expressions bits,
+	     which was used for cilk+ before but now always false.
+	     To remove the bit packing need to bump LTO minor version,
+	     so unpack a dummy bit here to keep consistent instead.  */
+	  bp_unpack_value (&bp, 1);
+	  info->fp_expressions = bp_unpack_value (&bp, 1);
 	}
       else
 	{
-          bp_unpack_value (&bp, 1);
-          bp_unpack_value (&bp, 1);
+	  bp_unpack_value (&bp, 1);
+	  bp_unpack_value (&bp, 1);
+	  bp_unpack_value (&bp, 1);
 	}
 
       count2 = streamer_read_uhwi (&ib);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-22  2:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  2:09 [gcc r11-9024] ipa-fnsummary: Remove inconsistent bp_pack_value Kewen Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).