[Bug ipa/82027] [7/8 Regression] wrong code with -O3 -flto

2017-12-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82027

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Martin J., any progress on this?

[Bug ipa/82027] [7/8 Regression] wrong code with -O3 -flto

2017-12-06 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82027

--- Comment #8 from Martin Jambor  ---
(In reply to Jakub Jelinek from comment #7)
> Martin J., any progress on this?

Unfortunately not yet, seems to always be number four on my todo-list.
At the moment I hope to get to it just before Christmas or just after
them (of course, I will not obbject to someone taking over but it
should not be necessary).

[Bug ipa/82027] [7/8 Regression] wrong code with -O3 -flto

2017-12-21 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82027

--- Comment #9 from Martin Jambor  ---
We create an "artificial_thunk" for an IPA-CP clone, which is really
nothing but a thunk with skipped arguments but we do not stream its
args_to_skip because output_cgraph_opt_summary_p returns false because
at streaming time at least, its clone_of is NULL.

In WPA we modify the arguments of the artificial thunk and in ltrans
we are supposed to deal with the calls as instructed by the
args_to_skip bitmap, which leads to argument mismatch.

I'll continue investigating where exactly the clone_of is cleared
and/or whether the streaming logic needs to be adjusted somehow.

[Bug ipa/82027] [7/8 Regression] wrong code with -O3 -flto

2017-12-21 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82027

--- Comment #10 from Martin Jambor  ---
OK, so I did not realize that duplicate_thunk_for_node does not set
clone_of but former_clone of, which is of course what it must do.  I
have checked and this is the only place where we currently set
former_clone_of in WPA, and therefore I am testing the following fix:

diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index a19f8a13dfb..ed3df15b143 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1958,7 +1958,7 @@ input_offload_tables (bool do_force_output)
 static int
 output_cgraph_opt_summary_p (struct cgraph_node *node)
 {
-  return (node->clone_of
+  return ((node->clone_of || node->former_clone_of)
  && (node->clone.tree_map
  || node->clone.args_to_skip
  || node->clone.combined_args_to_skip));