With the fix for PR33870 we now create _loads_ of VOPs for QTs qmake makefile.cpp at even -O so that all machines I have either run OOM or with a debug build of gcc, tree-ssa-sccvn.c:1853 (DFS visiting VUSEs) recurses too deeply and blows the 8MB stack on x86_64 (and takes too much compile-time). Which means, we no longer can build QT.
Created attachment 14577 [details] testcase (unreduced)
tree-ssa-sccvn should use a non-recursive DFS algorithm. Though, that is only part of the solution here, I suppose.
Yes, I wonder if we can "cut" the DFS walk somewhere - in this case we have 1000s of stmts with each ~200 VUSEs...
One workaround in this case is to run another forwprop / dce between inlining and the first alias pass. This get's rid of a lot of pointers and pointed to temporaries. Still that doesn't address the fundamental problems here. (but it makes the testcase work nicely within a bound of 600MB peak memory usage)
With just a forwprop pass after inlining and before salias we miscompile cp/semantics.c:pop_to_parent_deferring_access_checks() at -O2. An optimization barrier like pop_to_parent_deferring_access_checks (void) { if (deferred_access_no_check) deferred_access_no_check--; else { VEC (deferred_access_check,gc) *checks; deferred_access *ptr; checks = (VEC_last (deferred_access, deferred_access_stack) ->deferred_access_checks); VEC_pop (deferred_access, deferred_access_stack); __asm__ __volatile__ ("" : : : "memory"); ptr = VEC_last (deferred_access, deferred_access_stack); fixes it. Reducing max-aliased-vops to 100 (as with -O1 which also passes) fixes the problem as well. -O1 -fstrict-aliasing --param max-aliased-vops=500 (as with -O2) also breaks. Disabling DOM makes it work again.
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01046.html fixes the miscompile of the C++ frontend. -fno-strict-aliasing makes the testcase consume a lot more memory than -fstrict-aliasing. Which is why -O is also a lot worse than -O2. What one can also notice is that we create lots of unpartitionable SFTs for structures with just _one_ SFT -- we should not need to create SFTs for those at all.
Created attachment 14585 [details] worse testcase
Subject: Bug 34148 Author: rguenth Date: Wed Nov 21 10:16:21 2007 New Revision: 130329 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130329 Log: 2007-11-21 Richard Guenther <rguenther@suse.de> PR tree-optimization/34148 * tree-ssa-structalias.c (create_variable_info_for): Do not use field-sensitive PTA for single-element structures. * tree-ssa-alias.c (create_overlap_variables_for): Do not create SFTs for single-element structures. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-alias.c trunk/gcc/tree-ssa-structalias.c
Fixed.