Bug 81546 - [8 Regression] ICE at -O3 during GIMPLE pass dom
Summary: [8 Regression] ICE at -O3 during GIMPLE pass dom
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: yarpgen
  Show dependency treegraph
 
Reported: 2017-07-25 03:20 UTC by Dmitry Babokin
Modified: 2021-11-01 23:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 7.1.1
Known to fail:
Last reconfirmed:


Attachments
reduced and original test cases (491.44 KB, application/x-xz)
2017-07-25 03:20 UTC, Dmitry Babokin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Babokin 2017-07-25 03:20:54 UTC
Created attachment 41823 [details]
reduced and original test cases

gcc trunk rev250367, x86_64

Test case is reduced from much larger code. During reduction blame phase has changed from slsr to dom, but looks like it's still the same problem.

Another interesting observation, during test case reduction one of intermediate results triggered too aggressive memory allocation (more that 128Gb), this was reported separately in #81488


> time g++ -O0 -c fff.cpp

real    0m0.048s
user    0m0.035s
sys     0m0.012s

> time g++ -O2 -c fff.cpp

real    0m0.085s
user    0m0.075s
sys     0m0.010s

> time g++ -O3 -c fff.cpp
 IMM ERROR : (use_p : tree - 0x7f63cea18b68:0x7f63cea18b88)_5
for SSA_NAME: _5 in statement:
if (_5 != 0)
during GIMPLE pass: dom
fff.cpp: In function ‘void foo()’:
fff.cpp:30:6: internal compiler error: verify_ssa failed
 void foo() {
      ^~~
0x10f9043 verify_ssa(bool, bool)
        ../../gcc_svn_intel/gcc/tree-ssa.c:1186
0xe9088d execute_function_todo
        ../../gcc_svn_intel/gcc/passes.c:1996
0xe915ee execute_todo
        ../../gcc_svn_intel/gcc/passes.c:2043
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

real    2m12.280s
user    2m6.464s
sys     0m5.786s
Comment 1 Richard Biener 2017-07-25 07:42:07 UTC
Hmm, both testcases consume a very large amount of memory...
Comment 2 Dmitry Babokin 2017-07-25 07:54:57 UTC
Reduced test case consumes about 11Gb. That's a lot and looks like it's just the consequence of the real problem. But the test case in #81488 consumes 128Gb and dies on my machine because of lack of available memory.

This makes me think that two things need to be fixed - SSA bug itself and proper thresholds need to be imposed.

By the way, slight massaging of the test case makes the problem go away. For example, manual folding of -112 & 18444684886795439976ULL "fixes" the problem.
Comment 3 Richard Biener 2017-07-25 08:13:38 UTC
SLSR goes nuts on the testcase, probably the PHI work.  Bill?
Comment 4 Richard Biener 2017-07-25 08:25:17 UTC
Note the immediate use verification error is

      /* Avoid infinite loops.  50,000,000 uses probably indicates a
         problem.  */
      if (count++ > 50000000)
        goto error;

which is spurious, the issue is SLSR creating a gigantic function from nothing.
Comment 5 Richard Biener 2017-07-25 11:06:27 UTC
Author: rguenth
Date: Tue Jul 25 11:05:55 2017
New Revision: 250505

URL: https://gcc.gnu.org/viewcvs?rev=250505&root=gcc&view=rev
Log:
2017-07-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/81546
	* tree-ssa-operands.c (verify_imm_links): Remove cap on number
	of immediate uses, be more verbose on errors.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-operands.c
Comment 6 Richard Biener 2017-07-25 11:07:48 UTC
ICE fixed.  SLSR issue tracked in PR81488.