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
Hmm, both testcases consume a very large amount of memory...
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.
SLSR goes nuts on the testcase, probably the PHI work. Bill?
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.
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
ICE fixed. SLSR issue tracked in PR81488.