Fix ipa-cp bit propagation streaming

Message ID 20191212143546.wusbyi263hzd55et@kam.mff.cuni.cz
State New
Headers show
Series
  • Fix ipa-cp bit propagation streaming
Related show

Commit Message

Jan Hubicka Dec. 12, 2019, 2:35 p.m.
Hi,
this rather nasty bug makes value and mask to be exchanged during
streaming.  This makes us to sometimes set bogus pointer alignments
and causes misoptimization of Firefox when built with GCC 9.

Comitted as obvious.  I will backport it to release branches soon - it
is quite dangerous bug.

Honza

	* ipa-prop.c (read_ipcp_transformation_info): Fix undefined ordering
	of execution of function call parameters.

Comments

Martin Liška Jan. 9, 2020, 10:32 a.m. | #1
On 12/12/19 3:35 PM, Jan Hubicka wrote:
> Hi,

> this rather nasty bug makes value and mask to be exchanged during

> streaming.  This makes us to sometimes set bogus pointer alignments

> and causes misoptimization of Firefox when built with GCC 9.


Hi.

I've just prepare and tested backport for both GCC 8 and 9 branches.
I'm going to install the patches.

@Honza: Can you please next time create a PR? It's the best tracker
for release branches we have.

Thanks,
Martin

> 

> Comitted as obvious.  I will backport it to release branches soon - it

> is quite dangerous bug.

> 

> Honza

> 

> 	* ipa-prop.c (read_ipcp_transformation_info): Fix undefined ordering

> 	of execution of function call parameters.

> Index: ipa-prop.c

> ===================================================================

> --- ipa-prop.c	(revision 278815)

> +++ ipa-prop.c	(working copy)

> @@ -4715,9 +4715,10 @@ read_ipcp_transformation_info (lto_input

>   	  bool known = bp_unpack_value (&bp, 1);

>   	  if (known)

>   	    {

> +	      const widest_int value = streamer_read_widest_int (ib);

> +	      const widest_int mask = streamer_read_widest_int (ib);

>   	      ipa_bits *bits

> -		= ipa_get_ipa_bits_for_value (streamer_read_widest_int (ib),

> -					      streamer_read_widest_int (ib));

> +		= ipa_get_ipa_bits_for_value (value, mask);

>   	      (*ts->bits)[i] = bits;

>   	    }

>   	}

>
From cf37f46be9ef7cebf3a4a277adba5d0ab641ff86 Mon Sep 17 00:00:00 2001
From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>

Date: Thu, 12 Dec 2019 14:32:48 +0000
Subject: [PATCH] Backport r279306

gcc/ChangeLog:

2019-12-12  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-prop.c (read_ipcp_transformation_info): Fix undefined ordering
	of execution of function call parameters.
---
 gcc/ipa-prop.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 848180aa441..40edee7951c 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4715,9 +4715,10 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
 	  bool known = bp_unpack_value (&bp, 1);
 	  if (known)
 	    {
+	      const widest_int value = streamer_read_widest_int (ib);
+	      const widest_int mask = streamer_read_widest_int (ib);
 	      ipa_bits *bits
-		= ipa_get_ipa_bits_for_value (streamer_read_widest_int (ib),
-					      streamer_read_widest_int (ib));
+		= ipa_get_ipa_bits_for_value (value, mask);
 	      (*ts->bits)[i] = bits;
 	    }
 	}
-- 
2.24.1

Patch

Index: ipa-prop.c
===================================================================
--- ipa-prop.c	(revision 278815)
+++ ipa-prop.c	(working copy)
@@ -4715,9 +4715,10 @@  read_ipcp_transformation_info (lto_input
 	  bool known = bp_unpack_value (&bp, 1);
 	  if (known)
 	    {
+	      const widest_int value = streamer_read_widest_int (ib);
+	      const widest_int mask = streamer_read_widest_int (ib);
 	      ipa_bits *bits
-		= ipa_get_ipa_bits_for_value (streamer_read_widest_int (ib),
-					      streamer_read_widest_int (ib));
+		= ipa_get_ipa_bits_for_value (value, mask);
 	      (*ts->bits)[i] = bits;
 	    }
 	}