diff mbox series

Fix duplication hook in ipa-modref

Message ID 20201125193626.GB94992@kam.mff.cuni.cz
State New
Headers show
Series Fix duplication hook in ipa-modref | expand

Commit Message

Jan Hubicka Nov. 25, 2020, 7:36 p.m. UTC
Hi,
this constructing testcase for the direct escape analysis I noticed that
I forgot to duplicate arg_flags in duplicate hook so we lose track of
that when clonning.  I am sure I had it there at some point, but
apparently it got lost while breaking up patches.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

	* ipa-modref.c (modref_summaries::duplicate,
	modref_summaries_lto::duplicate): Copy arg_flags.
	(remap_arg_flags): Fix remapping of arg_flags.
diff mbox series

Patch

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index e6cb4a87b69..d1d4ba786a4 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -2142,6 +2146,8 @@  modref_summaries::duplicate (cgraph_node *, cgraph_node *dst,
 			 src_data->loads->max_accesses);
   dst_data->loads->copy_from (src_data->loads);
   dst_data->writes_errno = src_data->writes_errno;
+  if (src_data->arg_flags.length ())
+    dst_data->arg_flags = src_data->arg_flags.copy ();
 }
 
 /* Called when new clone is inserted to callgraph late.  */
@@ -2165,6 +2171,8 @@  modref_summaries_lto::duplicate (cgraph_node *, cgraph_node *,
 			 src_data->loads->max_accesses);
   dst_data->loads->copy_from (src_data->loads);
   dst_data->writes_errno = src_data->writes_errno;
+  if (src_data->arg_flags.length ())
+    dst_data->arg_flags = src_data->arg_flags.copy ();
 }
 
 namespace
@@ -2690,7 +2698,7 @@  remap_arg_flags (auto_vec <unsigned char> &arg_flags, clone_info *info)
       if (o >= 0 && (int)old.length () > o && old[o])
 	max = i;
     }
-  if (max > 0)
+  if (max >= 0)
     arg_flags.safe_grow_cleared (max + 1, true);
   FOR_EACH_VEC_SAFE_ELT (info->param_adjustments->m_adj_params, i, p)
     {