[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-11-25 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Martin Jambor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Martin Jambor  ---
Fixed.

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-11-25 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

--- Comment #8 from Martin Jambor  ---
Author: jamborm
Date: Mon Nov 25 10:13:08 2019
New Revision: 278670

URL: https://gcc.gnu.org/viewcvs?rev=278670=gcc=rev
Log:
ipa: Prevent materialization of clones with removed bodies (PR 92109)

2019-11-25  Martin Jambor  

PR ipa/92109
* cgraph.h (cgraph_node::remove_from_clone_tree): Declare.
* cgraphclones.c (cgraph_node::remove_from_clone_tree): New method.
(cgraph_materialize_clone): Move removel from clone tree to the
the new method and use it instead.
* ipa.c (symbol_table::remove_unreachable_nodes): When removing
bodies of clones, also remove it from the clone tree.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.h
trunk/gcc/cgraphclones.c
trunk/gcc/ipa.c

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-11-22 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

--- Comment #7 from Martin Jambor  ---
After talking to Honza, I have proposed a different patch on the mailing list:

https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02205.html

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-11-20 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

--- Comment #6 from Martin Jambor  ---
So this helps:

diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index bfcebb20495..359ea53d8a6 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -1079,6 +1079,7 @@ symbol_table::materialize_all_clones (void)
   FOR_EACH_FUNCTION (node)
 {
  if (node->clone_of && node->decl != node->clone_of->decl
+ && !node->in_other_partition
  && !gimple_has_body_p (node->decl))
{
  if (!node->clone_of->clone_of)


but I a doubt it is a safe thing to do (inline clones of a clone
probably can happen to be in a different ltrans than the offline clone
and then this will break) but it IMHO shows that the materialization
of this clone in this ltrans in this particular case is useless.

Hm, perhaps the following should work?

diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index bfcebb20495..cc689d3d386 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -1079,6 +1079,7 @@ symbol_table::materialize_all_clones (void)
   FOR_EACH_FUNCTION (node)
 {
  if (node->clone_of && node->decl != node->clone_of->decl
+ && (!node->body_removed || !node->in_other_partition)
  && !gimple_has_body_p (node->decl))
{
  if (!node->clone_of->clone_of)

I'll see what breaks when I change the flag body_removed to mean what
it says (i.e. node->release_body really was called) first though.

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-11-20 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Martin Jambor  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #5 from Martin Jambor  ---
It's because we are materializing:

#7  0x010fbcb6 in tree_function_versioning (
old_decl=, 
new_decl=, tree_map=0x0, 
param_adjustments=0x7749fe20, update_clones=true, blocks_to_copy=0x0,
new_entry=0x0)
at /home/mjambor/gcc/icln/src/gcc/tree-inline.c:6279
6279  copy_body (, ENTRY_BLOCK_PTR_FOR_FN (cfun), EXIT_BLOCK_PTR_FOR_FN
(cfun),
(gdb) p new_version_node->debug()
_ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeERK7QString.constprop.0.isra.0/1877
(throwError.constprop.isra) @0x775179a0
  Type: function
  Body removed by symtab_remove_unreachable_nodes

  ^ this.  And the constprop clone is gone... and we act as if that was the
body from which we create a version... and that does not work.

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-10-23 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-reduction |
   Assignee|marxin at gcc dot gnu.org  |jamborm at gcc dot 
gnu.org

--- Comment #4 from Martin Liška  ---
I can't reduce it more, so it's hopefully a reasonable small test-case:

$ g++ 1.ii 2.ii 3.ii 4.ii -O3 -flto=auto -shared -fPIC
...
1.ii:42:572: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is
used
during IPA pass: materialize-all-clones
In function ‘throwError.constprop.isra’:
lto1: internal compiler error: in modify_call_stmt, at
ipa-param-manipulation.c:1586
0x59f0b1 ipa_param_body_adjustments::modify_call_stmt(gcall**)
../../gcc/ipa-param-manipulation.c:1586
0xa646b5 remap_gimple_stmt
../../gcc/tree-inline.c:1921
0xa6588f copy_bb
../../gcc/tree-inline.c:1996
0xa66de2 copy_cfg_body
../../gcc/tree-inline.c:2983
0xa66de2 copy_body
../../gcc/tree-inline.c:3231
0xa6ba0c tree_function_versioning(tree_node*, tree_node*, vec*, ipa_param_adjustments*, bool, bitmap_head*,
basic_block_def*)
../../gcc/tree-inline.c:6274
0x67a20a cgraph_materialize_clone
../../gcc/cgraphclones.c:1020
0x67a20a symbol_table::materialize_all_clones()
../../gcc/cgraphclones.c:1107
0x85af5f execute
../../gcc/ipa.c:1396

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-10-23 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

--- Comment #3 from Martin Liška  ---
Created attachment 47088
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47088=edit
Reduced test-case

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-10-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Martin Liška  changed:

   What|Removed |Added

 CC||jamborm at gcc dot gnu.org
  Known to work||9.2.0
  Known to fail||10.0

--- Comment #2 from Martin Liška  ---
Ok, now I have just isolated 4 pre-processed source files and I'm reducing
these ..

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-10-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Martin Liška  changed:

   What|Removed |Added

   Keywords||needs-reduction
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-10-22
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Let me work on test-case isolation.

[Bug ipa/92109] [10 Regression] ICE in modify_call_stmt, at ipa-param-manipulation.c:1586

2019-10-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92109

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |10.0
Summary|ICE in modify_call_stmt, at |[10 Regression] ICE in
   |ipa-param-manipulation.c:15 |modify_call_stmt, at
   |86  |ipa-param-manipulation.c:15
   ||86