[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-03-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #20 from Jan Hubicka  ---
Fixed.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-03-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #19 from Jan Hubicka  ---
Author: hubicka
Date: Thu Mar 10 16:11:14 2016
New Revision: 234115

URL: https://gcc.gnu.org/viewcvs?rev=234115=gcc=rev
Log:

PR lto/69589
* cgraph.c (cgraph_node::dump): Dump split_part and
indirect_call_target.
* cgraph.h (cgraph_node): Add indirect_call_target flag.
* ipa.c (has_addr_references_p): Cleanup.
(is_indirect_call_target_p): New.
(walk_polymorphic_call_targets): Do not mark virtuals that may be
called indirectly as local.
(symbol_table::remove_unreachable_nodes): Compute indirect_call_target.

* g++.dg/lto/pr69589_0.C: New testcase
* g++.dg/lto/pr69589_1.C: New testcase

Added:
trunk/gcc/testsuite/g++.dg/lto/pr69589_0.C
trunk/gcc/testsuite/g++.dg/lto/pr69589_1.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.c
trunk/gcc/cgraph.h
trunk/gcc/ipa.c
trunk/gcc/testsuite/ChangeLog

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-03-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #18 from Jan Hubicka  ---
Author: hubicka
Date: Thu Mar 10 16:02:55 2016
New Revision: 234113

URL: https://gcc.gnu.org/viewcvs?rev=234113=gcc=rev
Log:

PR lto/69589
* tree.c (free_lang_data_in_decl): Clear visibility of TYPE_DECL.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree.c

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-03-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #17 from Jan Hubicka  ---
Author: hubicka
Date: Thu Mar 10 16:02:00 2016
New Revision: 234112

URL: https://gcc.gnu.org/viewcvs?rev=234112=gcc=rev
Log:
PR lto/69589
* tree.c (need_assembler_name_p): Only record main variant type names.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree.c

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-25 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Jan Hubicka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

--- Comment #16 from Jan Hubicka  ---
I am looking into the actual ICE.  The reason is that the function is virtual
and it appears as possible polymorphic call target.  As such it probably should
not be declared local.  Will cook up the patch.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-25 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Jan Hubicka  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-02-25
 Ever confirmed|0   |1

--- Comment #15 from Jan Hubicka  ---
Looking into the ICE now.  Interesting detail is that type S is not merged even
though it is very simple:

#pragma GCC visibility push(hidden)
struct S {
  int e;
  virtual ~S () {}
};

--- aa  2016-02-25 14:35:42.111872702 +0100
+++ bb  2016-02-25 14:35:40.918649436 +0100
@@ -1,24 +1,26 @@
-  constant 128>
 unit size  constant 16>
 align 64 symtab 0 alias set -1 canonical type 0x76cbc2a0
-fields 
 unsigned DI
 size 
 unit size 
 align 64 symtab 0 alias set -1 structural equality>
-unsigned virtual DI file a.C line 7 col 8
+unsigned virtual DI file b.C line 38 col 8
 size 
 unit size 
 align 64 offset_align 128
 offset 
-bit offset  context

-chain 
-nonlocal SI file a.C line 8 col 7
+bit offset  context

+chain 
+nonlocal SI file b.C line 39 col 7
 size 
 unit size 
 align 32 offset_align 128
 offset 
-bit offset  context
>> context 
-chain >duplicate #0
+bit offset  context
>> context 
+pointer_to_this  chain > 
 dunno why it can't be merged.

Richi, any idea?

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-15 Thread kugan.vivekanandarajah at linaro dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #14 from kugan.vivekanandarajah at linaro dot org ---
On 16/02/16 02:02, jamborm at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589
>
> --- Comment #13 from Martin Jambor  ---
> (In reply to kugan from comment #11)
>> In remove_unreachable_nodes, just before ipa-cp, this node becomes local
>> (address taken is false and local.local = true). After that, when
>> ipa_propagate_frequency is run, which updates the frequency to zero. I think
>> we should check the frequency at this point in time and remove such nodes.
>
> If remove_unreachable_nodes keeps the node around for comdat reasons,
> we cannot remove it just because it has zero estimated frequency
> (unless remove_unreachable_nodes was wrong and should have removed the
> node itself).
>
> I think that remove_unreachable_nodes should either remove the node,
> or not set it to local (or set something like force_output or
> forced_by_abi, if it is some really weird case).
Thanks for the comment. It looks to me that it is already done.

  /* If any symbol in a comdat group is reachable, force
 all externally visible symbols in the same comdat
 group to be reachable as well.  Comdat-local symbols
 can be discarded if all uses were inlined.  */



The problem seems to be that, for the reduced test case, at the point 
when the node becomes local, frequency = 2. After 
ipa_propagate_frequency is run, frequency becomes zero. I dont think 
that this case is handled now.

Maybe we should change the removal pas as :

+  for (unsigned int i = 0; i < new_locals.length (); ++i)
+{
+  if (!new_locals[i]->frequency)
+   {
+ node = new_locals[i];
+ if (!node->aux)
+   {
+ if (file)
+   fprintf (file, " %s/%i", node->name (), node->order);
+ node->remove ();
+ changed = true;
+   }
+   }
+}

Thanks,
Kugan

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-15 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #13 from Martin Jambor  ---
(In reply to kugan from comment #11)
> In remove_unreachable_nodes, just before ipa-cp, this node becomes local
> (address taken is false and local.local = true). After that, when
> ipa_propagate_frequency is run, which updates the frequency to zero. I think
> we should check the frequency at this point in time and remove such nodes.

If remove_unreachable_nodes keeps the node around for comdat reasons,
we cannot remove it just because it has zero estimated frequency
(unless remove_unreachable_nodes was wrong and should have removed the
node itself).

I think that remove_unreachable_nodes should either remove the node,
or not set it to local (or set something like force_output or
forced_by_abi, if it is some really weird case).

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #12 from kugan at gcc dot gnu.org ---
Created attachment 37688
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37688=edit
possible fix

This fixes the testcase.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #11 from kugan at gcc dot gnu.org ---
In remove_unreachable_nodes, just before ipa-cp, this node becomes local
(address taken is false and local.local = true). After that, when
ipa_propagate_frequency is run, which updates the frequency to zero. I think we
should check the frequency at this point in time and remove such nodes.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Jan Hubicka  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #10 from Jan Hubicka  ---
Hello from China and thanks for the analysis,
(gdb) p node->debug()
_ZN2JS3ubi20PreComputedEdgeRangeD2Ev/73127 (__base_dtor ) @0x75666e60
  Type: function definition analyzed
  Visibility: prevailing_def_ironly artificial
  Aux: @0x2a89e30  References: 
  Referring: 
  Read from file: Unified_cpp_js_src35.o
  Availability: local
  First run: 0
  Function flags: local merged_comdat unlikely_executed
  Called by: 
  Calls:
the node is local and not externally visible

  /* If any symbol in a comdat group is reachable, force
 all externally visible symbols in the same comdat
 group to be reachable as well.  Comdat-local symbols
 can be discarded if all uses were inlined.  */
  if (node->same_comdat_group)
{
  symtab_node *next;
  for (next = node->same_comdat_group;
   next != node;
   next = next->same_comdat_group)
if (!next->comdat_local_p ()
&& !reachable.add (next))
  enqueue_node (next, , );
}

This loop explicitly skips comdat_local_p. In general local flag should imply
comdat_local_p on comdat symbols. It should be possible to add gcc_assert that
the node is never local when enqueue_node is called here.

In your second dump the node is still externally visible and !local, so it may
be necessary to lookup when it becomes local and why it is not removed
afterwards?  I think only whole_program_visibility pass brings nodes local, so
you may want to breakpoint in the remove_unreachable_nodes call that is done
just before ipa-cp.

Honza

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
Created attachment 37632
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37632=edit
pr69689-1.C

Slightly more cleaned up test.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #9 from Jakub Jelinek  ---
Created attachment 37633
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37633=edit
pr69589-2.C

g++ -O2 -rdynamic -flto -o pr69589 pr69589-1.C pr69589-2.C

This doesn't even emit -Wodr warnings etc.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-05 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #7 from Martin Liška  ---
Reduced test case:

$ g++ -O2 -rdynamic -flto tc1.ii tc2.ii

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-05 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #5 from Martin Liška  ---
Created attachment 37600
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37600=edit
tc1.ii

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-05 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #6 from Martin Liška  ---
Created attachment 37601
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37601=edit
tc2.ii

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #4 from Martin Liška  ---
The node is added to reachable set in symbol_table::remove_unreachable_nodes
because of following condition is true:

  /* If any symbol in a comdat group is reachable, force
 all externally visible symbols in the same comdat
 group to be reachable as well.  Comdat-local symbols
 can be discarded if all uses were inlined.  */
  if (node->same_comdat_group)
{
  symtab_node *next;
  for (next = node->same_comdat_group;
   next != node;
   next = next->same_comdat_group)
if (!next->comdat_local_p ()
&& !reachable.add (next))
  enqueue_node (next, , );
}

Where node->debug():

(gdb) p node->debug()
_ZN2JS3ubi20PreComputedEdgeRangeD0Ev/73129 (__deleting_dtor ) @0x756702e0
  Type: function definition analyzed
  Visibility: externally_visible prevailing_def_ironly public weak comdat
comdat_group:_ZN2JS3ubi20PreComputedEdgeRangeD5Ev one_only visibility_specified
visibility:hidden virtual artificial
  Same comdat group as: _ZN2JS3ubi20PreComputedEdgeRangeD2Ev/73127
  Address is taken.
  Aux: @0x75667000  References: 
  Referring: _ZTVN2JS3ubi20PreComputedEdgeRangeE/73125 (addr)
  Read from file: Unified_cpp_js_src35.o
  First run: 0
  Function flags: merged_comdat
  Called by: 
  Calls: _ZdlPvm/39897 (1.00 per call) 

I've been still reducing the test-case, currently the total size is about
5.5MB.

Martin

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #3 from Martin Liška  ---
The problematic symbol:

(gdb) p node->debug()
_ZN2JS3ubi20PreComputedEdgeRangeD2Ev/73127 (__base_dtor ) @0x75666e60
  Type: function definition analyzed
  Visibility: prevailing_def_ironly artificial
  Aux: @0x2a89e30  References: 
  Referring: 
  Read from file: Unified_cpp_js_src35.o
  Availability: local
  First run: 0
  Function flags: local merged_comdat unlikely_executed
  Called by: 
  Calls:

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
   Target Milestone|--- |6.0

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-01 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #1 from Martin Liška  ---
I fixed my reduction script, now reducing about ~14MB of pre-processed source
files.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-01 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

Martin Jambor  changed:

   What|Removed |Added

 CC||jamborm at gcc dot gnu.org

--- Comment #2 from Martin Jambor  ---
This assert triggers when there is a local node that does not have a
caller.  Such nodes should have been removed (before IPA-CP is run)
because they are unreachable.  (If we did not assert here,
verification that IPA-CP propagation reached all functions would
fail.)  So I guess we need to find out why that did not happen.