Bug 81465 - [8 Regression] ICE in estimate_edge_growth at gcc/ipa-inline.h:85 on s390x target
Summary: [8 Regression] ICE in estimate_edge_growth at gcc/ipa-inline.h:85 on s390x ta...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2017-07-17 08:08 UTC by Martin Liška
Modified: 2017-11-24 13:09 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux-gnu
Target: s390x-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-08-08 00:00:00


Attachments
Tested patch candidate (459 bytes, patch)
2017-08-11 13:09 UTC, Martin Liška
Details | Diff
Tested patch candidate (485 bytes, patch)
2017-08-11 13:11 UTC, Martin Liška
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2017-07-17 08:08:35 UTC
With a cross compiler:

$ ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/abi/nvptx-nrv1.C -fno-early-inlining -Os
during IPA pass: inline
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/abi/nvptx-nrv1.C:68:1: internal compiler error: in estimate_edge_growth, at ipa-inline.h:86
 }
 ^
0xee24ee estimate_edge_growth
	../../gcc/ipa-inline.h:85
0xee2f2f estimate_size_after_inlining(cgraph_node*, cgraph_edge*)
	../../gcc/ipa-inline-analysis.c:300
0x19bc15b caller_growth_limits
	../../gcc/ipa-inline.c:186
0x19bc94e can_inline_edge_p
	../../gcc/ipa-inline.c:383
0x19bfc81 update_caller_keys
	../../gcc/ipa-inline.c:1344
0x19c1cb2 inline_small_functions
	../../gcc/ipa-inline.c:2047
0x19c3168 ipa_inline
	../../gcc/ipa-inline.c:2438
0x19c3e44 execute
	../../gcc/ipa-inline.c:2847
Comment 1 Martin Liška 2017-08-08 21:34:37 UTC
Also started with r250048.
Comment 2 Martin Liška 2017-08-11 13:09:39 UTC
Created attachment 41977 [details]
Tested patch candidate

Adding patch candidate that adds:
!opt_for_fn (edge->caller->decl, optimize)) to estimate_edge_growth. That's need because the mentioned revision introduced:

  FOR_EACH_DEFINED_FUNCTION (node)
    if (!node->alias
	&& (flag_generate_lto || flag_generate_offload|| flag_wpa
	    || opt_for_fn (node->decl, optimize)))
      inline_analyze_function (node);

which does not calculate ipa_call_summaries->get (edge)->call_stmt_size.
With the patch applied, no other inlining happens as inline_small_functions skips functions w/o optimize option.
Comment 3 Martin Liška 2017-08-11 13:11:58 UTC
Created attachment 41978 [details]
Tested patch candidate

Adding patch candidate that changes cgraph_node::verify_node that verifies
global.inlined_to && same_comdat_group. It believe proper fix is to verify that node should live in a same comdat group (if belongs to any).
Comment 4 Jan Hubicka 2017-08-11 13:23:19 UTC
OK, so now the tests passes when inline clone is either in no comdat group list (even if function inlined to is in one) or if the comdat groups are the same.  Does it fail when we test that comdats groups are always the same?  It seems iffy to allow silently both.  I guess both variants are fine, but lets pick one of them. Perhaps we want only to remove node from comdat group list while inlining it.

Honza
Comment 5 Jakub Jelinek 2017-11-24 11:30:38 UTC
Any progress on this?
Comment 6 Jan Hubicka 2017-11-24 13:09:11 UTC
The testcase no longer reproduces and we test that there is no inline clone in same comdat group:
212982     marxin   if (global.inlined_to && same_comdat_group)                 
186998    hubicka     {                                                         
186998    hubicka       error ("inline clone in same comdat group list");       
186998    hubicka       error_found = true;                                     
186998    hubicka     }                                                         

This address comment #3. Comment #2 was fixed by not estimating growth in this case.